Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #858 +/- ##
==========================================
- Coverage 99.89% 99.89% -0.01%
==========================================
Files 104 104
Lines 9296 9295 -1
Branches 2077 2078 +1
==========================================
- Hits 9286 9285 -1
Misses 3 3
Partials 7 7
☔ View full report in Codecov by Sentry. |
b04f946 to
653bec5
Compare
653bec5 to
2772c6c
Compare
|
The change breaks several W3C tests (mostly "XmlContextError: Xml type 'Elements' does not support typing: ..."). |
|
Kudos, SonarCloud Quality Gate passed!
|
|
W3C tests pass now. Not sure what to do with sample test as these are not included in the CI of this package and seem to be broken at the moment (since this commit). |
There was a problem hiding this comment.
This is brilliant!!!
Obviously you had to dig very deep, I was amazed how simple the solution was, I always thought I would have to do a lot of refactoring to support this. The samples repo 🤦 was updated to reflect some changes from another feature pr, sorry about that I checked it manually and everything works as expected!
Thank you very much for this contribution








📒 Description
Compound fields are no longer type-hinted as
list[object].Instead, the type hints of compound fields now reflect the types in the corresponding
<xsd:choice>definition.Resolves #857
🔗 What I've Done
xsdata/codegen/handlers/create_compound_fields.pysuch that it passes a de-duplicated list comprising the types of the combined choices as type hints.tests/codegen/handlers/test_create_compound_fields.pyaccordingly.tests/fixtures/compound/models.pyaccordingly.XmlParser, I had to reorder the logic inXmlVar.is_element/XmlVar.is_elementsdetermination such thatXmlType.ELEMENTSis picked up beforeXmlType.ELEMENT.XmlVarBuilder.is_valid()such thatobjectis allowed to be listed along with other types in aUnionfor XML typeXmlType.ELEMENTS.This is useful to get proper type hinting when working with xsdata-generated code in an IDE.
💬 Comments
Are there additional tests needed explicitly covering this feature?
🛫 Checklist