xsdata icon indicating copy to clipboard operation
xsdata copied to clipboard

Nested wildcard tails

Open qthequartermasterman opened this issue 6 months ago • 3 comments

📒 Description

Write a brief description of your PR.

Resolves #1149.

Tails of nested wildcard objects are appended to the inner wildcard object, and not the outer wildcard list, as expected.

I also discovered while working on this PR that tails of non-wildcard objects within a wildcard list were just being discarded, instead of being appened to the outer wildcard list, as expected.

🔗 What I've Done

Write a description of the steps taken to resolve the issue

The first change is that if a tail is not processed it is passed to its parent. This is the same behavior that occured before if the element was marked as mixed. Now all elements whose tails have not been processed do this.

The second change is that if a child tail is passed to the parent and the parent is a wildcard, this propagated tail is bound using bind_wild_text. This resolves the case where the nested element isn't a wildcard, and its tails were being discarded.

The final change, probably the most controversial one, is I stripped the functionality of appending the tail of a wildcard list to its elements. As I read the xml parser spec in python stdlib/lxml and as I read the W3C XML Schema Definition Language spec, it feels clear to me that what the parsers are calling tails actually belong the parent element, and not the inner object. There were a few tests asserting the previous behavior, which I changed, but I couldn't find anything testing that behavior on real XML; only the very atomic/isolated unit tests. If my understanding of the intended behavior is wrong, I'm happy to redesign this.

💬 Comments

A place to write any comments to the reviewer.

🛫 Checklist

qthequartermasterman avatar Jun 12 '25 02:06 qthequartermasterman

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.94%. Comparing base (eaaa9c6) to head (b735953). Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1151      +/-   ##
==========================================
- Coverage   99.94%   99.94%   -0.01%     
==========================================
  Files         116      116              
  Lines        9370     9368       -2     
  Branches     1430     1429       -1     
==========================================
- Hits         9365     9363       -2     
  Misses          5        5              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jun 12 '25 02:06 codecov[bot]

@tefra Is this an acceptable fix to #1149 ?

The failing W3C tests are also failing on main, so I don't believe they're related to this change.

Are the sample tests mentioned in the PR template run as part of CI? I don't see them in any of the builds, but perhaps I'm missing them.

qthequartermasterman avatar Jun 12 '25 03:06 qthequartermasterman

@tefra Any thoughts?

qthequartermasterman avatar Jun 28 '25 02:06 qthequartermasterman

@tefra Any thoughts?

It looks right @qthequartermasterman let me do some manual tests.

tefra avatar Jul 06 '25 07:07 tefra