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

Forbid extra fields #3

Open
symroe opened this issue Mar 27, 2024 · 0 comments
Open

Forbid extra fields #3

symroe opened this issue Mar 27, 2024 · 0 comments

Comments

@symroe
Copy link
Member

symroe commented Mar 27, 2024

If we pass JSON to a model, the default is that it will ignore extra fields not defined on it.

This isn't useful if we want to validate JSON, so it would be better to do:

class Config:
    extra = Extra.forbid

This does mean that we'll be less tolerant and produce more errors if we don't add fields properly, but that's sort of the point of this library.

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

No branches or pull requests

1 participant