node-soap-graphql
node-soap-graphql copied to clipboard
Add support for xsd:choice
trafficstars
Would be great to have support for xsd:choice somehow. This one is not trivial, because there are no union types for graphql inputs. Perhaps we can support a subset though, e. g. for non-list types by having just all options as fields.
Example:
<xs:complexType name="uidEntityPublicSearchRequest">
<xs:sequence>
<xs:choice minOccurs="1" maxOccurs="1">
<xs:element xmlns:q5="http://www.ech.ch/xmlns/eCH-0097/5" minOccurs="0" maxOccurs="1" name="uid" type="q5:uidStructureType"/>
<xs:element xmlns:q6="http://www.ech.ch/xmlns/eCH-0097/5" minOccurs="0" maxOccurs="1" name="otherOrganisationId" type="q6:namedOrganisationIdType"/>
<xs:element minOccurs="0" maxOccurs="1" name="uidEntitySearchParameters" type="tns:uidEntityPublicSearchParameters"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
taken from https://www.uid-wse.admin.ch/V5.0/PublicServices.svc?WSDL. Could be mapped to something like
input UidEntityPublicSearchRequestInput {
uid: UidStructureTypeInput
uidEntitySearchParameters: UidEntityPublicSearchParametersInput
}
I think for Output-objects we could map this to GraphQL-Interfaces.
For input I also only see your "best effort" solution. List-Types are problematic. Also fields with the same name but different types would not work.