tefra / xsdata

Naive XML & JSON Bindings for python
https://xsdata.readthedocs.io
MIT License
324 stars 59 forks source link

fix: Avoid recursive error on nested group references #1016

Closed tefra closed 5 months ago

tefra commented 5 months ago

📒 Description

The generator supports inner class references, only from outer -> inner, not for inner classes on the same level, or any kind of uneven references, like this.

from dataclasses import dataclass

@dataclass
class A:
    a: "B"

    @dataclass
    class B:
        b: "A.C"

        @dataclass
        class D:
            d: str

    @dataclass
    class C:
        c: "A.B.D"

This is a limiting factor for groups with self references, that causes recursion limit errors. Let's see if we can address that!

Resolves #1008

🔗 What I've Done

Write a description of the steps taken to resolve the issue

💬 Comments

A place to write any comments to the reviewer.

🛫 Checklist

codecov[bot] commented 5 months ago

Codecov Report

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

Project coverage is 100.00%. Comparing base (762ecb8) to head (00fe560).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1016 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 117 117 Lines 9203 9256 +53 Branches 2176 2189 +13 ========================================= + Hits 9203 9256 +53 ```

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

tefra commented 5 months ago

Honestly, one of these days, I am going to remove the support for nested classes.... it's such a pain sometimes.

sonarcloud[bot] commented 5 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud