pydantic / pydantic-extra-types

Extra Pydantic types.
MIT License
181 stars 48 forks source link

Fix Color JSON schema generation #21

Closed dmontagu closed 1 year ago

dmontagu commented 1 year ago

Addresses my comment on #20.

Note that with the change from #20, if you try to generate a JSON schema for a model with a field of type Color, it actually errors:

pydantic.errors.PydanticInvalidForJsonSchema: Cannot generate a JsonSchema for core_schema.FunctionSchema (<bound method Color._validate of <class 'pydantic_extra_types.types.color.Color'>>)