Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

xsd sequence is returned as hash instead of Array when only 1 entry exists #3

Open
tjarratt opened this issue Apr 22, 2014 · 1 comment

Comments

@tjarratt
Copy link
Contributor

Migrated from savonrb/savon#550


"When I have a returned element whose Complex Type is specified as sequence"
 <s:complexType name="OriginDestinationOptionType">
        <s:sequence>
         <s:element minOccurs="0" maxOccurs="unbounded" name="FlightSegment" type="tns:BookFlightSegmentType" />
        </s:sequence>
      </s:complexType>

If there is only one entry in the complex type "OriginDestinationOptionType" of Type "FlightSegment", then the result returned looks like:

{ "origin_destination_option_type": {
    "flight_segment": 
       {"departure_airport": {  "@location_code": "DEL" }
         # ...
        }
   }                 
}

instead of

{ "origin_destination_option_type": {
    "flight_segment": [ 
         { "departure_airport": {  "@location_code": "DEL" }
            # ...
          }
      ]
   }                 
}

Which is how I think it should look. I beleive this is because we're still using Nori, which uses Nokogiri for the response, and more importantly, we're not applying the WSDL or Schema's to interpret the response, only the requests.

If that's the case, then this issue can be closed, and I'll open a new "Feature" request which is no small project, to enable response parsing based on WSDL schema.

@tsujigiri
Copy link

I would really love to see this work correctly isntead of heaving to Array.wrap everything I know to be a sequence and having my code fail whenever I miss one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants