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

From Discord: Issue with additionalProperties: false in OpenAPI Schema Generation #4531

Closed
effect-bot opened this issue Feb 28, 2025 · 0 comments · Fixed by #4540 or #4553
Closed

From Discord: Issue with additionalProperties: false in OpenAPI Schema Generation #4531

effect-bot opened this issue Feb 28, 2025 · 0 comments · Fixed by #4540 or #4553

Comments

@effect-bot
Copy link

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 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.

Discord thread

https://discord.com/channels/795981131316985866/1344727853970755751

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants