Skip to main content

Model Classes Code Improved

· One min read

We've made an improvement to how model properties are now generated in the code. The generated SDK now contains both camel case-d version of the property name and the actual property name (where applicable).
Read on to find more details about the change.

Please generate your SDK again to get the improved code.

Details Of Change

Previously, the argument passed to getValue function in the constructor of Model files was always camel case-d. However, now both versions (the original name and the camel case-d name) are passed with an OR condition if the actual name is not originally camel case-d.
We're supporting both styles now so in case a deserialized model is passed as the argument to the constructor when instantiating the model directly, the code will still stay valid.

This is not a breaking change.

Example Code

Previously, this code was generated (as an example) for a property named Test Model

constructor(obj) {
super(obj);
if (obj === undefined || obj === null) return;
this.testModel = this.constructor.getValue(obj.testModel);
}

But now, this will be generated:

constructor(obj) {
super(obj);
if (obj === undefined || obj === null) return;
this.testModel = this.constructor.getValue(obj.testModel || obj['Test Model']);
}