如何用实际示例替换模型架构主体参数 [英] how to replace Model schema Body parameter with actual example
问题描述
我有 spring-boot/spring-mvc 和 springfox swagger2 集成.我附上了示例屏幕截图.在body"的参数类型中,我有一个描述元素数据类型的模型模式.字符串,0 等!如何用实际示例替换它,以便我可以尝试一下".这对我的 API 消费者更有用.
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.
推荐答案
不确定你是否找到了这个问题的答案,但我还是会回答这个问题.
Not sure if you found the answer to this one, but I am going to answer this anyways.
@ApiModelProperty
有一个名为 example
的属性.你可以利用它.
The @ApiModelProperty
has a property called example
. You can make use of that.
@ApiModelProperty(value="用户名", required=true, example="John")
这篇关于如何用实际示例替换模型架构主体参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!