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?

Copy link
Contributor

Choose a reason for hiding this comment

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

@momo1006 and @jsdevel Is this problem now resolved?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@ydaniju test is required for these changes. Seems like this PR was abandoned. I will try to have a look on this, just not sure when I have time.

Feels free to help with this and provide a test, that would make it much easier for me.

Copy link
Contributor

@ydaniju ydaniju Oct 29, 2024

Choose a reason for hiding this comment

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

Thanks @w666 for the quick response. I created a test for this here https://github.com/vpulim/node-soap/pull/1260/files . I don't know how to add the test in this PR.

I will attempt a fix for the next few hours.

}
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
Development

Successfully merging this pull request may close these issues.

5 participants