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

Add support for xsd:union #601

Closed
Tracked by #160
karina-klinkeviciute opened this issue Apr 24, 2024 · 4 comments
Closed
Tracked by #160

Add support for xsd:union #601

karina-klinkeviciute opened this issue Apr 24, 2024 · 4 comments

Comments

@karina-klinkeviciute
Copy link
Contributor

karina-klinkeviciute commented Apr 24, 2024

XSD files can have memberTypes which are unions of two or more types. In this case, we need to find which of those types is most generic and use it for matching the DSA type.

Examples

Depends on

Related

@karina-klinkeviciute karina-klinkeviciute changed the title memberTypes which have 2 or more other types are not covered yet. in XSD files, memberTypes which have 2 or more other types are not covered yet. Apr 24, 2024
@karina-klinkeviciute karina-klinkeviciute changed the title in XSD files, memberTypes which have 2 or more other types are not covered yet. in XSD to DSA conversion, memberTypes which have 2 or more other types are not covered yet. Apr 24, 2024
@sirex
Copy link
Collaborator

sirex commented Sep 6, 2024

Adding few examples here, since web links have a tendency of becoming broken links.

<xs:simpleType>
  <xs:union memberTypes="label_point empty-string"/>
</xs:simpleType>
<xs:simpleType name="label_point">
  <xs:restriction base="xs:decimal">
    <xs:totalDigits value="10"/>
    <xs:fractionDigits value="2"/>
  </xs:restriction>
</xs:simpleType>
<xs:simpleType name="empty-string">
  <xs:restriction base="xs:string">
    <xs:enumeration value=""/>
  </xs:restriction>
</xs:simpleType>

I thing union element can also include simpleType definitions or reference types with memberTypes attribute.

DSA does not support polymorphic types, so I thing, we have a two options:

  1. Check all member types in the union and pick most generic type, which in most cases will be string. But also, add original type to source.type (see #dsa:11).
  2. List all possible types as separate properties, adding type name as property name suffix. Also add source.type.

Also, we could add a resolution for a specific case. For example as in the example above, we could detect, that this is a number tipe, which is not required. Since XML does not have NULL type, so empty string for decimal could be interpreted as NULL?

@sirex sirex changed the title in XSD to DSA conversion, memberTypes which have 2 or more other types are not covered yet. Add support for xsd:include Sep 6, 2024
@sirex sirex changed the title Add support for xsd:include Add support for xsd:union Sep 6, 2024
@karina-klinkeviciute
Copy link
Contributor Author

implemented in the new version of XSD

@Struchid
Copy link

implemented in the new version of XSD

@karina-klinkeviciute so can this be closed then?

@karina-klinkeviciute
Copy link
Contributor Author

implemented in the new version of XSD

@karina-klinkeviciute so can this be closed then?

taip, uždarysiu šį issue

@karina-klinkeviciute karina-klinkeviciute closed this as not planned Won't fix, can't repro, duplicate, stale Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants