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

Merged
merged 1 commit into from Jun 19, 2012

Conversation

Projects
None yet
2 participants
@anthonyrisinger
Contributor

anthonyrisinger commented Jun 12, 2012

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.

C Anthony Risinger
[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.
@plq

This comment has been minimized.

Show comment
Hide comment
@plq

plq Jun 19, 2012

Member

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

Member

plq commented Jun 19, 2012

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

@plq

This comment has been minimized.

Show comment
Hide comment
@plq

plq Jun 19, 2012

Member

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

Member

plq commented Jun 19, 2012

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

plq added a commit that referenced this pull request Jun 19, 2012

Merge pull request #142 from xtfxme/defect/142-no-nil-with-maxoccurs-…
…zero

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

@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