You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The conversation involves a user, hazlo_ooo, who is experiencing an issue with OpenAPI schema generation using the OpenApi.fromApi(api) function, where the generated request/response types default to "additionalProperties": false. This setting is problematic because it causes clients to fail when new fields are added, violating Postel's Law, which suggests that unknown fields should be ignored by clients to allow API evolution.
The user is seeking a way to globally override this behavior to set additionalProperties to true, thus making the APIs more evolvable.
Key takeaways:
There's a need for a global setting to change the default behavior of additionalProperties when generating OpenAPI schemas.
The discussion mentions the possibility of adding an options argument to OpenApi.fromApi, although the exact modeling of this setting is challenging.
An example from another library, zod-to-json-schema, is mentioned, which uses a removeAdditionalStrategy option to configure similar behavior, with "strict" corresponding to additionalProperties: false.
Summary
The conversation involves a user, hazlo_ooo, who is experiencing an issue with OpenAPI schema generation using the
OpenApi.fromApi(api)
function, where the generated request/response types default to"additionalProperties": false
. This setting is problematic because it causes clients to fail when new fields are added, violating Postel's Law, which suggests that unknown fields should be ignored by clients to allow API evolution.The user is seeking a way to globally override this behavior to set
additionalProperties
totrue
, thus making the APIs more evolvable.Key takeaways:
additionalProperties
when generating OpenAPI schemas.options
argument toOpenApi.fromApi
, although the exact modeling of this setting is challenging.zod-to-json-schema
, is mentioned, which uses aremoveAdditionalStrategy
option to configure similar behavior, with"strict"
corresponding toadditionalProperties: false
.Discord thread
https://discord.com/channels/795981131316985866/1344727853970755751
The text was updated successfully, but these errors were encountered: