Skip to content

Members with nillable=false and maxOccurs=0 still set nillable #142

Merged
merged 1 commit into from Jun 19, 2012

2 participants

@anthonyrisinger

Currently, when an element is optional, but NOT nillable, it's still set
nillable during serialization. However, when nillable=true, the member is
properly skipped. This behavior causes schema validation errors on the client.

Example schema:

    <xs:complexType name="object">
        <xs:sequence>
            [...]
            <xs:element name="id" type="xs:string" minOccurs="0" />
            <xs:element name="account" type="tns:account" minOccurs="0" />
            <xs:element name="last_updated" type="xs:dateTime" minOccurs="0" />
            [...]
        </xs:sequence>
    </xs:complexType>

Rpclib output:

    <tns:object>
        [...]
        <tns:id>4fd7ad136b6b473006000005</tns:id>
        <tns:account xsi:nil="true"/>
        <tns:last_updated xsi:nil="true"/>
        [...]
    </tns:object>

... correct by not caring if nillable when deciding to skip or not.

@anthonyrisinger anthonyrisinger [issue #142] Members with nillable=false and maxOccurs=0 still set ni…
…llable

Currently, when an element is optional, but NOT nillable, it's still set
nillable during serialization. However, when nillable=true, the member is
properly skipped. This behavior causes schema validation errors on the client.

Example schema:
    <xs:complexType name="object">
        <xs:sequence>
            [...]
            <xs:element name="id" type="xs:string" minOccurs="0" />
            <xs:element name="account" type="tns:account" minOccurs="0" />
            <xs:element name="last_updated" type="xs:dateTime" minOccurs="0" />
            [...]
        </xs:sequence>
    </xs:complexType>

Rpclib output:
    <tns:object>
        [...]
        <tns:id>4fd7ad136b6b473006000005</tns:id>
        <tns:account xsi:nil="true"/>
        <tns:last_updated xsi:nil="true"/>
        [...]
    </tns:object>

... correct by not caring if nillable when deciding to skip or not.
3340b7b
@plq
arskom member
plq commented Jun 19, 2012

this is a subtle change. would you mind adding tests as well?

@plq
arskom member
plq commented Jun 19, 2012

nah, that would be too much of a hassle. your patch makes perfect sense anyway.

@plq plq merged commit 31fb18d into arskom:master Jun 19, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.