Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
3.1.13, 3.3.5, 3.2.12
-
None
-
CXF 3.1.13
Tomcat apache 8.5.34
-
Unknown
Description
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:
public enum Status { INVOICED("Invoiced"), NOT_INVOICED("Not invoiced"); String desc; Status(String desc) { this.desc = desc; } public String toString() { return desc; } }
@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.