Maintain forward references when generating a recursive schema#883
Maintain forward references when generating a recursive schema#883SrirachaHorse wants to merge 1 commit intotefra:mainfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #883 +/- ##
=======================================
Coverage 99.89% 99.89%
=======================================
Files 105 105
Lines 9311 9311
Branches 2080 2080
=======================================
Hits 9301 9301
Misses 3 3
Partials 7 7 ☔ View full report in Codecov by Sentry. |
b1c34b4 to
84aff2d
Compare
|
|
Thank you very much @SrirachaHorse for bringing this issue to my attention, your fix is a little extreme, I limited the effect to only the choice type annotations here #886 Nevertheless, thank you very much for this, I 've been working on and off to update the pydantic plugin to v2 and I couldn't troubleshoot why some cases were failing, I think that was the culprit but it wasn't very easy to debug in my current samples. If you are working with a suite that demonstrates this issue, I would love to include it in the samples repo https://github.com/tefra/xsdata-samples |

📒 Description
Ensures that compound fields in dataclasses maintain forward references for recursively defined types, even if postponed annotations are enabled.
Resolves #882
🔗 What I've Done
Adds an extra check to
xsdata.formats.dataclass.filters.Filters.field_type_name()to ensure that the given attribute is not a circular reference, before stripping its surrounding"characters. If it is a circular reference, the type will retain its surrounding"characters.💬 Comments
🛫 Checklist