3

I'm trying to implement a 3rd party service (+1 vote for auto-generating a service from a WSDL!) and I'm trying to declare a type with a mandatory anonymous choice. From the external XSD I have:

<xsd:complexType name="PriceType">
    <xsd:sequence>
        <xsd:element maxOccurs="1" minOccurs="1" name="totalAmount" type="xsd:decimal">
        </xsd:element>
        <xsd:choice maxOccurs="1" minOccurs="1">
            <xsd:element maxOccurs="1" minOccurs="0"
                         name="currencyCode" type="CurrencyCodeType">
            </xsd:element>
            <xsd:element maxOccurs="1" minOccurs="0"
                         name="currencynit" type="CurrencyUnitType">
            </xsd:element>
        </xsd:choice>
    </xsd:sequence>
</xsd:complexType>

What I have is

class PriceType(ComplexModel):
    totalAmount = Decimal(min_occurs=1)
    currencyCode = CurrencyType(xml_choice_group="price_unit_choice")
    unit = CodeNameType(xml_choice_group="price_unit_choice")

but I'm not sure how to specify the mandatory nature of "price_unit_choice" group. I can't find how to set the min_occurs/max_occurs of the choice element in the Spyne docs nor the test files. Does anyone have an example they can share?

Pacanukeha
  • 31
  • 4

0 Answers0