【发布时间】:2020-12-02 09:23:34
【问题描述】:
我正在尝试为现有 Jersey 项目获取 OpenAPI 定义。
我有很多方法采用OptionalInt 参数,例如:
public Response listAgents(@Auth AuthenticatedUser auth,
@QueryParam("count") OptionalInt count, @QueryParam("start") OptionalInt start)
Swagger 将这些参数检测为对象(这是错误的):
parameters:
- name: count
in: query
schema:
type: object
properties:
empty:
type: boolean
present:
type: boolean
asInt:
type: integer
format: int32
有没有办法将 Swagger 配置为将 OptionalInt 类型处理为整数类型,而无需在每个参数上使用 @Parameter(schema = @Schema(implementation = Integer.class)) 注释重写每个方法?
【问题讨论】: