如何使用springfox在swagger ui上显示动态字段

问题描述

我有一个api,可以通过查询字符串接受任何参数。 我想用springfox来记录它,但是ui不允许我显示要发送的字段。

当我将控制器设置为接受Map<String,String>时,我可以在控制器下处理params,但是ui不会按预期显示。

@RequestParam Map<String,String> allParams

enter image description here

设置发送值时,接口将使用发送的值发送字段allParams。喜欢:

curl -X GET "http://localhost/articles/term?allParams=term%3Dvalue"

enter image description here

我想设置多个值或发送完整的查询字符串。是否可以显示一个字段来发送所有term=value之类的查询字符串?

curl -X GET "http://localhost/articles/term?term=value&otherterm=othervalue"

我正在使用spring 2.3.1和springfox 2.9.2

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...