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
Additional context
There's a few workarounds, but both are undesirable:
Omit the --field-constraints option, which uses conint for enforcing constraints. But it fails to pass MyPy with the error "Invalid type comment or annotation".
Avoid using strict field attributes and enforce Pydantic strict mode via Timestamp.model_validate('123', strict=True). But then the generated model is vulnerable if we forget to pass strict=True.
The text was updated successfully, but these errors were encountered:
Describe the bug
When using
—strict-types
and--field-constraints
(or--use-annotated
) together, the field constraints are not added to the Field.To Reproduce
Example schema:
Used commandline:
Expected behavior
Generates the model
Actual behavior
Generates the model
Version:
Additional context
There's a few workarounds, but both are undesirable:
--field-constraints
option, which usesconint
for enforcing constraints. But it fails to pass MyPy with the error "Invalid type comment or annotation".Timestamp.model_validate('123', strict=True)
. But then the generated model is vulnerable if we forget to passstrict=True
.The text was updated successfully, but these errors were encountered: