PackageGenerator icon indicating copy to clipboard operation
PackageGenerator copied to clipboard

Support of xs:list

Open prokki opened this issue 8 years ago • 3 comments

I am not sure, if this is a bug.

I have created a package for the HitchHikerAPI at https://github.com/Fincallorca/HitchHikerApi (you need an account / credentials to use the API).

The WSDL contains an element GDSTypes allowing multiple values.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" [...]

    <xs:element xmlns:q11="HitchHiker.FlightAPI.enums" name="GDSTypes" type="q11:GDSTypeEnum"/>

The related enum type allows multiple values

<xs:simpleType name="GDSTypeEnum">
  <xs:list>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:enumeration value="None">
          <xs:annotation>
            <xs:appinfo>
              <EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">0</EnumerationValue>
            </xs:appinfo>
          </xs:annotation>
        </xs:enumeration>
        <xs:enumeration value="Published">
          <xs:annotation>
            <xs:appinfo>
              <EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">1</EnumerationValue>
            </xs:appinfo>
          </xs:annotation>
        </xs:enumeration>
        <xs:enumeration value="Negotiated">
          <xs:annotation>
            <xs:appinfo>
              <EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">2</EnumerationValue>
            </xs:appinfo>
          </xs:annotation>
        </xs:enumeration>
      </xs:restriction>
    </xs:simpleType>
  </xs:list>
</xs:simpleType>

The <xs:list> element allows multiple values inside GDSTypes. Something like Published Negotiated should be possible, the the auto generated php classes allows only a single value instead of multiple. You can check the code here: https://github.com/Fincallorca/HitchHikerApi/blob/fc2c1202872f4230613332cae4a58564953b361d/src/Wsdl/v3_1_388_1/StructType/GDSFares.php#L28

public function setGDSTypes($gDSTypes = null)
{
    // validation for constraint: enumeration
    if (!\Fincallorca\HitchHikerApi\Wsdl\v3_1_388_1\EnumType\GDSTypeEnum::valueIsValid($gDSTypes)) {
        throw new \InvalidArgumentException(sprintf('Value "%s" is invalid, please use one of: %s', $gDSTypes, implode(', ', \Fincallorca\HitchHikerApi\Wsdl\v3_1_388_1\EnumType\GDSTypeEnum::getValidValues())), __LINE__);
    }
    $this->GDSTypes = $gDSTypes;
    return $this;
}

Does the package support the xs:list?

prokki avatar Nov 07 '18 10:11 prokki

The list tag is currently handled so it might be an issue.

In my point of view, it should be the Fincallorca\HitchHikerApi\Wsdl\v3_1_388_1\StructType\GDSFares::GDSTypes attribute that should be marked as an array, with the attribute maxOccurs="unbounded", in the WSDL so it would then generate the setter properly.

Is there anyway you could send me the WSDL at [email protected]?

mikaelcom avatar Nov 15 '18 09:11 mikaelcom

As pointed out privately and rightly by @prokki:

  • list datatype is a set of literals whose internal structure is a space-separated sequence of literals of the atomic datatype of the items in the list.

To be fixed...

mikaelcom avatar Nov 28 '18 08:11 mikaelcom

Hi @prokki If possible, could you try generating your PHP SDK using the feature/158 branch?

Let me know how it goes then, Thx

mikaelcom avatar Jan 21 '19 13:01 mikaelcom