Skip to content

Swagger 1.5 skips path parameters which defined in Base resource class. #1317

@C0rWin

Description

@C0rWin

I have following resources in my project (simplified real case):

First one is the base class which has common property for all REST resources in the project.

public class BaseResource {

    @ApiParam("The Idendifier of entity")
    @PathParam("id")
    private String id;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
}
  1. The Book resource.
@Api(value = "Books", description = "Book management")
@Path("/{id}/v1/books/")
public class BookResource extends BaseResource {

    @GET
    @Path("{name}")
    @Produces("text/plain")
    @ApiOperation(value = "Returns book id and name")
    @ApiResponses(value = {
            @ApiResponse(code = 201, message = "Completed Successfully", response = String.class)})
    public String getIt(@ApiParam("The books name") @PathParam("name") final String name) {
        return "Hi there " + name + ", id " + getId();
    }
}
  1. The Users resource
@Api(value = "Users", description = "Users management")
@Path("/{id}/v1/users/")
public class UserResource extends BaseResource {

    @GET
    @Path("{name}")
    @ApiOperation(value = "Returns user id and name")
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "Completed Successfully", response = String.class)})
    public String getName(@ApiParam("User name") @PathParam("name") final String name) {
        return "Hello user " + name + ", id " + getId();
    }

}

I would expect to see the {id} parameter in Swagger-UI, while it skipped and not presented, as well there is no such parameter in generated swagger.json. In previous versions of Swagger 1.2 and 1.1 it worked as expected.

This is how it looks like:

screen shot 2015-08-03 at 2 51 01 pm

Swagger version I'm using is:

        <dependency>
            <groupId>com.wordnik</groupId>
            <artifactId>swagger-jersey-jaxrs</artifactId>
            <version>1.5.3-M1</version>
        </dependency>

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions