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:ref attributes convert list #1168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

momo1006
Copy link

Consider this XSD:

<xs:elements ref="tns:DummyList" minOccurs="1" maxOccurs="10" />
<xs:element name="DummyList">
  <xs:complexType> 
    <xs:sequence>
      <xs:element ref="DummyValues" minOccurs="1" maxOccurs="10" />
    </xs:sequence>
  </xs:complexType>
</xs:element>

I expected DummyList and DummyValues to be returned in List

sample response SOAP:

<Parent>
  <DummyList>
    <DummyValues>Hello</DummyValues>
  </DummyList>
</Parent>

The current value being returned.

{
  DummyList: {
    DummyValues: "Hello"
  }
}

When ref is used to set maxoccurs, if the returned value is a single value, it will not be converted to an array.

Response I'm expecting.

{
  DummyList[{
    DummyValues: ["Hello"]
  ]}
}

Similar to issues#1100

}
if (Boolean(this.$minOccurs)) {
typeElement['minOccurs'] = this.$minOccurs
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a test for these changes

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsdevel

please add a test for these changes

Are you referring to minOccurs to add the test?
Sorry, about the minOccurs, it may not be necessary, just to match the maxOccurs.
It's only the maxOccurs part I want to fix.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. sorry for the late reply. please add a test to verify that this works as expected now and in the future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@momo1006 have you solved this issue without this PR?

}
if (Boolean(this.$minOccurs)) {
typeElement['minOccurs'] = this.$minOccurs
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. sorry for the late reply. please add a test to verify that this works as expected now and in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants