OpenAPISwagger无法与数组类型一起正常使用

问题描述

我使用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时,在项目文本框中看不到示例值:

enter image description here

当我单击执行时,我在请求中看到此参数:

enter image description here

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

解决方法

这似乎与您的浏览器配置有关。 尝试更改浏览器...

数组在swagger-ui中的工作原理像。