Swagger - spring fox - hide password

1.9k Views Asked by At

Swagger - spring fox - hide password.

In one of our API I need to return alphanumeric code after verifying user id and password.

We are using springfox-swagger-ui-2.3.1.I have a field "password" where I do not want to show password (instead i want to show "XXXX") when user types in swagger ui.

password is defined as @RequestParam(value = "password") String password.

any suggestion is highly appreciated.

3

There are 3 best solutions below

0
On
0
On

To use password as a parameter type, you can simply override the format like this:

@ApiParam(value = "your password", type = "string", format = "password") 
@QueryParam(/* normal stuff */)

hidden password for APiParam

0
On

Unfortunately springfox does not provide support for swagger-core's password format.

It was introduced in swagger-core 1.5.11 #469

Issue #2366 is still open in springfox.