【问题标题】:OpenAPI (Swagger) not working correctly with array typeOpenAPI (Swagger) 无法与数组类型一起正常工作
【发布时间】:2021-02-12 20:03:04
【问题描述】:

我使用SpringBootspringdoc-openapi-ui。我有带有方法的控制器,其中包含数组作为 url 参数:

 @Parameters(value = {
            @Parameter(in = ParameterIn.QUERY, name = "output", example = "[f1,f2,f3]",
                    content = @Content(array = @ArraySchema(schema = @Schema(type = "string"))))
})
public ResponseEntity<Object> showReportData(@RequestParam(value = "output") String[] outputFields) {
//some body
}

但是,当我打开 SwaggerUI 时,我在项目文本框中看不到我的示例值:

当我点击执行时,我在请求中看到了这个参数:

为什么会这样?为什么示例数组没有显示在item中?

【问题讨论】:

    标签: swagger swagger-ui openapi springdoc-openapi-ui


    【解决方案1】:

    这似乎与您的浏览器配置有关。 换个浏览器试试...

    数组在 swagger-ui 中就像一个 chamr 一样工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-26
      • 2017-12-14
      • 2020-08-19
      • 2013-02-06
      • 2019-02-02
      • 2021-10-15
      相关资源
      最近更新 更多