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
JSON Schema is wrong when mode='serialization'
and fields have a default
#8413
Comments
If I recall correctly, we actually did things this way at first, and reverted the change. The reasons for this were (in roughly descending order of importance, imo):
In particular, see this issue: #7209 However, I explicitly added a config setting for this: |
Thanks, sorry I didn't see It sounds like this definitely shouldn't change in a minor release, but we should perhaps change the default or make it more powerful in V3. The only think we could do now is make this configurable on Another limitation of this being on |
You can override the logic in In the future, if we want to make this method easier to use, we might modify the signature to receive the source type and field name as inputs. Passing the field name would be easy as it is already accessible everywhere we currently call We definitely could make this change in a backwards compatible way by doing some form of introspection of the signature of the |
Initial Checks
Description
In the example below,
bar
will always have a value, so should be included inrequired
, but it's not.Example Code
Python, Pydantic & OS Version
The text was updated successfully, but these errors were encountered: