jaxb2-maven-plugin:schemagen XSD generation changes in 1.6

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

jaxb2-maven-plugin:schemagen XSD generation changes in 1.6

David Hoffer
We are upgrading our application that uses schemagen to generate XSD from Java classes to use plugin version 1.6 and JDK8 (was 1.5 & JDK7).

In some cases the new version generates schemas that use ref instead of a direct reference to the type in the element definition.  This causes problems for our usage of the schema.  How can I configure the plugin to always use types?

1.5 generated schema:

<xs:sequence>
      ...
      <xs:element name="sat" type="sat" minOccurs="0"/>
      <xs:element name="satUuid" type="xs:string" minOccurs="0"/>
      ...
</xs:sequence>

<xs:complexType name="sat">
    <xs:sequence>
      ...
    </xs:sequence>
  </xs:complexType>

1.6 generated schema:

<xs:sequence>
      ...
      <xs:element ref="ns1:sat" minOccurs="0"/>
      <xs:element name="satUuid" type="xs:string" minOccurs="0"/>
      ...
</xs:sequence>

<xs:complexType name="sat">
    <xs:sequence>
      ...
    </xs:sequence>
  </xs:complexType>

I need the schema to be like the 1.5 case but when using 1.6.

-Dave
Reply | Threaded
Open this post in threaded view
|

Re: jaxb2-maven-plugin:schemagen XSD generation changes in 1.6

David Hoffer
I think another way of saying this is that I need the plugin to use the Venetian Blind design instead of the Salami Slice design pattern when using 1.6.  How can this be configured?

-Dave

On Fri, Mar 13, 2015 at 10:06 AM, David Hoffer <[hidden email]> wrote:
We are upgrading our application that uses schemagen to generate XSD from Java classes to use plugin version 1.6 and JDK8 (was 1.5 & JDK7).

In some cases the new version generates schemas that use ref instead of a direct reference to the type in the element definition.  This causes problems for our usage of the schema.  How can I configure the plugin to always use types?

1.5 generated schema:

<xs:sequence>
      ...
      <xs:element name="sat" type="sat" minOccurs="0"/>
      <xs:element name="satUuid" type="xs:string" minOccurs="0"/>
      ...
</xs:sequence>

<xs:complexType name="sat">
    <xs:sequence>
      ...
    </xs:sequence>
  </xs:complexType>

1.6 generated schema:

<xs:sequence>
      ...
      <xs:element ref="ns1:sat" minOccurs="0"/>
      <xs:element name="satUuid" type="xs:string" minOccurs="0"/>
      ...
</xs:sequence>

<xs:complexType name="sat">
    <xs:sequence>
      ...
    </xs:sequence>
  </xs:complexType>

I need the schema to be like the 1.5 case but when using 1.6.

-Dave

Reply | Threaded
Open this post in threaded view
|

Re: jaxb2-maven-plugin:schemagen XSD generation changes in 1.6

David Hoffer
Upon further review it appears that the new plugin version does not do this all the time, specifically I do find...

<xs:element name="cSat" type="sat" minOccurs="0"/>

It seems the only time it does this wrong is when the name and type have the same value, e.g. 

<xs:element name="sat" type="sat" minOccurs="0"/>

So perhaps this change was not intended and this is a bug?

-Dave


On Fri, Mar 13, 2015 at 10:49 AM, David Hoffer <[hidden email]> wrote:
I think another way of saying this is that I need the plugin to use the Venetian Blind design instead of the Salami Slice design pattern when using 1.6.  How can this be configured?

-Dave

On Fri, Mar 13, 2015 at 10:06 AM, David Hoffer <[hidden email]> wrote:
We are upgrading our application that uses schemagen to generate XSD from Java classes to use plugin version 1.6 and JDK8 (was 1.5 & JDK7).

In some cases the new version generates schemas that use ref instead of a direct reference to the type in the element definition.  This causes problems for our usage of the schema.  How can I configure the plugin to always use types?

1.5 generated schema:

<xs:sequence>
      ...
      <xs:element name="sat" type="sat" minOccurs="0"/>
      <xs:element name="satUuid" type="xs:string" minOccurs="0"/>
      ...
</xs:sequence>

<xs:complexType name="sat">
    <xs:sequence>
      ...
    </xs:sequence>
  </xs:complexType>

1.6 generated schema:

<xs:sequence>
      ...
      <xs:element ref="ns1:sat" minOccurs="0"/>
      <xs:element name="satUuid" type="xs:string" minOccurs="0"/>
      ...
</xs:sequence>

<xs:complexType name="sat">
    <xs:sequence>
      ...
    </xs:sequence>
  </xs:complexType>

I need the schema to be like the 1.5 case but when using 1.6.

-Dave


Reply | Threaded
Open this post in threaded view
|

Re: jaxb2-maven-plugin:schemagen XSD generation changes in 1.6

David Hoffer
This seems to be a bug in the xjc schema generator, if I upgrade the plugin to use jaxb 2.2.8-b01 (jaxb-xjc & jaxb-jxc) then it works as expected.  However later versions of jaxb don't work with the 1.6 plugin so can't test their behavior.

-Dave

On Fri, Mar 13, 2015 at 11:34 AM, David Hoffer <[hidden email]> wrote:
Upon further review it appears that the new plugin version does not do this all the time, specifically I do find...

<xs:element name="cSat" type="sat" minOccurs="0"/>

It seems the only time it does this wrong is when the name and type have the same value, e.g. 

<xs:element name="sat" type="sat" minOccurs="0"/>

So perhaps this change was not intended and this is a bug?

-Dave


On Fri, Mar 13, 2015 at 10:49 AM, David Hoffer <[hidden email]> wrote:
I think another way of saying this is that I need the plugin to use the Venetian Blind design instead of the Salami Slice design pattern when using 1.6.  How can this be configured?

-Dave

On Fri, Mar 13, 2015 at 10:06 AM, David Hoffer <[hidden email]> wrote:
We are upgrading our application that uses schemagen to generate XSD from Java classes to use plugin version 1.6 and JDK8 (was 1.5 & JDK7).

In some cases the new version generates schemas that use ref instead of a direct reference to the type in the element definition.  This causes problems for our usage of the schema.  How can I configure the plugin to always use types?

1.5 generated schema:

<xs:sequence>
      ...
      <xs:element name="sat" type="sat" minOccurs="0"/>
      <xs:element name="satUuid" type="xs:string" minOccurs="0"/>
      ...
</xs:sequence>

<xs:complexType name="sat">
    <xs:sequence>
      ...
    </xs:sequence>
  </xs:complexType>

1.6 generated schema:

<xs:sequence>
      ...
      <xs:element ref="ns1:sat" minOccurs="0"/>
      <xs:element name="satUuid" type="xs:string" minOccurs="0"/>
      ...
</xs:sequence>

<xs:complexType name="sat">
    <xs:sequence>
      ...
    </xs:sequence>
  </xs:complexType>

I need the schema to be like the 1.5 case but when using 1.6.

-Dave