Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test for #1653 #1768

Merged
merged 3 commits into from Feb 19, 2019

Conversation

Projects
None yet
2 participants
@ili
Copy link
Contributor

ili commented Nov 26, 2018

Test demonstrates that properties are not initialized:

class GenericRequestBaseOfRequestBody implements IGenericRequestBaseOfRequestBody {
    request!: RequestBody;

    constructor(data?: IGenericRequestBaseOfRequestBody) {
        if (data) {
            for (var property in data) {
                if (data.hasOwnProperty(property))
                    (<any>this)[property] = (<any>data)[property];
            }
        } 
        // here should be this.request initialization
    }

    init(data?: any) {
        if (data) {
            this.request = data["Request"] ? RequestBody.fromJS(data["Request"]) : new RequestBody();
        }
    }

    static fromJS(data: any): GenericRequestBaseOfRequestBody {
        data = typeof data === 'object' ? data : {};
        let result = new GenericRequestBaseOfRequestBody();
        result.init(data);
        return result;
    }

    toJSON(data?: any) {
        data = typeof data === 'object' ? data : {};
        data["Request"] = this.request ? this.request.toJSON() : <any>undefined;
        return data; 
    }
}

@RicoSuter RicoSuter self-requested a review Nov 26, 2018

Show resolved Hide resolved src/.editorconfig Outdated
@ili

This comment has been minimized.

Copy link
Contributor Author

ili commented Feb 11, 2019

I'v checked with current master branch, test succeed!

Thanks a lot!

@RicoSuter

This comment has been minimized.

Copy link
Owner

RicoSuter commented Feb 13, 2019

@ili so this is already fixed?

@ili

This comment has been minimized.

Copy link
Contributor Author

ili commented Feb 19, 2019

@RSuter Yes! )

@RicoSuter RicoSuter merged commit d25cfd2 into RicoSuter:master Feb 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.