github koxudaxi/datamodel-code-generator 0.49.0

6 hours ago

Breaking Changes

SchemaParseError for Invalid Schema Data

  • Schema validation errors now raise SchemaParseError instead of Pydantic ValidationError - When parsing invalid schema data (e.g., "minimum": "not_a_number"), the library now raises SchemaParseError instead of passing through Pydantic's ValidationError. Users catching pydantic.ValidationError for schema validation failures should update to catch SchemaParseError. The original error is preserved in the original_error attribute. (#2786)

Bug Fixes

CLI Now Correctly Outputs to stdout

  • Fixed CLI to actually output to stdout when --output is not specified - The --output argument has always documented (default: stdout) in --help, but previously no output was produced. Now works as documented. (#2787)

Other Notable Changes

  • generate() function now returns str | GeneratedModules | None instead of None - Existing code ignoring the return value is unaffected. (#2787)
  • Error message for multi-module output without directory changed to be more descriptive. (#2787)

What's Changed

  • Merge duplicate breaking change headings in release notes by @koxudaxi in #2776
  • Optimize O(n²) algorithms and reduce redundant iterations by @koxudaxi in #2778
  • Optimize performance with LRU caching and O(n) algorithms by @koxudaxi in #2777
  • Optimize Jinja2 environment caching and ruff batch formatting by @koxudaxi in #2779
  • Remove YAML parsing cache and deepcopy overhead by @koxudaxi in #2781
  • Add performance e2e tests with large schema fixtures by @koxudaxi in #2782
  • Convert Import class from Pydantic to dataclass for performance by @koxudaxi in #2783
  • Add schema path context to error messages by @koxudaxi in #2786
  • Return str or dict when output=None in generate() by @koxudaxi in #2787
  • Add --http-timeout CLI option by @koxudaxi in #2788
  • Pass schema extensions to templates by @koxudaxi in #2790
  • Add propertyNames and x-propertyNames support by @koxudaxi in #2789
  • Add support for additional_imports in extra-template-data JSON by @koxudaxi in #2793
  • Update zensical to 0.0.15 by @koxudaxi in #2794
  • Add --use-field-description-example option by @koxudaxi in #2792
  • Add --collapse-root-models-name-strategy option by @koxudaxi in #2791

Full Changelog: 0.48.0...0.49.0

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

NewReleases is sending notifications on new releases.