You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Nataliya Wierts (JIRA)" <ji...@apache.org> on 2013/04/05 14:38:15 UTC

[jira] [Created] (CXF-4948) CXF does not validate unions

Nataliya Wierts created CXF-4948:
------------------------------------

             Summary: CXF does not validate unions
                 Key: CXF-4948
                 URL: https://issues.apache.org/jira/browse/CXF-4948
             Project: CXF
          Issue Type: Bug
         Environment: any, Linux or Windows
            Reporter: Nataliya Wierts


If user has small simpletype entities, that are used as building blocks in xsd:
{code}
 <xs:simpleType name="rentpersqm">
        <xs:restriction base="xs:string">
            <xs:enumeration value="rentpersqm">
                <xs:annotation>
                    <xs:documentation xml:lang="en">rent per sq meter</xs:documentation>
                    <xs:documentation xml:lang="de-DE">Miete pro Quadratmeter</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="rentpermonth">
        <xs:restriction base="xs:string">
            <xs:enumeration value="rentpermonth">
                <xs:annotation>
                    <xs:documentation xml:lang="en">rent per month</xs:documentation>
                    <xs:documentation xml:lang="de-DE">Miete pro Monat</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="rentandbuy">
        <xs:restriction base="xs:string">
            <xs:enumeration value="rentandbuy">
                <xs:annotation>
                    <xs:documentation xml:lang="en">rent and buy</xs:documentation>
                    <xs:documentation xml:lang="de-DE">Kauf oder Miete</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>
   
 {code}   

than in union the validation does not check that blocks contain this string

{code}
   <xs:simpleType name="TradeSitePriceType">
        <xs:restriction>
            <xs:simpleType>
                <xs:union memberTypes="rentpermonth rentandbuy"/>
            </xs:simpleType>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="CommercialPriceType">
        <xs:restriction>
            <xs:simpleType>
                <xs:union memberTypes="rentpersqm rentpermonth"/>
            </xs:simpleType>
        </xs:restriction>
    </xs:simpleType>

  .......
  <xs:complexType name="industry">
  ....
    <xs:element name="pricetype" type="priceTypes:CommercialPriceType" minOccurs="0" maxOccurs="1"/>
  ....
  </xs:complexType>
......

{code}

the validation for CommercialPriceType should not let 'rent', but it does, it is not considered to be an error at all. And all values are transfered into String while transforming of xsd entities to Java Classes.


it would go without problems:

{code}
 <industry>
 <pricetype>
    <item>rentandbuy</item>
    <item>rentpermonth</item>
</pricetype>
</industry>
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira