gpt4 book ai didi

java - 春狐 : Short type is considered as $int32

转载 作者:行者123 更新时间:2023-12-02 09:16:18 24 4
gpt4 key购买 nike

语言

  • Java/Springboot/Springfox[2.9.2]

描述

嗨,我正在使用 springfox-swagger-ui 和 springfox-bean-validators我怎样才能 Swagger 说我的属性(property)是空头($int16)

我的Pojo

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

Swagger 中的结果

设备 ID* |整数($int32)

预期

设备 ID* | $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. |
+-------------+---------+-----------+--------------------------------------------------+

关于java - 春狐 : Short type is considered as $int32,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58955284/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com