Spring Boot + Swaggerで生成したドキュメントのリクエストパラメータDescriptionを指定する
2378 ワード
Spring Boot + SpringFoxでSwaggerを利用してソースからAPIキュメントを生成するで投稿した内容の関連記事になります。
Swaggerで生成したドキュメントでGETリクエストのリクエストパラメータのDescriptionは、デフォルトではパラメータ名になります。以下の画像のような形です。
このDescriptionをもう少し分かりやすい内容にしたい、なんて時があるかと思います。以下の画像のような形です。
こんな時は、Spring Bootでは以下のように記載します。
UserController.java
@ApiOperation(value = "${UserController.getUser.value}", notes = "${UserController.getUser.notes}")
public User getUser(@ApiParam(value = "ユーザID", required = false) @RequestParam("id") String id) {
return new User(id, "ichiro");
}
@ApiParam(value = "ユーザID", required = false)
の部分がそれにあたります。このように記載することで上記の画像のようなDescriptionとなります。
以上です。
Author And Source
この問題について(Spring Boot + Swaggerで生成したドキュメントのリクエストパラメータDescriptionを指定する), 我々は、より多くの情報をここで見つけました https://qiita.com/NagaokaKenichi/items/b84f2e4333dcf4201262著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .