Skip to content

xsd:choice Metadata Missing? #1165

@gingerrunner-55

Description

@gingerrunner-55

Opening up an xsd and processing as follows, using version 25.7 of xsdata:

config = GeneratorConfig()
transformer = ResourceTransformer(config)
transformer.process_schemas([xsd_schema_path.resolve().as_uri()])
for xsd_class in transformer.classes:
    *bunch of code*

For context, the plan is to convert the pieces of xsd_class into an existing intermediate representation for codegen in other languages. I currently have an implementation that does this with xmlschema, but the code is extremely hacky around the handling of xsd:choices, and my bandaids have limitations.

One of the classes in question is represented in the xsd, simplified, as follows:

<xsd:complexType name="ClassA">
    <xsd:sequence>
        <xsd:element name="one" type="typeOne"/>
        <xsd:choice>
             <xsd:element name="two" type="typeTwo"/>
             <xsd:element name="three" type="typeThree"/>
        </xsd:choice>
    </xsd:sequence>
</xsd:complexType>

Looking around in an IDE, the Class def of ClassA nor the attributes of two and three, I don't see any indications of a choice grouping or that two/three are a part of a choice.

I've tried compound_fields, no dice, perused the other issues and I don't see anything that matches my issue that hasn't been resolved already. But I don't see what I'm missing for getting this information out, which is vital for our intermediate representation,

On a side note, this library is awesome, and if this can be worked out it'll be leagues better than my existing code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions