Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add an easy way to change extra = meta option #116

Open
sobolevn opened this issue Feb 13, 2025 · 0 comments
Open

Add an easy way to change extra = meta option #116

sobolevn opened this issue Feb 13, 2025 · 0 comments

Comments

@sobolevn
Copy link

Right now all models allow extra fields:

# extra = "allow"

I don't want that behavior, I want to be strict on my input types: no extras are allowed in authentication.
So, how to change that?

Now I have to change all settings in

NINJA_JWT = {
  'TOKEN_OBTAIN_PAIR_INPUT_SCHEMA': "custom",
  'TOKEN_OBTAIN_PAIR_REFRESH_INPUT_SCHEMA': "custom",
  'TOKEN_VERIFY_INPUT_SCHEMA': "custom",
}

To only change one configuration option.

I would like to see something like:

NINJA_JWT = {
  'SCHEMAS_EXTRA': 'forbid',  # with 'allow' as default for backward-compat
}

See https://docs.pydantic.dev/latest/api/config/#pydantic.config.ConfigDict.extra

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant