jaxrs-analyzer
jaxrs-analyzer copied to clipboard
Return values not generated correctly on annotated interfaces
If JAX-RS annotations are put on an interface instead of a concrete class, response types are not generated correctly:
Es. the following interface:
package com.primeur.test.resources;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static javax.ws.rs.core.MediaType.APPLICATION_XML;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@Path("/basepath")
public interface RestService {
@GET
@Path("/value")
@Produces({ APPLICATION_JSON, APPLICATION_XML })
public int getValue();
@GET
@Path("/strvalue")
@Produces({ APPLICATION_JSON, APPLICATION_XML })
public String getStrValue();
}
Leads to the following json output:
REST resources of project:
0.1-SNAPSHOT
GET rootpath/basepath/strvalue:
Request:
No body
Response:
Content-Type: application/json, application/xml
Status Codes: 204
GET rootpath/basepath/value:
Request:
No body
Response:
Content-Type: application/json, application/xml
Status Codes: 204
I'm hitting this as well. It seems like it might be limited to interfaces that are actually implement.
I have some annotated interfaces for requests where I'm the client, and so I'm letting the framework implement them for me, and those don't have this problem.
Actually, I was mistaken, I don't have responses for the APIs I consume either. Just the 204.