openapi 生成不能正常工作的最小值和最大值
openapi generates minimum and maximum which is not working properly
openapiminimum/maximum
put:
summary: add
operationId: add
requestBody:
description: value
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Value'
components:
schemas:
Value:
type: object
required:
- value
properties:
value:
type: integer
format: int64
minimum: 1
maximum: 999
生成
@Min(1L) @Max(999L)
public Long getValue() {
return value;
}
无法正常工作。我试试
mockMvc.perform(
put(RESOURCE_URL + "/1/add")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"value\":0}"))
我不知道是 API 问题还是 spring @Min(1L) @Max(999L)
验证器问题?
dependencies {
...
implementation 'org.springframework.boot:spring-boot-starter-validation'
}
openapiminimum/maximum
put:
summary: add
operationId: add
requestBody:
description: value
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Value'
components:
schemas:
Value:
type: object
required:
- value
properties:
value:
type: integer
format: int64
minimum: 1
maximum: 999
生成
@Min(1L) @Max(999L)
public Long getValue() {
return value;
}
无法正常工作。我试试
mockMvc.perform(
put(RESOURCE_URL + "/1/add")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"value\":0}"))
我不知道是 API 问题还是 spring @Min(1L) @Max(999L)
验证器问题?
dependencies {
...
implementation 'org.springframework.boot:spring-boot-starter-validation'
}