Swagger UI 不显示所有 header 值

Swagger UI does not show all header values

我有 Spring 引导 REST 控制器 header 可以有超过 1 个值:

@RestController
@RequestMapping(value = "/example", headers = {"version=v1", "version=v2"})
@Api(value = "Example API")
public class ExampleController {

并使用 Springfox 实施 Swagger。当我加载 Swagger UI 时,我只能从列表中看到 select 版本 header 的 v1 选项。如何在 Swagger UI 中将所有 header 值显示为 select?如何更改 Swagger UI 列表中的默认 header 值?

在控制器方法上使用了 ApiImplicitParams:

@ApiImplicitParams({
    @ApiImplicitParam(name = "version", allowableValues="v1,v2", required = false, dataType = "String", paramType = "header")
})

allowableValues:

  1. To set a list of values, provide a comma-separated list. For example: first, second, third.
  2. To set a range of values, start the value with "range", and surrounding by square brackets include the minimum and maximum values, or round brackets for exclusive minimum and maximum values. For example: range[1, 5], range(1, 5), range[1, 5).
  3. To set a minimum/maximum value, use the same format for range but use "infinity" or "-infinity" as the second value. For example, range[1, infinity] means the minimum allowable value of this parameter is 1.