0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Spring Boot + Swaggerで生成したドキュメントのリクエストパラメータDescriptionを指定する

Posted at

Spring Boot + SpringFoxでSwaggerを利用してソースからAPIキュメントを生成するで投稿した内容の関連記事になります。

Swaggerで生成したドキュメントでGETリクエストのリクエストパラメータのDescriptionは、デフォルトではパラメータ名になります。以下の画像のような形です。
aaaaa.PNG

このDescriptionをもう少し分かりやすい内容にしたい、なんて時があるかと思います。以下の画像のような形です。
dddd.PNG

こんな時は、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となります。

以上です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?