node-soap-graphql icon indicating copy to clipboard operation
node-soap-graphql copied to clipboard

Add support for xsd:choice

Open henkesn opened this issue 2 years ago • 1 comments
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
}

henkesn avatar Jan 13 '23 18:01 henkesn

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.

pso-aeb avatar Mar 14 '23 16:03 pso-aeb