highsource/jsonix-schema-compiler

JSON-Schema generated from XSD does not use maxLength

Madoc opened this issue · 1 comments

Madoc commented

After using the Maven plugin for generating a JSON-Schema from an XSD (which is included in a WSDL), I notice that the maximum length restrictions are not reflected in the JSON-Schema.

Here is a simplified and cut version of my XSD:

<schema targetNamespace="http://www.somecompany.com/wsdl/Test.wsdl"
        xmlns="http://www.w3.org/2001/XMLSchema"
        xmlns:tns="http://www.somecompany.com/wsdl/Test.wsdl">
  <element name="SomeElement">
    <complexType>
      <sequence>
        <element name="someElementId" type="long" minOccurs="1" maxOccurs="1"/>
        <element name="limitedString" type="tns:LimitedString" minOccurs="1" maxOccurs="1"/>
      </sequence>
    </complexType>
  </element>
  <simpleType name="LimitedString">
    <restriction base="string">
      <maxLength value="50"/>
    </restriction>
  </simpleType>
</schema>

The maxLength is not represented in the generated JSON-Schema. This is unfortunate, as I want to pass on the JSON-Schema to other parties as a technical documentation, and tell them that if their JSON validates with the schema, it's good for me to accept.

Is there any good way how I can have the JSON-Schema generated with maxLength?

Any news on that issue? I would be really helpful for me too :)