Api and ApiImplicitParam annotations are not being parsed/read when they are used in a JAX-RS interface, as in the following example:
@Path("/pet")
@Api(tags = "someTag")
public interface ResourceWithAnnotationsOnlyInInterface {
@GET
@Path("/randomPet")
@ApiOperation(value = "getRandomPet")
@ApiImplicitParams({ @ApiImplicitParam(name = "petImplicitIdParam", paramType = "query", dataType = "string") })
String getRandomPet();
}
public class ResourceWithAnnotationsOnlyInInterfaceImpl implements ResourceWithAnnotationsOnlyInInterface {
@Override
public String getRandomPet() {
return "No pet today..";
}
}
This issue is quite similar to issue #1506
The solution is also similar: use
Api api = ReflectionUtils.getAnnotation(cls, Api.class);
instead of
Api api = (Api) cls.getAnnotation(Api.class);
Noticed in swagger-core version 1.5.8
I will fix this and create a pull request for this