github koxudaxi/datamodel-code-generator 0.60.0

4 hours ago

Breaking Changes

  • Avro record field defaults are no longer emitted as generated Python defaults. Avro defaults describe reader behavior, not Python model construction defaults, so generated Avro model fields now stay required even when the Avro schema has default. This also applies to Avro schemas embedded in AsyncAPI multi-format schemas. (#3256)
  • XML Schema datatype mappings were corrected. xs:decimal now generates Decimal instead of float; xs:dateTime defaults to standard-library datetime because XML Schema allows values without a timezone; xs:dateTimeStamp remains AwareDatetime; xs:duration and xs:yearMonthDuration now generate str, while xs:dayTimeDuration still generates timedelta. (#3248)
  • GraphQL input fields with schema defaults are now generated as optional fields with defaults. For example, non-null list inputs declared with = [] can now be omitted when constructing the generated model. (#3255)
  • Protobuf bytes defaults are now generated as bytes literals instead of strings, including escaped byte sequences. (#3252)
  • XML Schema default and fixed values are parsed according to their XSD lexical types. This affects list defaults, union defaults, non-finite float values, temporal defaults, boolean defaults with XML Schema whitespace, and fixed decimal values. (#3258, #3260, #3261, #3263, #3267, #3268)

Notes

  • --output-datetime-class is respected for XML Schema xs:dateTime and xs:dateTimeStamp when explicitly provided. Without the option, the XML Schema defaults above are used. (#3266)
  • Enum member defaults remain opt-in through --set-default-enum-member. The default behavior is not changed to force enum member references. (#3264)
  • JSON Schema and OpenAPI const values are not treated as generated Python defaults unless the schema also defines a default. XML Schema fixed keeps its XSD value-constraint behavior. (#3268)

What's Changed

Full Changelog: 0.59.1...0.60.0

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

NewReleases is sending notifications on new releases.