how to replace Model schema Body parameter with actual example

十年热恋 提交于 2019-12-24 14:01:46

问题


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



来源:https://stackoverflow.com/questions/33133512/how-to-replace-model-schema-body-parameter-with-actual-example

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!