Java 如何大摇大摆地注释嵌套的REST资源?

Java 如何大摇大摆地注释嵌套的REST资源?,java,jersey,swagger,Java,Jersey,Swagger,我正在使用swagger 1.3.0和Jersey 1.x。我正在尝试为我的资源方法添加以下招摇过市文档: @Api(.....) class RootResource{ @GET @Path("/") @ApiOperation(....) @ApiResponse(....) public Response get(){} // i am able to get this method's swagger doc @Path("/nestedResource")

我正在使用swagger 1.3.0和Jersey 1.x。我正在尝试为我的资源方法添加以下招摇过市文档:

@Api(.....)
class RootResource{

  @GET
  @Path("/")
  @ApiOperation(....)
  @ApiResponse(....)
  public Response get(){} // i am able to get this method's swagger doc

  @Path("/nestedResource")
  public NestedResource getNestedResource(){
    return new NestedResource();
  }     

}

class NestedResource{

  @GET
  @ApiOperation(....)
  @ApiResponse(....)
  public Response getNestedResource(){} // i am NOT able to get this method's swagger doc

}
请理解以上代码只是一个模板,而不是一个完整的工作版本


请让我知道如何为嵌套资源添加swagger文档。提前感谢您的帮助:)

我最终通过如下注释NestedResource使其正常工作:

 /* Yes,i left the value attribute as blank so that path will be constructed 
 as "/NestedResource" */
@Api(basePath="/",value="") 
class NestedResource{

    @GET
    @ApiOperation(....)
    @ApiResponse(....)
    public Response getNestedResource(){}

}

我最终通过注释NestedResource使其工作,如下所示:

 /* Yes,i left the value attribute as blank so that path will be constructed 
 as "/NestedResource" */
@Api(basePath="/",value="") 
class NestedResource{

    @GET
    @ApiOperation(....)
    @ApiResponse(....)
    public Response getNestedResource(){}

}

您是否尝试过使用与父类相同的注释对嵌套类进行注释?是的,我已经成功了。谢谢,你试过用与父类相同的注释来注释嵌套类吗?是的,我成功了。谢谢