how to replace Model schema Body parameter with ac

2019-08-06 20:54发布

问题:

I have spring-boot/spring-mvc and springfox swagger2 integration. I have attached sample screen shot. In parameter type of 'body' I have a Model schema which describe elements data types. string, 0 etc! How can I replace it with actual example so that I can 'Try it out' . That would be more useful for my API consumer.

回答1:

Not sure if you found the answer to this one, but I am going to answer this anyways.

The @ApiModelProperty has a property called example. You can make use of that.

@ApiModelProperty(value="name of the user", required=true, example="John")

Swagger