[ 
https://issues.apache.org/jira/browse/CXF-6275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14349062#comment-14349062
 ] 

Sergey Beryozkin commented on CXF-6275:
---------------------------------------

This is actually an invalid issue. For a start, parameter type can not refer to 
schema representations, it all has to be done from a representation element. 
Representation parameters are useful when describing form payloads, plain or 
multipart ones. WADL is not well suited for describing explicit collections...
However there's an option that you may want to use, use -tMap or -repMap, where 
you can map a schema element to an explicit list, example. The convention is to 
do "List..myType", because angular brackets cause side-effects when used from a 
command line 

  

> wadl2java repeating="true" not taken into account in param inside 
> representation request
> ----------------------------------------------------------------------------------------
>
>                 Key: CXF-6275
>                 URL: https://issues.apache.org/jira/browse/CXF-6275
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.0.4, 2.7.15
>         Environment: windows 8.1, maven 3.2.2, java 1.6
>            Reporter: Frédéric Mondy
>
> Hi,
> I need to generate JAX-RS interfaces from a WADL file.
> I'm using your wadl2java plugin and I'm facing an issue with the following 
> case:
> ...
> <resource path="/{auditNumber}">
>       <param name="auditNumber" style="template" type="xsd:long" 
> required="true" repeating="false" />
>       ...
>       <resource path="/persons-in-charge">
>               <method id="getAuditPersonInCharge" name="GET">
>                       <response>
>                               <representation mediaType="application/json">
>                                       <param type="pic:PersonInChargeType" 
> required="false" repeating="true" />
>                               </representation>
>                       </response>
>               </method>
>               <method id="setAuditPersonInCharge" name="PUT">
>                       <request>                                               
>                 
>                               <representation mediaType="application/json">
>                                       <param name="personsInCharge" 
> type="pic:PersonInChargeType" required="false" repeating="true" />
>                               </representation>
>                       </request>
>               </method>                                       
>       </resource>
>       ...
> </resource>
> ...
> The "GET" method is well defined and return a List<PersonInChargeType>.
> But the "PUT" method is defined with a single PersonInChargeType instead of a 
> List<PersonInChargeType> which was expected using the attribute 
> repeating="true"
>     @GET
>     @Produces("application/json")
>     @Path("/audits/v0/{auditNumber}/persons-in-charge")
>     List<PersonInChargeType> getAuditPersonInCharge(@PathParam("auditNumber") 
> long auditNumber);
>     @PUT
>     @Consumes("application/json")
>     @Path("/audits/v0/{auditNumber}/persons-in-charge")
>     void setAuditPersonInCharge(@PathParam("auditNumber") long auditNumber, 
> PersonInChargeType personsInCharge);
> After having read the W3C WADL description and tried some tricks to have my 
> expected definition of the method, 
> I took a look in the source code of ../wadlto/jaxrs/SourceGenerator.java 
> (2.7.15, line 1077-1078)
>     elementParamType = getPrimitiveType(param, info, imports);
>     elementParamName = param.getAttribute("name");
> As there is nothing about the "repeating" attribute, I just insert the 
> following line between these lines: 
>       elementParamType = addListIfRepeating(elementParamType, 
> isRepeatingParam(param), imports);
> and with this line, the "PUT" method is well defined:
>     @PUT
>     @Consumes("application/json")
>     @Path("/audits/v0/{auditNumber}/persons-in-charge")
>     void setAuditPersonInCharge(@PathParam("auditNumber") long auditNumber, 
> List<PersonInChargeType> personsInCharge);
> If you agree on the issue, is it possible to have a quick fix release?
> Thank you in advance
> Frédéric Mondy



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to