Springfox :短类型被认为是 $int32

Springfox : Short type is considered as $int32

语言

描述

嗨,我正在使用 springfox-swagger-ui 和 springfox-bean-validators 我怎么能大摇大摆地说我的 属性 是 Short ($int16)

我的 Pojo

    @ApiModelProperty(required = true, dataType = "java.lang.Short")
    @NotNull
    @JsonProperty("deviceId")
    private Short deviceId;

Swagger中的结果

deviceId* | integer($int32)

预计

deviceId* | $int16

非常感谢

亲切

很遗憾,你不能。

Swagger specification 不支持 short (int16) 数据类型。

支持的数据类型:

+-------------+---------+-----------+--------------------------------------------------+
| Common Name |  type   |  format   |                     Comments                     |
+-------------+---------+-----------+--------------------------------------------------+
| integer     | integer | int32     | signed 32 bits                                   |
| long        | integer | int64     | signed 64 bits                                   |
| float       | number  | float     |                                                  |
| double      | number  | double    |                                                  |
| string      | string  |           |                                                  |
| byte        | string  | byte      | base64 encoded characters                        |
| binary      | string  | binary    | any sequence of octets                           |
| boolean     | boolean |           |                                                  |
| date        | string  | date      | As defined by full-date - RFC3339                |
| dateTime    | string  | date-time | As defined by date-time - RFC3339                |
| password    | string  | password  | Used to hint UIs the input needs to be obscured. |
+-------------+---------+-----------+--------------------------------------------------+