Skip to content

Validation of core schemas #1608

@Viicos

Description

@Viicos

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions