github koxudaxi/datamodel-code-generator 0.36.0

4 hours ago

Breaking Changes

  • OpenAPI byte-formatted string properties for Pydantic v2 are now generated as bytes fields that Pydantic automatically decodes from base64-encoded strings at runtime. Code that relied on these fields being plain str values (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 / IntEnum subclasses 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-enum CLI flag or use_specialized_enum = false in the configuration file. by @ilovelinux in #2512 (closes #1313 and #2534)

  • For some Pydantic v2 collection schemas that previously generated a RootModel wrapper (for example the MyArray case described in #1830), the generated code now uses a TypeAlias instead 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

Full Changelog: 0.35.0...0.36.0

Don't miss a new datamodel-code-generator release

NewReleases is sending notifications on new releases.