- Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
Hi !
If you have a resource such as:
@Path("test") @Produces(MediaType.APPLICATION_JSON) @Api("test") public class TestResource { @Path("/status") @GET @ApiOperation("Get status") public String getStatus() { return "{\"status\":\"OK!\"}"; } @Path("/more") public TestSubResource getSubResource() { return new TestSubResource(); } }
and a subresource such as:
@Produces(MediaType.APPLICATION_JSON) public class TestSubResource { @Path("/otherStatus") @GET @ApiOperation("Get the other status!") public String otherStatus() { return "{\"a\":\"Still Ok!\"}"; } }
When accessing the Swagger spec under /api-docs/
, you will get the following result:
{ "apiVersion": "v9", "swaggerVersion": "1.2", "apis": [ { "path": "/test" } ] }
Under /api-docs/test
you will get the following result:
{ "apiVersion": "v9", "swaggerVersion": "1.2", "basePath": "/rest", "resourcePath": "/test", "produces": [ "application/json" ], "apis": [ { "path": "/test/status", "operations": [ { "method": "GET", "summary": "Get status", "notes": "", "type": "void", "nickname": "getStatus", "parameters": [ ] } ] } ] }
As you can see, the /test/more/otherStatus
method is not documented in the Swagger spec.
Adding the @Api annotation on the TestSubResource
sub resource fixes the issue but introduces a new one. Now the calls are documented correctly in /api-docs/test
BUT the methods under the TestSubResource
resource are visible under /api-docs
.
This should not be the case as example.org/more/otherStatus
is not a valid API call. It is only accessible through the TestResource
resource using example.org/test/more/otherStatus
.
EDIT: typos
Metadata
Metadata
Assignees
Labels
No labels