2017-05-25 14 views
0

Jersey 1.xで1.3.0を使用しています。私は以下のように私のリソースメソッドのために闊歩ドキュメントを追加しようとしています:ネストされたRESTリソースに注釈をつける方法を教えてください。

@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 

} 

上記のコードは、単にテンプレートとNOT完全な作業バージョンであることを理解してください。

ネストされたリソース用のswagger docを追加する方法を教えてください。おかげで、事前にヘルプ:)

+0

を使用すると、親クラスと同じアノテーションで入れ子になったクラスに注釈を付ける試みたことがありますか? –

+0

はい、私はそれを働かせました。ありがとう – Praveen

答えて

0

のために、私は最終的にそれが以下のように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(){} 

} 
関連する問題