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

Change Extra.forbid to Extra.ignore #9

Closed
Goldziher opened this issue Jan 7, 2022 · 2 comments · Fixed by #11
Closed

Change Extra.forbid to Extra.ignore #9

Goldziher opened this issue Jan 7, 2022 · 2 comments · Fixed by #11

Comments

@Goldziher
Copy link

Hi there,

The usage of Extra.forbid is difficult to work with in other libraries, because it requires sanitizing data before interacting with this library. Is it possible to change Extra.forbid to Extra.ignore? Especially for Schema but also other models.

@kuimono
Copy link
Owner

kuimono commented Feb 3, 2022

The Extra.forbid bits are intentionally added there, so that the schema classes do not support Specification Extensions in general.

If extra fields are needed, one may try to extend the class for customizations.

@Goldziher
Copy link
Author

Goldziher commented Feb 3, 2022

Hi,

Extra.ignore will also disallow extra values, but it will not raise exceptions.

If you want this library to be easy to interact with, I would suggest switching. I already wrapped this library in a lot if code to handle this, but it just adds a lot of extra complexity.

JensHeinrich pushed a commit to JensHeinrich/openapi-schema-pydantic that referenced this issue Feb 16, 2023
This enables setting the extras option on a global scale.
This enables the usecase of kuimono#14 while still being in the spirit of kuimono#9.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants