Skip to content

common ¤

Griffe extension for Pydantic.

Functions:

json_schema ¤

json_schema(model: type[BaseModel]) -> str

Produce a model schema as JSON.

Parameters:

Returns:

  • str

    A schema as JSON.

process_class ¤

process_class(cls: Class) -> None

Set metadata on a Pydantic model.

Parameters:

  • cls (Class) –

    The Griffe class representing the Pydantic model.

process_function ¤

process_function(
    func: Function, cls: Class, fields: Sequence[str]
) -> None

Set metadata on a Pydantic validator.

Parameters:

  • cls (Class) –

    A Griffe function representing the Pydantic validator.