Breaking Changes
Code Generation Changes
- Pattern key constraints now include
propertyNamesconstraints - When a JSON Schema uses bothpatternPropertiesandpropertyNames, the generated dict key type now merges constraints from both. Previously,propertyNamesconstraints such asminLength,maxLength, and$refcould be ignored whenpatternPropertieswas present. Regenerated code may produce stricter key types and reject data that was previously accepted by less-strict generated models. (#3192) - Typed
additionalPropertiesnow generates a typed__pydantic_extra__field for Pydantic v2 models - When a JSON Schema defines schema-valuedadditionalProperties, generated Pydantic v2 models now include__pydantic_extra__: dict[str, <type>]. Previously, these models only allowed extra fields without typing their values. This changes generated output and makes Pydantic validate extra field values at runtime. (#3205) - Dataclass field ordering with
--use-annotatedmay change - Dataclass field assignment detection now accounts for constraints moved intoAnnotated[...]. Generated dataclass fields may be reordered so fields without defaults come before fields with defaults. (#3203)
Default Behavior Changes
- Auto-detection (
--input-file-type auto) now recognizes AsyncAPI, Avro, and Protocol Buffers inputs - Inputs that previously fell back to JSON/YAML handling or failed detection may now be detected as one of these formats. (#3194, #3195, #3198)
Compatibility Notes
- The temporary Pydantic minimum-version change from
pydantic>=2,<3topydantic>=2.6,<3was reverted before this release. The final dependency range for Python < 3.14 remainspydantic>=2,<3. (#3210, #3215)
What's Changed
- Update CHANGELOG for 0.58.0 by @dcg-generated-docs[bot] in #3187
- Add deprecation registry and docs by @koxudaxi in #3188
- Add XML Schema parser by @koxudaxi in #3183
- Fix null-only type arrays by @koxudaxi in #3189
- Fix contains default minContains by @koxudaxi in #3190
- Sync generated docs by @dcg-generated-docs[bot] in #3193
- Fix fixed prefixItems tuples by @koxudaxi in #3191
- Fix pattern key constraints by @koxudaxi in #3192
- Fix propertyNames ref constraints by @koxudaxi in #3197
- Add Apache Avro schema input type by @koxudaxi in #3195
- Refactor JSON Schema parser helpers by @koxudaxi in #3199
- Document Avro input support by @koxudaxi in #3200
- Use expected files for schema e2e tests by @koxudaxi in #3201
- Add Protocol Buffers input support by @koxudaxi in #3198
- Add AsyncAPI input file type by @koxudaxi in #3194
- Sync generated docs by @dcg-generated-docs[bot] in #3204
- Fix dataclass field ordering by @koxudaxi in #3203
- Add generated header marker option by @koxudaxi in #3208
- Fix path-absolute local refs by @koxudaxi in #3207
- Fix typed additionalProperties extras by @koxudaxi in #3205
- Require Pydantic 2.6 by @koxudaxi in #3210
- Add experimental feature list by @koxudaxi in #3211
- Fix scoped type-overrides changing more fields then intended by @supervirus in #3213
- Copy mapped data types by @koxudaxi in #3214
- Support Pydantic 2.5 by @koxudaxi in #3215
New Contributors
- @supervirus made their first contribution in #3213
Full Changelog: 0.58.0...0.59.0