Fix merged result in parse_item not passed back to parse_object_fields#2997
Fix merged result in parse_item not passed back to parse_object_fields#2997
Conversation
📝 WalkthroughWalkthroughReferenced schemas ($ref) combined with additional schema keywords are now merged before parsing; the merged schema is used for object properties, additionalProperties, and OpenAPI parameter parsing so field types and metadata reflect the merged result. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 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-2997.datamodel-code-generator.pages.dev |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2997 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 94 94
Lines 18081 18095 +14
Branches 2090 2093 +3
=========================================
+ Hits 18081 18095 +14
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:
|
20c2d06 to
a665752
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/datamodel_code_generator/parser/openapi.py (1)
511-516:⚠️ Potential issue | 🟡 MinorRemove unused
noqaon Line 511.
Ruff reports this as unused; keep the signature clean.🧹 Suggested fix
-def parse_all_parameters( # noqa: PLR0912, PLR0914, PLR0915 +def parse_all_parameters(
Breaking Change AnalysisResult: Breaking changes detected Reasoning: This PR fixes a bug where metadata from $ref-referenced schemas was not being merged when inline keywords were present. The fix changes generated code output - fields that previously had no Field() annotations now include Field(...) with description, title, constraints, etc. from the referenced schema. While this is a bug fix making output more accurate, it changes the generated code that users may depend on, affecting comparison tests, regenerated code, and potentially custom templates. Content for Release NotesCode Generation Changes
This analysis was performed by Claude Code Action |
|
🎉 Released in 0.54.0 This PR is now available in the latest release. See the release notes for details. |
Fixes: #2995
Summary by CodeRabbit
Bug Fixes
Tests