Schema model¶
The JSON Schema document model — what you build, or validate raw input into, before conversion.
Public JSON Schema models: Schema, Reference, and the DataType enum.
The models live in the private _models submodule; this package re-exports only the public
names. See the schema guide.
DataType
¶
Reference
¶
Schema
¶
Bases: BaseModel
JSON Schema object.
Declares the JSON Schema 2020-12 validation and applicator keywords; any other or
custom keyword is still preserved via extra="allow" per spec §4.3.1 / §6.5.
The converter consumes every declared keyword (format is annotation-only unless a
matching formats entry is supplied, per the spec). Unknown or custom keywords still
round-trip through parsing and serialization but do not affect the generated model.
See:
type
¶
The type keyword: allowed JSON type(s). Validation §6.1.1.
properties
¶
The properties keyword: schemas for object properties. Core §10.3.2.1.
items
¶
The items keyword: the schema for array elements. Core §10.3.1.2.
prefix_items
¶
The prefixItems keyword: schemas for the leading array elements (tuple). Core §10.3.1.1.
contains
¶
The contains keyword: at least one array element must match this schema. Core §10.3.1.3.
additional_properties
¶
The additionalProperties keyword: schema/toggle for extra properties. Core §10.3.2.3.
pattern_properties
¶
The patternProperties keyword: schemas for properties matching a regex. Core §10.3.2.2.
property_names
¶
The propertyNames keyword: schema every property name must match. Core §10.3.2.4.
required
¶
The required keyword: names of required properties. Validation §6.5.3.
min_properties
¶
The minProperties keyword: minimum number of properties. Validation §6.5.2.
max_properties
¶
The maxProperties keyword: maximum number of properties. Validation §6.5.1.
dependent_required
¶
The dependentRequired keyword: properties required when another is present. Validation §6.5.4.
dependent_schemas
¶
The dependentSchemas keyword: subschemas applied when a property is present. Core §10.2.2.4.
all_of
¶
The allOf keyword: must match every subschema. Core §10.2.1.1.
any_of
¶
The anyOf keyword: must match at least one subschema. Core §10.2.1.2.
one_of
¶
The oneOf keyword: must match exactly one subschema. Core §10.2.1.3.
not_
¶
The not keyword: must NOT match this subschema. Core §10.2.1.4.
if_
¶
The if keyword: condition subschema gating then / else. Core §10.2.2.1.
multiple_of
¶
The multipleOf keyword: value must be a multiple of this. Validation §6.2.1.
exclusive_maximum
¶
The exclusiveMaximum keyword: exclusive upper bound. Validation §6.2.3.
exclusive_minimum
¶
The exclusiveMinimum keyword: exclusive lower bound. Validation §6.2.5.
min_length
¶
The minLength keyword: minimum string length. Validation §6.3.2.
max_length
¶
The maxLength keyword: maximum string length. Validation §6.3.1.
pattern
¶
The pattern keyword: regex the string must match. Validation §6.3.3.
unique_items
¶
The uniqueItems keyword: array elements must be unique. Validation §6.4.3.
max_contains
¶
The maxContains keyword: max elements matching contains. Validation §6.4.4.
min_contains
¶
The minContains keyword: min elements matching contains. Validation §6.4.5.
format
¶
The format keyword: a semantic format (e.g. date-time). Validation §7.
description
¶
The description keyword: a human-readable explanation. Validation §9.1.
default
¶
The default keyword: a default value for the instance. Validation §9.2.
defs
¶
The $defs keyword: reusable subschema definitions. Core §8.2.4.