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
Merged

Test for #1653 #1768

merged 3 commits into from Feb 19, 2019

Conversation

ili
Copy link
Contributor

@ili 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 November 26, 2018 23:10
src/.editorconfig Outdated Show resolved Hide resolved
@ili
Copy link
Contributor Author

ili commented Feb 11, 2019

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

Thanks a lot!

@RicoSuter
Copy link
Owner

@ili so this is already fixed?

@ili
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants