[
https://issues.apache.org/jira/browse/CXF-4292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13270310#comment-13270310
]
Zebensui Méndez commented on CXF-4292:
--------------------------------------
I try with 2.6.1-SNAPSHOT but the issue until exist.
The JAXB Compiler dont generate DetailType class because is not needed. The
same for all remaining params in the following example:
<resource_type id="MaintainableArtefact">
<param name="agencyID" type="types:NCNameIDType"
style="template" required="false" default="all"/>
<param name="resourceID" type="types:IDType" style="template"
required="false" default="all"/>
<param name="version" type="types:VersionType" style="template"
required="false" default="latest"/>
<method name="GET" id="maintainableArtefactQuery">
<request>
<param name="detail" type="types:DetailType"
style="query" default="full"/>
<param name="references"
type="types:ReferencesType" style="query" default="none"/>
</request>
<response status="200">
<representation
mediaType="application/vnd.sdmx.structure+xml;version=2.1"
element="message:Structure"/>
</response>
<response status="400 401 404 413 500 501 503">
<representation
mediaType="application/vnd.sdmx.error+xml;version=2.1"
element="message:Error"/>
</response>
</method>
</resource_type>
Params and types:
agencyID --> types:NCNameIDType
resourceID --> types:IDType
version --> types:VersionType
detail --> types:DetailType
references --> types:ReferencesType
All are xs:simpletype with exensions {xs:union, xs:restriccion},but as we all
represent parameters and in this case everyone should be String in JAXB
generated code Class
See src/main/resources/wadl/sdmx21rest/SDMXRestTypes.xsd in the original
attached.
And behavior in getPrimitiveType method of
cxf-tools-wadlto-jaxrs/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
For now, a solution for me is omit the "type" in the definition of the
parameters in the WADL because all my parameters are String.
> Incorrect code generated with wadl2java tool when use JAXB binding and XML
> symple type with restriction.
> --------------------------------------------------------------------------------------------------------
>
> Key: CXF-4292
> URL: https://issues.apache.org/jira/browse/CXF-4292
> Project: CXF
> Issue Type: Bug
> Reporter: Zebensui Méndez
> Attachments: cxf_2_6_0_wadl.zip
>
>
> If we have an XML schema with a simpleType that has a restriction, the tool
> is not able to determine the basic type of java.
> Example:
> <xs:simpleType name="DetailType">
> <xs:annotation>
> <xs:documentation>DetailType for WADL is used to indicate the
> possible values for a WADL Resource parameter.
> This parameter specifies the desired amount of information to
> be returned.
> For example, it is possible to instruct the web service to
> return only basic information about the maintainable artefact (i.e.: id,
> agency id, version and name).
> Most notably, items of item schemes will not be returned (for
> example, it will not return the codes in a code list query).
> Possible values are: "allstubs" (all artefacts should be
> returned as stubs ), "referencestubs" (referenced artefacts should be
> returned as stubs )
> and full (all available information for all artefacts should
> be returned ).
> </xs:documentation>
> </xs:annotation>
> <xs:restriction base="xs:string">
> <xs:pattern value="allstubs"/>
> <xs:pattern value="referencestubs"/>
> <xs:pattern value="full"/>
> </xs:restriction>
> </xs:simpleType>
> And the generated code is:
> @Path("datastructure/{agencyID}/{resourceID}/{version}")
> public interface Datastructure {
> @GET
> @Produces("application/vnd.sdmx.structure+xml;version=2.1")
> StructureType MaintainableArtefactQuery(@QueryParam("detail")
> @DefaultValue("full") DetailType detail, @QueryParam("references")
> @DefaultValue("none") ReferencesType references);
> }
> But DetailType doen't have JAXB binding because is a simpleType (a String).
> The the correct code would be:
> @Path("datastructure/{agencyID}/{resourceID}/{version}")
> public interface Datastructure {
> @GET
> @Produces("application/vnd.sdmx.structure+xml;version=2.1")
> StructureType MaintainableArtefactQuery(@QueryParam("detail")
> @DefaultValue("full") String detail, @QueryParam("references")
> @DefaultValue("none") ReferencesType references);
> }
> Please run the attached code (mvn generate-sources with java parameters
> -Xms512M -Xmx1024M) to reproduce the issue. Then see for example the class
> "Datastructure".
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira