Swagger 2.x and JAX-RS subresources

113 views
Skip to first unread message

franck102

unread,
Oct 26, 2018, 11:17:34 AM10/26/18
to Swagger
Hi all,

I am using the  swagger-maven-plugin version 2.0.5 to generate an OpenApi spec from my JAX-RS Jersey application, and I can't figure out how to deal with subresource classes?

If I do nothing, I end up with the operations being listed twice; if I add @Hidden on the subresource class, the operations are not being generated at all.

The problem can be reproduced with any configuration:

@Path("/rest/service")public class RootResource {
 
@Path("api")
 
public Class<SubResource> getProviderApiResource()
 
{
   
return SubResource.class;
 
}
}


public class SubResource {
 
@Path("doit")
 
public void doit()
 
{ }
}




... will generate both /doit and /api/doit.

Any suggestion?

Thanks!

Pat S

unread,
Nov 14, 2018, 12:40:35 PM11/14/18
to Swagger
I would try adding /api, and /doit to the @Path annotations.

Pat
Reply all
Reply to author
Forward
0 new messages