Closed ctreatma closed 1 year ago
Making additional properties accessible, as done in this PR, is an alternative way to work around missing fields in the spec. Patching would still be the preferred approach, but having the option to use additionalProperties
can unblock SDK users while they wait for spec fixes/patches.
In order to ensure that the code we generate behaves according to the OpenAPI specification, we need to set
disallowAdditionalPropertiesIfNotPresent
tofalse
.The OpenAPI specification is built on top of the JSON schema spec. In the JSON schema spec,
additionalProperties
defaults totrue
in order to maximize forward compability: a client library should not break because a new property was added to an response.The default behavior of the OpenAPI generator is to generate code that does not provide access to
additionalProperties
, and that validates API responses inconsistently (in, e.g.,oneOf
schemas, additional properties will fail validation, but passing the same JSON to the same model outside of aoneOf
will pass validation).Generating code according to the OpenAPI spec makes our code more predictable and forces us to document any restrictions on additional properties in our API spec.
Fixes #82