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

Generating wrong field Type in StructClass #287

Open
Poehli opened this issue Mar 30, 2023 · 1 comment
Open

Generating wrong field Type in StructClass #287

Poehli opened this issue Mar 30, 2023 · 1 comment
Assignees

Comments

@Poehli
Copy link

Poehli commented Mar 30, 2023

Describe the bug
A struct may generate a wrong data type for fields, based on its defined name in the xsd File.

To Reproduce

  1. Download the official EID-WSDL from the German government (BSI Page or Direct download link)
  2. Use the generator to generate the structure types, with following command options:
  • --urlorpath="/Path/To/WSDL/TR-03130eID-Server.wsdl"
  • --destination="/PATH/TO/Soap/Generated"
  • --composer-name=""
  • --standalone=false
  • --namespace-directories=false
  • --src-dirname="/"
  • --namespace="Some\Php\Namespace"
  • --force
  1. Inspect StructType/PersonalDataType and compare with the xsd file

Expected behavior
StructType/PersonalDataType should contain a field $DocumentType from type string|null, but got \Some\Php\Namespace\DocumentType with InlineXML fields and other unexpected fields.

Additonal Context
Changing the name in the TR-03130eID-Server.xsd file from tns:DocumentType to tns:IdentityDocumentType created the expected string|null type

@mikaelcom
Copy link
Member

Hi,
The issue is that the oasis-dss-core-schema-v1.0-os.xsd defined a DocumentType with:

<xs:complexType name="DocumentType">
  <xs:complexContent>
    <xs:extension base="dss:DocumentBaseType">
      <xs:choice>
	<xs:element name="InlineXML" type="dss:InlineXMLType" />
	<xs:element name="Base64XML" type="xs:base64Binary" />
	<xs:element name="EscapedXML" type="xs:string" />
	<xs:element ref="dss:Base64Data" />
	<xs:element ref="dss:AttachmentReference" />
      </xs:choice>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

This declaration overrides the initial definition of the DocumentType from the TR-03130eID-Server.xsd such as:

<simpleType name="DocumentType">
  <restriction base="string">
    <pattern value="[A-Z ]{2}" />
  </restriction>
</simpleType>

As you managed to work around the issue, I think I won't be able to provider a better approach.

Let me know if you have an idea anyway.

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

2 participants