sdaschner / jaxrs-analyzer

Creates REST documentation for JAX-RS projects
Apache License 2.0
320 stars 101 forks source link

Return values not generated correctly on annotated interfaces #117

Open fcav1973 opened 7 years ago

fcav1973 commented 7 years ago

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
tringenbach commented 7 years ago

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.

tringenbach commented 7 years ago

Actually, I was mistaken, I don't have responses for the APIs I consume either. Just the 204.