Skip to main content

Additional Model Properties Support in Node SDK

· One min read

NodeJS SDKs can now optionally preserve additional properties returned in the response. This setting can be enabled via Settings > CodeGen Settings page in the API editor and turning on the Enable Additional Model Properties flag.

Details

  • A property additionalProperties and a function addAdditionalProperty have been added to model classes to store additional model properties.
  • additionalProperties which has been added to model classes is an associative array. It stores key-value pairs in an array.
  • The toJSON function in model classes now includes additional model properties in the serialized model that it returns. When called, it will return all addtional properties added to the model as individual properties. Array of additional properties will not be returned.
  • ObjectMapper class has functionality added to cater for additional properties when mapping model properties.
  • A flag (function parameter) has been added to mapObject function of ObjectMapper class due to which controllers' call to mapObject has been updated as well.

This feature is now supported in all language SDKs except AngularJS and Go.