Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swagger ApiModelProperty access

I'm using the same Object both for my Request and Response on a REST endpoint. Is it possible to annotate a property with ApiModelProperty(access = "response") and then annotate the rest endpoint method with @ApiImplicitParam(access = "response") so that the property only shows up in the swagger doc for the response object and not the request one?

like image 833
hello_world_infinity Avatar asked Sep 10 '25 23:09

hello_world_infinity


1 Answers

You can achieve the same using @ApiModelProperty(readOnly = true). Allows a model property to be designated as read only. It will hide property from request and shows for a response only.

@ApiModelProperty(readOnly = true)

like image 184
SSK Avatar answered Sep 12 '25 14:09

SSK