Hello,
We have a REST API that was originally developed using XSDs with CXF 2.5.2
using XML as the payload. To make the API flexible, objects are created
with a <xs:any> array at the end of each object to allow for backward
compatibility. Here is a schema example:
<xs:complexType name="someType">
<xs:sequence>
<xs:element name="someInt" type="xs:int">
</xs:element>
<xs:any minOccurs="0" maxOccurs="unbounded"
namespace="##other" processContents="lax"/>
</xs:sequence>
</xs:complexType>
We would like to add JSON support to the same API but have a problem in that
the object definitions in XSD use xs:sequence thus forcing the JSON to be
ordered, which is not guaranteed from the client.
I have researched what else can be done from the XSD and unfortunately, the
<xs:all> cannot be used in place of the <xs:sequence> since it doesn't allow
the <xs:any> element.
I would really like schema validation to be turned on to protect the server
but this seems to be incompatible with allowing unordered JSON.
In our case, the order of construction of the POJOs is not important but
rather element types and restrictions are important.
Since it does not appear to be possible to solve this problem from a schema
standpoint, is it a bad idea to have the schema validation ignore sequencing
only?
Currently, I have upgraded to CXF 2.7.5, with Jettison 1.3.3.
Looking for some suggestions of how to resolve this issue or is this a case
of trying to make a round peg fit a square hole?
Any help is greatly appreciated.
Thanks,
Tom
--
View this message in context:
http://cxf.547215.n5.nabble.com/Can-unordered-JSON-work-with-XML-sequence-with-validation-tp5734874.html
Sent from the cxf-user mailing list archive at Nabble.com.