[ 
https://issues.apache.org/jira/browse/CXF-6275?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sergey Beryozkin resolved CXF-6275.
-----------------------------------
    Resolution: Invalid
      Assignee: Sergey Beryozkin

Please do not hesitate to ask further questions on the users list, thanks

> 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
>            Assignee: Sergey Beryozkin
>
> 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