Closed mssalvatore closed 5 months ago
When migrating from Pydantic 1 to Pydantic 2, this detail was missed. The schema generated for PercentLimited did not include the maximum. The type's schema needed to be redefined using Annotated in order to add the maximum to the JSON schema.
So the PercentLimited model would reject a value outside the [0, 100] range, but this was not being reflected in the schema?
Correct. There's a validator function that enforces validation.
When migrating from Pydantic 1 to Pydantic 2, this detail was missed. The schema generated for PercentLimited did not include the maximum. The type's schema needed to be redefined using Annotated in order to add the maximum to the JSON schema.