Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

soap client describe() resolves namespace cross references between schema #1014

Merged
merged 7 commits into from
Jul 23, 2018

Conversation

PaoloSarti
Copy link
Contributor

Hi,

this PR adds support to cross references in namespaces between types from different schema.

@coveralls
Copy link

coveralls commented Jul 19, 2018

Coverage Status

Coverage increased (+0.07%) to 93.34% when pulling 10eaae4 on MakeItApp:feature/describe-follows-namespaces into 7da88e1 on vpulim:master.

lib/wsdl.js Outdated
@@ -116,6 +117,12 @@ var Element = function(nsName, attrs, options) {
}
}
}
for (var schemaKey in schemaAttrs) {
var schemaMatch = /^xmlns:?(.*)$/.exec(schemaKey);
if (schemaMatch && schemaMatch[1] && schemaMatch) {
Copy link
Contributor

Choose a reason for hiding this comment

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

did you really want to check for schemaMatch twice here? 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed :)

@@ -855,7 +862,9 @@ ElementElement.prototype.description = function(definitions, xmlns) {
if (type) {
type = splitQName(type);
var typeName = type.name,
ns = xmlns && xmlns[type.prefix] || definitions.xmlns[type.prefix],
ns = xmlns && xmlns[type.prefix] ||
(definitions.xmlns[type.prefix] !== undefined && this.schemaXmlns[type.prefix]) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

when checking for !== undefined explicitly, we are aware that null would pass - is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here I checked the presence or absence of the property, not its value. So yes, it was intentional to check only for undefined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Anyway, I could change definitions.xmlns[type.prefix] !== undefined into definitions.xmlns[type.prefix]

Copy link
Contributor

Choose a reason for hiding this comment

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

I checked the presence or absence of the property

good catch, I didn' t think of that... 👍

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants