Skip to content
masterclass Buddy

Pydantic · Type Alias

WithJsonSchema

WithJsonSchema lets you replace Pydantic’s generated JSON Schema for a type. Use it inside Annotated, especially for types without a default schema.

Last updated

Syntax

WithJsonSchema(json_schema: JsonSchemaValue, mode: JsonSchemaMode | None = None)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • SkipJsonSchema
  • Field
  • Annotated
  • json_schema_input_type
  • __get_pydantic_json_schema__

Source: JSON Schema | Pydantic Docs. Checked 2026-11-03.