-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JAXB definitions in dependent jar are not taken into account #36
Comments
Normally the schema should be included in the |
Hi, |
Ok, so if the implementation is not available to the Analyzer, then it won't get all needed information... That's probably why it falls back to the |
Ok, thanks. The problem is that if I move the plugin execution on the implementation project, the API jar (which is a compile dependency and which has all methods and dto definitions) seems not to be taken into account, resulting in an empty output.
|
@sdaschner Any workarounds for people where DTOs and resources are defined in different Maven artifacts? |
After some investigations, I found that the problem is due to the fact that annotations have been put on an interface and not into the concrete class. 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();
} The problem is due to jaxrs-analizer behavior and non strictly to the maven plugin. For this reason I filed this issue: sdaschner/jaxrs-analyzer#117 |
In seems that when a GET method returns a JAXB annotated object, the generated swagger.json does not contains the correct description es:
... @GET @Path("/pap/{repoId}") @Produces({ APPLICATION_JSON, APPLICATION_XML }) public PolicyRepositoryInfo getPap(@PathParam("repoId") String repoId) throws SystemException, IllegalArgumentException; ...
where
PolicyRepositoryInfo
resides in a declared (compile) dependency jarturns into:
... "/authorization/pap":{ "get":{ "consumes":[ ], "produces":[ "application/json", "application/xml" ], "parameters":[ ], "responses":{ "204":{ "description":"No Content", "headers":{ } } }, "tags":[ "authorization" ] }, }, ...
The same
PolicyRepositoryInfo
object is correctly referred when used for post requests"post":{ "consumes":[ "application/json", "application/xml" ], "produces":[ "application/json", "application/xml" ], "parameters":[ { "name":"body", "in":"body", "required":true, "schema":{ "$ref":"#/definitions/PolicyRepositoryInfo" } } ], "responses":{ "204":{ "description":"No Content", "headers":{ } } }, "tags":[ "authorization" ] }
The text was updated successfully, but these errors were encountered: