We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
extra =
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
Right now all models allow extra fields:
django-ninja-jwt/ninja_jwt/schema.py
Line 100 in 2fb51bf
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
The text was updated successfully, but these errors were encountered:
@sobolevn Sorry for the late response, reason #123
I think this is related to #117 I will look at this feature over the weekend
Sorry, something went wrong.
@sobolevn I think you inherit from the existing schema and change the model_config then have the schema referenced in the setting like so:
model_config
NINJA_JWT = { 'TOKEN_OBTAIN_PAIR_INPUT_SCHEMA': "path.to.the.schema.with.a.different.model_config", 'TOKEN_OBTAIN_PAIR_REFRESH_INPUT_SCHEMA': "custom", 'TOKEN_VERIFY_INPUT_SCHEMA': "custom", }
This is exactly what I did. And it seems very verbose for just a simple bool switch.
bool
No branches or pull requests
Right now all models allow extra fields:
django-ninja-jwt/ninja_jwt/schema.py
Line 100 in 2fb51bf
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
To only change one configuration option.
I would like to see something like:
See https://docs.pydantic.dev/latest/api/config/#pydantic.config.ConfigDict.extra
The text was updated successfully, but these errors were encountered: