Breaking Changes
SchemaParseError for Invalid Schema Data
- Schema validation errors now raise
SchemaParseErrorinstead of PydanticValidationError- When parsing invalid schema data (e.g.,"minimum": "not_a_number"), the library now raisesSchemaParseErrorinstead of passing through Pydantic'sValidationError. Users catchingpydantic.ValidationErrorfor schema validation failures should update to catchSchemaParseError. The original error is preserved in theoriginal_errorattribute. (#2786)
Bug Fixes
CLI Now Correctly Outputs to stdout
- Fixed CLI to actually output to stdout when
--outputis not specified - The--outputargument has always documented(default: stdout)in--help, but previously no output was produced. Now works as documented. (#2787)
Other Notable Changes
generate()function now returnsstr | GeneratedModules | Noneinstead ofNone- 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