lurenjia1993
lurenjia1993
采纳率64.7%
2019-12-30 11:35

spring boot swagger2怎么进行map传参

10


io.springfox
springfox-swagger2
2.8.0


io.springfox
springfox-swagger-ui
2.8.0

    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-spring-web</artifactId>
        <version>2.8.0</version>
    </dependency>

    依赖版本号

    这个版本不知支持Example用法,请问有什么解决的方式吗

    @ApiOperation(value = "not use")
@ApiImplicitParam(name = "params" , paramType = "body",examples = @Example({
    @ExampleProperty(value = "{'user':'id'}", mediaType = "application/json")
}))
@PostMapping("/xxx")
public void test(Map<String,String> params){}

    效果是
    ![图片说明](https://img-ask.csdn.net/upload/201912/30/1577676901_979644.png)
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • weixin_44700117 「已注销」 2年前

    有一个博主写过你看看能不能解决你的问题 https://blog.csdn.net/hellopeng1/article/details/82227942

    点赞 评论 复制链接分享
  • Amo_lt Amo_lt 2年前
    @ApiImplicitParams({
                @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "body", required = true),
                @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "body", required = false),
                @ApiImplicitParam(name = "gender", value = "性别", dataType = "String", paramType = "body", required = false) })
    
            类似这样写吧?
    
    点赞 评论 复制链接分享