-
Notifications
You must be signed in to change notification settings - Fork 312
Description
pydantic/pydantic#11271 disabled core schema validation, which introduces some issues as some constraints where previously coerced according to the core schema definitions (e.g. float -> Decimal for decimal_schema), see pydantic/pydantic#11341.
For now, we manually coerce these values in Pydantic before constructing the core schema, but alternatively we might loosen the type hints (to something like float | Decimal) and pydantic-core then does the coercion when building the validator/serializer. One important thing is that for dates et al., we'll have to use Pydantic validation to coerce e.g. string values to proper date/datetime instances. This is possible (although not pretty) to do so in Pydantic by using a TypeAdapter(date), not sure if we can do the same in pydantic-core during validator/serializer building?