Fix pydantic constraint rendering#3289
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughCentralizes safe Python literal rendering ( ChangesPython value representation and constraint handling
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
📚 Docs Preview: https://pr-3289.datamodel-code-generator.pages.dev |
Merging this PR will degrade performance by 11.78%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | WallTime | test_perf_all_options_enabled |
5.1 s | 5.8 s | -12.37% |
| ❌ | WallTime | test_perf_openapi_large |
2.6 s | 3 s | -12.11% |
| ❌ | WallTime | test_perf_complex_refs |
1.9 s | 2.1 s | -11.85% |
| ❌ | WallTime | test_perf_kubernetes_style_pydantic_v2 |
2.4 s | 2.7 s | -11.44% |
| ❌ | WallTime | test_perf_aws_style_openapi_pydantic_v2 |
1.7 s | 1.9 s | -11.14% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing fix-pydantic-constraint-rendering (c336673) with main (9fa06c7)
Footnotes
-
98 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3289 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 115 116 +1
Lines 26017 26173 +156
Branches 3284 3310 +26
==========================================
+ Hits 26017 26173 +156
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Breaking Change AnalysisResult: Breaking changes detected Reasoning: This PR changes generated code output in multiple ways: (1) non-finite floats use float() calls instead of math imports, (2) decimal constraints use Decimal() objects, (3) integer fractional constraints are normalized, (4) msgspec now renders array length constraints that were previously ignored, and (5) msgspec required nullable fields no longer get default None. The msgspec.jinja2 template also changed its default rendering condition. These are breaking changes because users regenerating models will see different output, and the msgspec nullable field change alters the runtime constructor signature of generated Struct classes. Content for Release NotesCode Generation Changes
Custom Template Update Required
This analysis was performed by Claude Code Action |
|
🎉 Released in 0.62.0 This PR is now available in the latest release. See the release notes for details. |
Summary by CodeRabbit
New Features
Bug Fixes
Tests