You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that using model_json_schema on type annotations combining typing.Annotated and pydantic.Field result in the Annotated not being marked as required.
I'll mark this as a bug, though I suppose it could also be a feature request attached to #8534 relating to general support for Annotated types with create_model.
Thanks for reporting this! PRs welcome with a fix / support!
Initial Checks
Description
It seems that using
model_json_schema
on type annotations combiningtyping.Annotated
andpydantic.Field
result in theAnnotated
not being marked asrequired
.Example Code
Results in:
I would have expected the JSON schema containing
'required': ['foo', 'bar', 'baz']
instead of'required': ['foo'],
Python, Pydantic & OS Version
The text was updated successfully, but these errors were encountered: