Fix x-python-type for Optional container types in anyOf schemas#2840
Fix x-python-type for Optional container types in anyOf schemas#2840
Conversation
📝 WalkthroughWalkthroughEnhanced x-python-type interpretation in the JSON schema parser to recognize and extract flags from Union and Optional inner types. Added test coverage for Optional[Set[str]] and Union[None, FrozenSet[str]] handling with the --input-model flag, along with a new field in the test model. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
🔇 Additional comments (3)
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-2840.datamodel-code-generator.pages.dev |
CodSpeed Performance ReportMerging #2840 will degrade performance by 19.03%Comparing
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | WallTime | test_perf_all_options_enabled |
5.8 s | 6.8 s | -15.65% |
| ❌ | WallTime | test_perf_duplicate_names |
863.2 ms | 1,033.1 ms | -16.45% |
| ❌ | WallTime | test_perf_complex_refs |
1.8 s | 2.2 s | -19.03% |
| ❌ | WallTime | test_perf_stripe_style_pydantic_v2 |
1.8 s | 2.1 s | -17.09% |
| ❌ | WallTime | test_perf_multiple_files_input |
3.2 s | 3.8 s | -17.44% |
| ❌ | WallTime | test_perf_aws_style_openapi_pydantic_v2 |
1.7 s | 2 s | -17.34% |
| ❌ | WallTime | test_perf_graphql_style_pydantic_v2 |
717.4 ms | 866.3 ms | -17.19% |
| ❌ | WallTime | test_perf_kubernetes_style_pydantic_v2 |
2.3 s | 2.8 s | -18.59% |
| ❌ | WallTime | test_perf_deep_nested |
5.3 s | 6.4 s | -17.01% |
| ❌ | WallTime | test_perf_large_models_pydantic_v2 |
3.1 s | 3.8 s | -17.98% |
| ❌ | WallTime | test_perf_openapi_large |
2.5 s | 3.1 s | -18.34% |
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. ↩
Breaking Change AnalysisResult: No breaking changes detected Reasoning: This PR is a bug fix that corrects incorrect behavior when processing This analysis was performed by Claude Code Action |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2840 +/- ##
==========================================
- Coverage 99.51% 99.49% -0.02%
==========================================
Files 90 90
Lines 14258 14290 +32
Branches 1695 1705 +10
==========================================
+ Hits 14189 14218 +29
Misses 37 37
- Partials 32 35 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
🎉 Released in 0.51.0 This PR is now available in the latest release. See the release notes for details. |
Summary by CodeRabbit
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.