Nullable required fields should not have default value#2520
Nullable required fields should not have default value#2520gaborbernat merged 21 commits intokoxudaxi:mainfrom
Conversation
|
This PR closes the following issues: Please link this PR with the issue as described here. Thanks! |
…del.jinja2 Co-authored-by: Antonio Spadaro <[email protected]>
CodSpeed Performance ReportMerging #2520 will not alter performanceComparing Summary
Footnotes
|
|
@raymondbutcher |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2520 +/- ##
=======================================
Coverage 99.33% 99.33%
=======================================
Files 81 81
Lines 11478 11480 +2
Branches 1367 1367
=======================================
+ Hits 11402 11404 +2
Misses 45 45
Partials 31 31
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:
|
WalkthroughTightened the Pydantic v2 BaseModel template default-emission condition; removed several emitted Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
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 (1)
🔇 Additional comments (1)
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 |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@ilovelinux Can you review the PR again? |
✅ Actions performedReview triggered.
|
|
Thank You ! |
Hi. Thanks for the project!
My OpenAPI spec has some fields as both nullable and required, but they are generating models with default values like this:
Those default values make the fields optional, so it's not working as expected.
This fix also highlighted what looks to be a bug in an existing test that is checking for an incorrect result:
Summary by CodeRabbit
Bug Fixes
New Features
Documentation
Tests
✏️ Tip: You can customize this high-level summary in your review settings.