Fix enum member default resolution#3303
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:
📝 WalkthroughWalkthroughThe PR improves enum member resolution by replacing string-quote heuristics with AST-based literal evaluation and JSON-semantics equality comparison. The parser uses these changes to resolve discriminator values to enum members with string coercion, allowing numeric and string defaults to match correctly. ChangesEnum member resolution and discriminator coercion
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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-3303.datamodel-code-generator.pages.dev |
Merging this PR will improve performance by 28.57%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | WallTime | test_perf_stripe_style_pydantic_v2 |
1.9 s | 1.5 s | +30.4% |
| ⚡ | WallTime | test_perf_aws_style_openapi_pydantic_v2 |
1.8 s | 1.4 s | +29.95% |
| ⚡ | WallTime | test_perf_openapi_large |
2.7 s | 2.1 s | +29.1% |
| ⚡ | WallTime | test_perf_graphql_style_pydantic_v2 |
754.8 ms | 585 ms | +29.01% |
| ⚡ | WallTime | test_perf_duplicate_names |
989.5 ms | 767 ms | +29.01% |
| ⚡ | WallTime | test_perf_kubernetes_style_pydantic_v2 |
2.5 s | 1.9 s | +29% |
| ⚡ | WallTime | test_perf_complex_refs |
1.9 s | 1.4 s | +28.66% |
| ⚡ | WallTime | test_perf_all_options_enabled |
4.9 s | 3.9 s | +28.11% |
| ⚡ | WallTime | test_perf_deep_nested |
4.7 s | 3.7 s | +28.01% |
| ⚡ | WallTime | test_perf_multiple_files_input |
3.4 s | 2.6 s | +27.28% |
| ⚡ | WallTime | test_perf_large_models_pydantic_v2 |
3.4 s | 2.7 s | +25.84% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing fix-enum-member-default-resolution (6b16cad) with main (f204def)
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 #3303 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 116 116
Lines 26248 26364 +116
Branches 3328 3336 +8
==========================================
+ Hits 26248 26364 +116
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:
|
2644c62 to
fc37cbb
Compare
fc37cbb to
c5ce4b5
Compare
Breaking Change AnalysisResult: No breaking changes detected Reasoning: PR #3303 is a bug fix that corrects enum member default resolution. The changes to 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
Bug Fixes
New Features