Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide a request field in Swagger API

Tags:

java

swagger

I want to hide the "id" item in the model, how to do this in java?

like image 654
Vision Yang Avatar asked Nov 12 '18 13:11

Vision Yang


People also ask

How do I hide a field in swagger?

This is all you need to add to hide the field in the Swagger ui: @ApiModelProperty(hidden = true) private List<Reservation> reservations; That would hide the reservation list from showing.

How do I hide a schema in swagger net core?

How to do it? add this property in your Swagger UI Options defaultModelsExpandDepth: -1 for hide schema section and for more reference refer this swagger.io/docs/open-source-tools/swagger-ui/usage/… Can you please add your swagger ui configuration settings in your question.

How do I make my swagger private?

Open the API page in SwaggerHub. Click to make the version private or to make it public.


1 Answers

@JsonProperty(access = JsonProperty.Access.READ_ONLY)
@ApiModelProperty(accessMode = ApiModelProperty.AccessMode.READ_ONLY)
private String id;

Also see: https://github.com/springfox/springfox/issues/2816

like image 107
Guru Avatar answered Sep 21 '22 08:09

Guru