Skip to main content
This page covers new and changed features in OpenAPI 3.1 (3.1.0–3.1.2) relative to OAS 3.0. Only deltas are documented — for base feature coverage, see the OAS 3.0 page.

Data Types

OAS 3.1 aligns data types with JSON Schema Draft 2020-12. The primitive format table is unchanged from OAS 3.0.
FieldSupportBehavior
type as array["string", "null"] maps to str | None, ["string", "integer"] maps to str | int
contentEncodingbase64/base64url generates format: byte validation. base16/base32 stored as metadata. Raw value surfaced in Field(json_schema_extra=...) for LLM visibility
contentMediaTypeSurfaced in Field(json_schema_extra=...) alongside contentEncoding and format
type: "null" standaloneMaps to None type annotation
contentSchemaSchema of decoded content. Not processed

OpenAPI Object (Root)

FieldSupportBehavior
pathsSpecification must contain at least one of paths, components, or webhooks. Specifications without paths produce no tools
jsonSchemaDialectStandard OAS 3.1 dialect assumed. Custom JSON Schema dialects not supported
webhooksNot supported. Planned for a future release

Info Object

New summary field added to the Info Object.
FieldSupportBehavior
summaryRendered in generated server module docstring and README

License Object

New identifier field for SPDX license expressions.
FieldSupportBehavior
identifierSPDX license expression (e.g., "Apache-2.0"); mutually exclusive with url. Rendered in generated server docstring and README. Takes precedence over url when present

Schema Object

The Schema Object is now a superset of JSON Schema Draft 2020-12.

Changed Keywords

FieldSupportBehavior
exclusiveMaximumNow a standalone number (was boolean in 3.0). Both forms generate correct Field(lt=...) constraints
exclusiveMinimumNow a standalone number (was boolean in 3.0). Both forms generate correct Field(gt=...) constraints
typeCan now be a string or array. ["string", "null"] maps to str | None, ["string", "integer"] maps to str | int
exampleDeprecated in 3.1 in favor of examples. Both forms are read and emitted in generated Field(examples=[...])
$ref siblings$ref can now coexist with sibling keywords. Generated output merges description, summary, default, deprecated, readOnly, writeOnly from siblings
nullableRemoved in 3.1, replaced by type arrays. Both forms produce identical T | None type annotation. See nullable limitation

New JSON Schema 2020-12 Keywords

Conditional / Composition
FieldSupportBehavior
if / then / elseGenerates @model_validator with conditional logic. When if matches, then constraints enforced; otherwise else constraints
dependentRequiredGenerates @model_validator enforcing “if field X present, fields Y and Z required”
constGenerates Literal[value] type annotation
dependentSchemasNot processed. Referenced schemas within are discovered for model generation, but conditional application is not enforced
Array
FieldSupportBehavior
prefixItemsGenerates tuple[T1, T2, ...] for fixed-position arrays. With items: false produces a fixed-length tuple. With an items schema falls back to list[Union]
containsGenerates AfterValidator that validates at least one item matches the subschema. Supported patterns: const, enum, pattern, numeric range, string length. Complex subschemas not processed
minContainsEnforced via AfterValidator — counts matching items and raises ValueError when below the threshold (default 1)
maxContainsEnforced via AfterValidator — counts matching items and raises ValueError when above the threshold
Object
FieldSupportBehavior
propertyNamesGenerates AfterValidator validating all dict keys. Supported: const, enum, pattern, minLength/maxLength. {"type": "string"} is a no-op
unevaluatedPropertiesComposition-aware additionalProperties. false produces a strict model, true/schema produces a permissive model. Takes precedence over additionalProperties. Sub-schema validation on extras not enforced
unevaluatedItemsfalse with prefixItems produces a fixed-length tuple[T1, T2, ...]. Same effect as items: false at code generation level
patternPropertiesStandalone usage maps to dict[str, T] with regex patterns in Field(json_schema_extra=...). When combined with properties, named fields are generated but regex-keyed extras are not surfaced as parameters
Schema Identity / Reference
FieldSupportBehavior
$idSchemas with $id URIs are resolved to standard #/components/schemas/... references. Supports absolute URIs, relative URIs, and nested $id scope chains
$anchor$ref: "#myAnchor" resolved to standard JSON Pointer references
$defsDefinitions are hoisted into components/schemas with collision-safe renaming. All $defs references rewritten to standard JSON Pointers
$dynamicRef$dynamicRef: "#name" resolved by matching $dynamicAnchor: "name" within the same document. Full dynamic scoping not implemented
$dynamicAnchorSame limitation as $dynamicRef — duplicate names use first-seen rather than dynamic scoping precedence
$vocabularyMeta-schema keyword. Not applicable to code generation
$commentHuman-readable comment. No runtime effect
$schemaPer-schema dialect declaration
Content
FieldSupportBehavior
contentEncodingSee Data Types section
contentMediaTypeSee Data Types section
contentSchemaNot processed
Metadata
FieldSupportBehavior
examples (array)Emitted in generated Field(examples=[...]) alongside the deprecated example keyword

Components Object

FieldSupportBehavior
pathItemsReusable Path Item Objects referenced via $ref from paths are fully resolved. Path-level parameters, sibling overrides, and multiple paths referencing the same pathItem all work correctly

Reference Object

New summary and description sibling properties.
FieldSupportBehavior
summaryOverrides referenced component’s summary in generated output
descriptionOverrides referenced component’s description in generated output
In OAS 3.0, $ref siblings were supposed to be ignored. The generator already supported summary/description siblings, now officially sanctioned by 3.1.

Security Scheme Object

New mutualTLS type.
FieldSupportBehavior
mutualTLS typeTLS transport layer authentication via client certificates. Generated server configures mTLS cert/key paths via environment variables

Found an issue?

Generated server doesn’t match this reference? Let us know — we’ll fix it.