如何用实际示例替换模型架构主体参数 [英] how to replace Model schema Body parameter with actual example

查看:42
本文介绍了如何用实际示例替换模型架构主体参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆