You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Andriy Redko (Jira)" <ji...@apache.org> on 2020/01/24 00:55:00 UTC
[jira] [Resolved] (CXF-8200) Use name() instead of toString() for
enums when generating WADL
[ https://issues.apache.org/jira/browse/CXF-8200?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andriy Redko resolved CXF-8200.
-------------------------------
Resolution: Fixed
> Use name() instead of toString() for enums when generating WADL
> ---------------------------------------------------------------
>
> Key: CXF-8200
> URL: https://issues.apache.org/jira/browse/CXF-8200
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS, JAXB Databinding
> Affects Versions: 3.1.13, 3.3.5, 3.2.12
> Environment: CXF 3.1.13
> Tomcat apache 8.5.34
> Reporter: Mattias Andersson
> Assignee: Andriy Redko
> Priority: Minor
> Fix For: 3.4.0, 3.3.6, 3.2.13
>
>
> When generating WADL the enum option value contains the toString() of the enum (the human readable value for the option) but it should use the name() method instead. Ex:
>
> {code:java}
> public enum Status {
> INVOICED("Invoiced"),
> NOT_INVOICED("Not invoiced");
>
> String desc;
> Status(String desc) {
> this.desc = desc;
> }
> public String toString() {
> return desc;
> }
> }
>
> {code}
> @GET
> @Path("customers/\{customerNo}/creditnotes")
> public Response findCreditNotesForCustomerNo(
> @QueryParam("session") @XmlElement(required = true) String session,
> @PathParam("customerNo") int customerNo,
> @QueryParam("status") Status status);
>
> The WADL contains:
> <resource path="customers/\{customerNo}/creditnotes">
> <param name="customerNo" style="template" type="xs:int"/>
> <method name="GET">
> <request>
> <param name="session" style="query" type="xs:string"/>
> *<param name="status" style="query" type="xs:string">*
> *<option value="Not invoiced"/>*
> *<option value="Invoiced"/>*
> </param>
> </request>
> I would expect it to be using the name() method. Like this:
>
> <resource path="customers/\{customerNo}/creditnotes">
> <param name="customerNo" style="template" type="xs:int"/>
> <method name="GET">
> <request>
> <param name="session" style="query" type="xs:string"/>
> *<param name="status" style="query" type="xs:string">*
> *<option value="NOT_INVOICED"/>*
> *<option value="INVOICED"/>*
> </param>
> </request>
>
> Otherwise if someone looks at the WADL he would think that one should sent the human readable string which is not correct.
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)