New Features
- Added
--serialization-aliasesfor Pydantic v2 serialization alias mapping. (#3146) - Added
--openapi-include-info-versionto emitOPENAPI_INFO_VERSIONfrom OpenAPIinfo.version. (#3176) - Added
--use-object-typeto generateobjectinstead ofAnyfor unspecified JSON Schema object and array values. (#3177)
Breaking Changes
Code Generation Changes
- Duplicate validation aliases are now deduplicated in generated Pydantic v2
AliasChoices- Fields that previously generated duplicate entries such asAliasChoices('endDate', 'end_date', 'endDate')now generate each alias once. Runtime behavior is equivalent, but exact generated output changes. (#3146) - JSON Schema edge-case fixes change generated output for affected schemas - Schema-valued
additionalProperties/unevaluatedProperties,const: null, complex enum values, all-falsepatternProperties, non-stringpropertyNames, boolean array item schemas,contains,minProperties/maxProperties, and enum references throughallOfnow generate more accurate annotations or constraints. Users with snapshots or exact-output checks may see diffs. (#3167) - Duplicate TypedDict import fix changes generated output - Mixed closed/open TypedDict generation no longer imports
TypedDictfrom bothtypingandtyping_extensions;TypedDictis kept only where required. (#3155) - Schema-derived payload fixes change generated output for affected schemas - Forward-referenced dict key unions, indirect
$reftypes inallOf,additionalPropertieswith$ref, heterogeneous root constraints, and unresolved discriminator fields now generate more valid types/fields. (#3168) - Primitive
allOfschemas now generate root-style payload types - Primitive-onlyallOfand top-levelallOfcombined withoneOf/anyOfnow generateRootModel/root payload types instead of empty or object-like models. Code instantiating the previous generated classes may need updates. (#3169, #3171) - Discriminator literal generation changed for some enum mappings - Discriminator mappings now use the resolved literal values for enum-backed mappings, including non-string values where applicable. (#3074, #3170)
multipleOfintersections inallOfnow use the least common multiple - For example,multipleOf: 5combined withmultipleOf: 10now generatesmultiple_of=10instead of incorrectly keeping the first value. Decimal multiples are handled similarly. (#3172)- Schema metadata fields are now preserved automatically -
contentEncoding,contentMediaType,contentSchema,externalDocs, andxmlare included in generatedjson_schema_extrawhen present in the input schema, even without--model-extra-keys. (#3175)
Error Handling Changes
--output-datetime-classnow rejects incompatible TypedDict and Dataclass output combinations - Pydantic-specific datetime classes withtyping.TypedDict, and incompatible dataclass API usage, now raise errors instead of silently producing fallback output. (#3155, #3169)- Boolean
falseinsideallOfnow raisesSchemaParseError- UnsatisfiableallOfbranches are reported instead of generating incorrect models.falsebranches inoneOf/anyOfare filtered where appropriate. (#3168)
What's Changed
- Create changelog updates through PRs by @koxudaxi in #3138
- Add manual changelog update trigger by @koxudaxi in #3139
- Update CHANGELOG for 0.57.0 by @dcg-generated-docs[bot] in #3140
- Normalize changelog release body spacing by @koxudaxi in #3141
- Fix duplicate changelog prepend by @koxudaxi in #3143
- Update CHANGELOG for 0.57.0 by @dcg-generated-docs[bot] in #3144
- Add serialization aliases by @koxudaxi in #3146
- Sync generated docs by @dcg-generated-docs[bot] in #3148
- Add generation dependency index by @koxudaxi in #3154
- Document boundary payload typing by @koxudaxi in #3162
- Sync generated docs by @dcg-generated-docs[bot] in #3163
- Sync generated docs by @dcg-generated-docs[bot] in #3164
- Improve code generation performance by @koxudaxi in #3166
- Map OpenAPI Discriminator mapping's values to their real value in enums by @ilovelinux in #3074
- Fix JSON Schema edge-case generation by @koxudaxi in #3167
- fix(TypedDict): Issue with DateTime options not being used in the output, and duplicate TypedDict imports by @richinfante in #3155
- Add schema-derived payload validation tests by @koxudaxi in #3168
- Fix msgspec enum discriminator tag by @koxudaxi in #3170
- Fix top-level allOf oneOf schema by @koxudaxi in #3171
- Fix primitive allOf payload types by @koxudaxi in #3169
- Fix allOf multipleOf intersection by @koxudaxi in #3172
- Align schema feature support status by @koxudaxi in #3174
- Support additional JSON Schema string formats by @koxudaxi in #3173
- Add OpenAPI info version constant by @koxudaxi in #3176
- Preserve schema metadata extras by @koxudaxi in #3175
- Sync generated docs by @dcg-generated-docs[bot] in #3180
- Add object type option by @koxudaxi in #3177
- Sync generated docs by @dcg-generated-docs[bot] in #3181
New Contributors
- @richinfante made their first contribution in #3155
Full Changelog: 0.57.0...0.58.0