Skip to content

Typing Customization

Control Python annotation syntax, collection types, imports, and type mappings.

Options are grouped from shared CLI metadata and link back to their generated reference sections.

Groups

Group Options Description
Imports 1 Generated imports and type-checking import behavior.
Collection Types 5 Collection and tuple/set generation.
Type Alias 2 TypeAlias and root-model alias output.
Type Mapping 9 Scalar, date/time, and custom type mapping.
Type Syntax 3 Modern annotation syntax and Annotated usage.

Imports

Generated imports and type-checking import behavior.

Option Description
--disable-future-imports Prevent automatic addition of future imports in generated code.

Collection Types

Collection and tuple/set generation.

Option Description
--no-use-standard-collections Use typing.Dict/List instead of built-in dict/list for container types.
--use-generic-container-types Use generic container types (Sequence, Mapping) for type hinting.
--use-standard-collections Use built-in dict/list instead of typing.Dict/List.
--use-tuple-for-fixed-items Generate tuple types for arrays with items array syntax.
--use-unique-items-as-set Generate set types for arrays with uniqueItems constraint.

Type Alias

TypeAlias and root-model alias output.

Option Description
--use-root-model-type-alias Generate RootModel as type alias format for better mypy support.
--use-type-alias Use TypeAlias instead of root models for type definitions (experimental).

Type Mapping

Scalar, date/time, and custom type mapping.

Option Description
--output-date-class Specify date class type for date schema fields.
--output-datetime-class Specify datetime class type for date-time schema fields.
--strict-types Enable strict type validation for specified Python types.
--type-mappings Override default type mappings for schema formats.
--type-overrides Replace schema model types with custom Python types via JSON mapping.
--use-decimal-for-multiple-of Generate Decimal types for fields with multipleOf constraint.
--use-object-type Use object instead of Any for unspecified object and array values.
--use-pendulum Use pendulum types for date, time, and duration fields.
--use-standard-primitive-types Use Python standard library types for string formats instead of str.

Type Syntax

Modern annotation syntax and Annotated usage.

Option Description
--no-use-union-operator Use Union[X, Y] / Optional[X] instead of X | Y union operator.
--use-annotated Use typing.Annotated for Field() with constraints.
--use-union-operator Use | operator for Union types (PEP 604).