Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: flatten choice struct members within sequences #152

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

adrienthebo
Copy link

The PubChem PUG View schema1 frequently uses the following pattern:

<!-- ... -->
    <xs:complexType>
      <xs:sequence>
        <xs:choice>
          <xs:element name="A" type="xs:string"/>
          <xs:element name="B" type="xs:int"/>
        </xs:choice>
        <xs:element name="..." type="xs:string" minOccurs="0"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
<!-- ... -->

Prior to this change the xs:choice element was being treated as just another xsd element rather than a choice. This commit correctly tags enum struct fields so that they are properly flattened.

The PubChem PUG View schema[1] frequently uses the following pattern:

```xml
<!-- ... -->
    <xs:complexType>
      <xs:sequence>
        <xs:choice>
          <xs:element name="A" type="xs:string"/>
          <xs:element name="B" type="xs:int"/>
        </xs:choice>
        <xs:element name="..." type="xs:string" minOccurs="0"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
<!-- ... -->
```

Prior to this change the `xs:choice` element was being treated as just
another xsd element rather than a choice. This commit correctly tags enum
struct fields so that they are properly flattened.

[1]: https://pubchem.ncbi.nlm.nih.gov/docs/pug-view#section=Formats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant