Skip to content

Commit 3ffc4bf

Browse files
committed
backport support DecimalMin/DecimalMax #4091
1 parent c0bea5e commit 3ffc4bf

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

modules/swagger-codegen/src/main/resources/Java/beanValidation.mustache

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,22 @@
3232
{{^minItems}}
3333
{{#maxItems}}
3434
@Size(max={{maxItems}})
35-
{{/maxItems}}
36-
{{/minItems}}
35+
{{/maxItems}}
36+
{{/minItems}}
37+
{{! check for integer / number=decimal type}}
38+
{{#isInteger}}
3739
{{#minimum}}
38-
{{#isInteger}}
3940
@Min({{minimum}})
40-
{{/isInteger}}
41-
{{#isLong}}
42-
@Min({{minimum}})
43-
{{/isLong}}
4441
{{/minimum}}
4542
{{#maximum}}
46-
{{#isInteger}}
47-
@Max({{maximum}})
48-
{{/isInteger}}
49-
{{#isLong}}
5043
@Max({{maximum}})
51-
{{/isLong}}
5244
{{/maximum}}
45+
{{/isInteger}}
46+
{{^isInteger}}
47+
{{#minimum}}
48+
@DecimalMin("{{minimum}}")
49+
{{/minimum}}
50+
{{#maximum}}
51+
@DecimalMax("{{maximum}}")
52+
{{/maximum}}
53+
{{/isInteger}}

modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/beanValidation.mustache

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,22 @@
3232
{{^minItems}}
3333
{{#maxItems}}
3434
@Size(max={{maxItems}})
35-
{{/maxItems}}
36-
{{/minItems}}
35+
{{/maxItems}}
36+
{{/minItems}}
37+
{{! check for integer / number=decimal type}}
38+
{{#isInteger}}
3739
{{#minimum}}
3840
@Min({{minimum}})
3941
{{/minimum}}
4042
{{#maximum}}
4143
@Max({{maximum}})
42-
{{/maximum}}
44+
{{/maximum}}
45+
{{/isInteger}}
46+
{{^isInteger}}
47+
{{#minimum}}
48+
@DecimalMin("{{minimum}}")
49+
{{/minimum}}
50+
{{#maximum}}
51+
@DecimalMax("{{maximum}}")
52+
{{/maximum}}
53+
{{/isInteger}}

0 commit comments

Comments
 (0)