Strip Field None defaults with metadata#3476
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:
📝 WalkthroughWalkthrough
Changesstrip_default_none Field rendering fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 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-3476.datamodel-code-generator.pages.dev |
Merging this PR will improve performance by 11.53%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | WallTime | test_perf_stripe_style_pydantic_v2 |
1.8 s | 1.6 s | +11.53% |
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/strip-default-none-field (347f6f1) with main (48335d0)
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. ↩
c944dc0 to
7c514cf
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3476 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 151 151
Lines 32484 32494 +10
Branches 3780 3783 +3
=========================================
+ Hits 32484 32494 +10
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:
|
7c514cf to
9541ed5
Compare
9541ed5 to
347f6f1
Compare
|
🎉 Released in 0.65.1 This PR is now available in the latest release. See the release notes for details. |
Fixes: #1816
Summary by CodeRabbit
Bug Fixes
--strip-default-nonebehavior for Pydantic v1/v2 generation by omittingField(None, ...)defaults only when the default is an actualNoneand the field type is not optional, resulting in more accurate required/default semantics in generated OpenAPI/Pydantic code.Tests
Field(...)declarations.