Breaking Changes
-
OpenAPI
byte-formatted string properties for Pydantic v2 are now generated asbytesfields that Pydantic automatically decodes from base64-encoded strings at runtime. Code that relied on these fields being plainstrvalues (the encoded representation) may need to be updated. by @ilovelinux in #2511 (closes #189) -
Enums inferred from OpenAPI / JSON Schema string or integer enums are now generated as specialized
StrEnum/IntEnumsubclasses by default when supported by the target Python version. This changes the base class of existing generated enums and can affect comparisons, JSON encoding, and downstream type checks. You can opt out using the--no-use-specialized-enumCLI flag oruse_specialized_enum = falsein the configuration file. by @ilovelinux in #2512 (closes #1313 and #2534) -
For some Pydantic v2 collection schemas that previously generated a
RootModelwrapper (for example theMyArraycase described in #1830), the generated code now uses aTypeAliasinstead of a dedicated model class. Projects that import or subclass such wrapper models may need to adjust to use the alias instead. by @butvinm in #2505 (closes #1848, #2018, #2427, and #2487)
What's Changed
- Add --use-type-alias flag to generate TypeAlias instead of root models by @butvinm in #2505
- Fix Pydantic v1 runtime support by @ilovelinux in #2538
- Use subclass enum for GraphQL enums when the relative flag is used by @ilovelinux in #2514
- Add support for OpenAPI
bytein Pydantic v2 by @ilovelinux in #2511 - Add support for specialized enums as StrEnum and IntEnum by @ilovelinux in #2512
- [Chore] Clean-up
TYPE_CHECKINGblocks by @ilovelinux in #2539 - Add support for unquoted
nulltype by @ilovelinux in #2542 - Add inline-snapshot test dependency by @koxudaxi in #2546
- Support isort 7 by @jas4711 in #2521
- Add inline-snapshot for test expected value management by @koxudaxi in #2544
- Add --use-inline-field-description option for inline docstring format by @koxudaxi in #2547
Full Changelog: 0.35.0...0.36.0