Skip to content

export_schemas

Export the schemas for the compositions and patterns.

Classes

SchemaResult dataclass

SchemaResult(composition_schema: str, pattern_schema: str)

The result of exporting the schemas.

Functions

export_schemas

export_schemas() -> SchemaResult

Export the schemas.

generate_schema

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

Generates a JSON schema representation of a given Pydantic model.

This function takes a Pydantic model and a schema ID to generate a JSON schema that adheres to the given $schema version of “https://json-schema.org/draft/2020-12/schema”. The resulting JSON schema includes the provided schema ID.

PARAMETER DESCRIPTION
model

The Pydantic model to generate the JSON schema for.

TYPE: type[BaseModel]

RETURNS DESCRIPTION
str

A JSON string representing the schema for the provided Pydantic model.