You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, strong-soap inherits node-soap's behaviour of returning the following for a given element defined as:
<xs:sequence>
<xs:elementmaxOccurs="(greater than 1)" />
</xs:sequence>
this behaviour returns such an element as an object if it occurs once, or an array of objects if more than once. This complicates the handling of the response, as we now have to determine whether the element being returned is a single object or an array of objects.
Given the definition of such elements, we already expect the number of occurrences to be greater than 1. I hence propose that strong-soap should always return an array of objects for such elements, so that response handlers can be simplified.
@LoneRifle the client can always make necessary checks to see if a returned element is an array. So why force to return an array always ? this could break existing clients.
How would this break existing clients? Those clients would already embed logic to receive and handle either a single object or an array of objects due to the arguably inconsistent nature of what is being returned. I am unsure why a client would break trying to handle a one-item array.
Also, the point is not whether the client can make necessary checks, but whether it should. As noted in opening post, the goal of this issue is to allow response handlers to be simplified. Not doing so already violates the Principle of Least Surprise.
Currently, strong-soap inherits node-soap's behaviour of returning the following for a given element defined as:
this behaviour returns such an element as an object if it occurs once, or an array of objects if more than once. This complicates the handling of the response, as we now have to determine whether the element being returned is a single object or an array of objects.
Given the definition of such elements, we already expect the number of occurrences to be greater than 1. I hence propose that strong-soap should always return an array of objects for such elements, so that response handlers can be simplified.
Desired behaviour can be inferred from vpulim/node-soap#1100
The text was updated successfully, but these errors were encountered: