json scheme
This commit is contained in:
@@ -148,6 +148,17 @@ class CpfCnpj:
|
||||
|
||||
return cpfcnpj_
|
||||
|
||||
@classmethod
|
||||
def __get_pydantic_json_schema__(
|
||||
cls, core_schema: core_schema.CoreSchema, handler: GetJsonSchemaHandler
|
||||
) -> JsonSchemaValue:
|
||||
field_schema = handler(core_schema)
|
||||
field_schema.update(
|
||||
type='string',
|
||||
format=cls.__name__.lower().removesuffix('str'),
|
||||
)
|
||||
return field_schema
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
CpfStr = Annotated[str, ...]
|
||||
|
||||
Reference in New Issue
Block a user