Skip to content

Commit a9510c3

Browse files
committed
Add integer check for isNumberSchema
1 parent dd98ce0 commit a9510c3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,20 +1495,20 @@ protected void applyBeanValidatorAnnotations(Schema property, Annotation[] annot
14951495
}
14961496
}
14971497
if (annos.containsKey("javax.validation.constraints.Min")) {
1498-
if ("integer".equals(property.getType()) || "number".equals(property.getType())) {
1498+
if (isNumberSchema(property)) {
14991499
Min min = (Min) annos.get("javax.validation.constraints.Min");
15001500
property.setMinimum(new BigDecimal(min.value()));
15011501
}
15021502
}
15031503
if (annos.containsKey("javax.validation.constraints.Max")) {
1504-
if ("integer".equals(property.getType()) || "number".equals(property.getType())) {
1504+
if (isNumberSchema(property)) {
15051505
Max max = (Max) annos.get("javax.validation.constraints.Max");
15061506
property.setMaximum(new BigDecimal(max.value()));
15071507
}
15081508
}
15091509
if (annos.containsKey("javax.validation.constraints.Size")) {
15101510
Size size = (Size) annos.get("javax.validation.constraints.Size");
1511-
if ("integer".equals(property.getType()) || "number".equals(property.getType())) {
1511+
if (isNumberSchema(property)) {
15121512
property.setMinimum(new BigDecimal(size.min()));
15131513
property.setMaximum(new BigDecimal(size.max()));
15141514
}
@@ -3013,7 +3013,7 @@ protected boolean isStringSchema(Schema schema){
30133013
}
30143014

30153015
protected boolean isNumberSchema(Schema schema){
3016-
return "number".equals(schema.getType()) || (schema.getTypes() != null && schema.getTypes().contains("number"));
3016+
return "number".equals(schema.getType()) || (schema.getTypes() != null && schema.getTypes().contains("number")) || "integer".equals(schema.getType()) || (schema.getTypes() != null && schema.getTypes().contains("integer"));
30173017
}
30183018

30193019
protected Schema buildRefSchemaIfObject(Schema schema, ModelConverterContext context) {

0 commit comments

Comments
 (0)