diff --git a/docs/generators/java-camel.md b/docs/generators/java-camel.md index 613823e32500..b50d9b4728c1 100644 --- a/docs/generators/java-camel.md +++ b/docs/generators/java-camel.md @@ -133,6 +133,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl |x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.|OPERATION|false |x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null |x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null +|x-size-message|Add this property whenever you need to customize the invalidation error message for the size or length of a variable|FIELD, OPERATION_PARAMETER|null +|x-minimum-message|Add this property whenever you need to customize the invalidation error message for the minimum value of a variable|FIELD, OPERATION_PARAMETER|null +|x-maximum-message|Add this property whenever you need to customize the invalidation error message for the maximum value of a variable|FIELD, OPERATION_PARAMETER|null |x-spring-api-version|Value for 'version' attribute in @RequestMapping (for Spring 7 and above).|OPERATION|null diff --git a/docs/generators/kotlin-spring.md b/docs/generators/kotlin-spring.md index 9fc742bd2464..e79fdd782b70 100644 --- a/docs/generators/kotlin-spring.md +++ b/docs/generators/kotlin-spring.md @@ -67,6 +67,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl |x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| |x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null |x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null +|x-size-message|Add this property whenever you need to customize the invalidation error message for the size or length of a variable|FIELD, OPERATION_PARAMETER|null +|x-minimum-message|Add this property whenever you need to customize the invalidation error message for the minimum value of a variable|FIELD, OPERATION_PARAMETER|null +|x-maximum-message|Add this property whenever you need to customize the invalidation error message for the maximum value of a variable|FIELD, OPERATION_PARAMETER|null |x-kotlin-implements|Ability to specify interfaces that model must implement|MODEL|empty array |x-kotlin-implements-fields|Specify attributes that are implemented by the interface(s) added via `x-kotlin-implements`|MODEL|empty array diff --git a/docs/generators/spring.md b/docs/generators/spring.md index 050a7814b9ee..2af0fe826a3e 100644 --- a/docs/generators/spring.md +++ b/docs/generators/spring.md @@ -126,6 +126,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl |x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.|OPERATION|false |x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null |x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null +|x-size-message|Add this property whenever you need to customize the invalidation error message for the size or length of a variable|FIELD, OPERATION_PARAMETER|null +|x-minimum-message|Add this property whenever you need to customize the invalidation error message for the minimum value of a variable|FIELD, OPERATION_PARAMETER|null +|x-maximum-message|Add this property whenever you need to customize the invalidation error message for the maximum value of a variable|FIELD, OPERATION_PARAMETER|null |x-spring-api-version|Value for 'version' attribute in @RequestMapping (for Spring 7 and above).|OPERATION|null diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java index e2de4661f4d4..bce0e2a691f4 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java @@ -27,6 +27,9 @@ public enum VendorExtension { X_OPERATION_EXTRA_ANNOTATION("x-operation-extra-annotation", ExtensionLevel.OPERATION, "List of custom annotations to be added to operation", null), X_VERSION_PARAM("x-version-param", ExtensionLevel.OPERATION_PARAMETER, "Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false", null), X_PATTERN_MESSAGE("x-pattern-message", Arrays.asList(ExtensionLevel.FIELD, ExtensionLevel.OPERATION_PARAMETER), "Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable", null), + X_SIZE_MESSAGE("x-size-message", Arrays.asList(ExtensionLevel.FIELD, ExtensionLevel.OPERATION_PARAMETER), "Add this property whenever you need to customize the invalidation error message for the size or length of a variable", null), + X_MINIMUM_MESSAGE("x-minimum-message", Arrays.asList(ExtensionLevel.FIELD, ExtensionLevel.OPERATION_PARAMETER), "Add this property whenever you need to customize the invalidation error message for the minimum value of a variable", null), + X_MAXIMUM_MESSAGE("x-maximum-message", Arrays.asList(ExtensionLevel.FIELD, ExtensionLevel.OPERATION_PARAMETER), "Add this property whenever you need to customize the invalidation error message for the maximum value of a variable", null), X_ZERO_BASED_ENUM("x-zero-based-enum", ExtensionLevel.MODEL, "When used on an enum, the index will not be generated and the default numbering will be used, zero-based", "false"); private final String name; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java index 43b849998f25..821726610733 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java @@ -1012,6 +1012,9 @@ public List getSupportedVendorExtensions() { extensions.add(VendorExtension.X_DISCRIMINATOR_VALUE); extensions.add(VendorExtension.X_FIELD_EXTRA_ANNOTATION); extensions.add(VendorExtension.X_PATTERN_MESSAGE); + extensions.add(VendorExtension.X_SIZE_MESSAGE); + extensions.add(VendorExtension.X_MINIMUM_MESSAGE); + extensions.add(VendorExtension.X_MAXIMUM_MESSAGE); extensions.add(VendorExtension.X_KOTLIN_IMPLEMENTS); extensions.add(VendorExtension.X_KOTLIN_IMPLEMENTS_FIELDS); return extensions; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index 5c6053474fcf..5ccb1d1fb3ad 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -1212,6 +1212,9 @@ public List getSupportedVendorExtensions() { extensions.add(VendorExtension.X_SPRING_PAGINATED); extensions.add(VendorExtension.X_VERSION_PARAM); extensions.add(VendorExtension.X_PATTERN_MESSAGE); + extensions.add(VendorExtension.X_SIZE_MESSAGE); + extensions.add(VendorExtension.X_MINIMUM_MESSAGE); + extensions.add(VendorExtension.X_MAXIMUM_MESSAGE); extensions.add(VendorExtension.X_SPRING_API_VERSION); return extensions; } diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/beanValidationCore.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/beanValidationCore.mustache index 569f7060be4b..ce71a6883611 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/beanValidationCore.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/beanValidationCore.mustache @@ -1,24 +1,24 @@ -{{^isUuid}}{{#pattern}}{{^isByteArray}}@Pattern(regexp = "{{{pattern}}}"{{#vendorExtensions.x-pattern-message}}, message="{{vendorExtensions.x-pattern-message}}"{{/vendorExtensions.x-pattern-message}}) {{/isByteArray}}{{/pattern}}{{! +{{^isUuid}}{{#pattern}}{{^isByteArray}}@Pattern(regexp = "{{{pattern}}}"{{#vendorExtensions.x-pattern-message}}, message = "{{vendorExtensions.x-pattern-message}}"{{/vendorExtensions.x-pattern-message}}) {{/isByteArray}}{{/pattern}}{{! minLength && maxLength set -}}{{#minLength}}{{#maxLength}}@Size(min = {{minLength}}, max = {{maxLength}}) {{/maxLength}}{{/minLength}}{{! +}}{{#minLength}}{{#maxLength}}@Size(min = {{minLength}}, max = {{maxLength}}{{#vendorExtensions.x-size-message}}, message = "{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxLength}}{{/minLength}}{{! minLength set, maxLength not -}}{{#minLength}}{{^maxLength}}@Size(min = {{minLength}}) {{/maxLength}}{{/minLength}}{{! +}}{{#minLength}}{{^maxLength}}@Size(min = {{minLength}}{{#vendorExtensions.x-size-message}}, message = "{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxLength}}{{/minLength}}{{! minLength not set, maxLength set -}}{{^minLength}}{{#maxLength}}@Size(max = {{.}}) {{/maxLength}}{{/minLength}}{{! +}}{{^minLength}}{{#maxLength}}@Size(max = {{.}}{{#vendorExtensions.x-size-message}}, message = "{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxLength}}{{/minLength}}{{! @Size: minItems && maxItems set -}}{{#minItems}}{{#maxItems}}@Size(min = {{minItems}}, max = {{maxItems}}) {{/maxItems}}{{/minItems}}{{! +}}{{#minItems}}{{#maxItems}}@Size(min = {{minItems}}, max = {{maxItems}}{{#vendorExtensions.x-size-message}}, message = "{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxItems}}{{/minItems}}{{! @Size: minItems set, maxItems not -}}{{#minItems}}{{^maxItems}}@Size(min = {{minItems}}) {{/maxItems}}{{/minItems}}{{! +}}{{#minItems}}{{^maxItems}}@Size(min = {{minItems}}{{#vendorExtensions.x-size-message}}, message = "{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxItems}}{{/minItems}}{{! @Size: minItems not set && maxItems set -}}{{^minItems}}{{#maxItems}}@Size(max = {{.}}) {{/maxItems}}{{/minItems}}{{! +}}{{^minItems}}{{#maxItems}}@Size(max = {{.}}{{#vendorExtensions.x-size-message}}, message = "{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxItems}}{{/minItems}}{{! @Email: useBeanValidation }}{{#isEmail}}{{#useBeanValidation}}@{{javaxPackage}}.validation.constraints.Email {{/useBeanValidation}}{{! @Email: performBeanValidation exclusive }}{{^useBeanValidation}}{{#performBeanValidation}}@org.hibernate.validator.constraints.Email {{/performBeanValidation}}{{/useBeanValidation}}{{/isEmail}}{{! check for integer or long / all others=decimal type with @Decimal* isInteger set -}}{{#isInteger}}{{#minimum}}@Min({{.}}) {{/minimum}}{{#maximum}}@Max({{.}}) {{/maximum}}{{/isInteger}}{{! +}}{{#isInteger}}{{#minimum}}@Min(value = {{.}}{{#vendorExtensions.x-minimum-message}}, message = "{{vendorExtensions.x-minimum-message}}"{{/vendorExtensions.x-minimum-message}}) {{/minimum}}{{#maximum}}@Max(value = {{.}}{{#vendorExtensions.x-maximum-message}}, message = "{{vendorExtensions.x-maximum-message}}"{{/vendorExtensions.x-maximum-message}}) {{/maximum}}{{/isInteger}}{{! isLong set -}}{{#isLong}}{{#minimum}}@Min({{.}}L) {{/minimum}}{{#maximum}}@Max({{.}}L) {{/maximum}}{{/isLong}}{{! +}}{{#isLong}}{{#minimum}}@Min(value = {{.}}L{{#vendorExtensions.x-minimum-message}}, message = "{{vendorExtensions.x-minimum-message}}"{{/vendorExtensions.x-minimum-message}}) {{/minimum}}{{#maximum}}@Max(value = {{.}}L{{#vendorExtensions.x-maximum-message}}, message = "{{vendorExtensions.x-maximum-message}}"{{/vendorExtensions.x-maximum-message}}) {{/maximum}}{{/isLong}}{{! Not Integer, not Long => we have a decimal value! -}}{{^isInteger}}{{^isLong}}{{#minimum}}@DecimalMin({{#exclusiveMinimum}}value = {{/exclusiveMinimum}}"{{minimum}}"{{#exclusiveMinimum}}, inclusive = false{{/exclusiveMinimum}}) {{/minimum}}{{#maximum}}@DecimalMax({{#exclusiveMaximum}}value = {{/exclusiveMaximum}}"{{maximum}}"{{#exclusiveMaximum}}, inclusive = false{{/exclusiveMaximum}}) {{/maximum}}{{/isLong}}{{/isInteger}}{{/isUuid}} \ No newline at end of file +}}{{^isInteger}}{{^isLong}}{{#minimum}}@DecimalMin(value = "{{minimum}}"{{#exclusiveMinimum}}, inclusive = false{{/exclusiveMinimum}}{{#vendorExtensions.x-minimum-message}}, message = "{{vendorExtensions.x-minimum-message}}"{{/vendorExtensions.x-minimum-message}}) {{/minimum}}{{#maximum}}@DecimalMax(value = "{{maximum}}"{{#exclusiveMaximum}}, inclusive = false{{/exclusiveMaximum}}{{#vendorExtensions.x-maximum-message}}, message = "{{vendorExtensions.x-maximum-message}}"{{/vendorExtensions.x-maximum-message}}) {{/maximum}}{{/isLong}}{{/isInteger}}{{/isUuid}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationCore.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationCore.mustache index 8eb9029b9809..e98d012caddf 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationCore.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationCore.mustache @@ -1,22 +1,22 @@ {{#isEmail}}@Email {{/isEmail}}{{! pattern set -}}{{#pattern}}@Pattern(regexp="{{{.}}}") {{/pattern}}{{! +}}{{#pattern}}@Pattern(regexp="{{{.}}}"{{#vendorExtensions.x-pattern-message}}, message="{{vendorExtensions.x-pattern-message}}"{{/vendorExtensions.x-pattern-message}}) {{/pattern}}{{! minLength && maxLength set -}}{{#minLength}}{{#maxLength}}@Size(min={{minLength}},max={{maxLength}}) {{/maxLength}}{{/minLength}}{{! +}}{{#minLength}}{{#maxLength}}@Size(min={{minLength}},max={{maxLength}}{{#vendorExtensions.x-size-message}}, message="{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxLength}}{{/minLength}}{{! minLength set, maxLength not -}}{{#minLength}}{{^maxLength}}@Size(min={{minLength}}) {{/maxLength}}{{/minLength}}{{! +}}{{#minLength}}{{^maxLength}}@Size(min={{minLength}}{{#vendorExtensions.x-size-message}}, message="{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxLength}}{{/minLength}}{{! minLength not set, maxLength set -}}{{^minLength}}{{#maxLength}}@Size(max={{.}}) {{/maxLength}}{{/minLength}}{{! +}}{{^minLength}}{{#maxLength}}@Size(max={{.}}{{#vendorExtensions.x-size-message}}, message="{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxLength}}{{/minLength}}{{! @Size: minItems && maxItems set -}}{{#minItems}}{{#maxItems}}@Size(min={{minItems}},max={{maxItems}}) {{/maxItems}}{{/minItems}}{{! +}}{{#minItems}}{{#maxItems}}@Size(min={{minItems}},max={{maxItems}}{{#vendorExtensions.x-size-message}}, message="{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxItems}}{{/minItems}}{{! @Size: minItems set, maxItems not -}}{{#minItems}}{{^maxItems}}@Size(min={{minItems}}) {{/maxItems}}{{/minItems}}{{! +}}{{#minItems}}{{^maxItems}}@Size(min={{minItems}}{{#vendorExtensions.x-size-message}}, message="{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxItems}}{{/minItems}}{{! @Size: minItems not set && maxItems set -}}{{^minItems}}{{#maxItems}}@Size(max={{.}}) {{/maxItems}}{{/minItems}}{{! +}}{{^minItems}}{{#maxItems}}@Size(max={{.}}{{#vendorExtensions.x-size-message}}, message="{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxItems}}{{/minItems}}{{! check for integer or long / all others=decimal type with @Decimal* isInteger set -}}{{#isInteger}}{{#minimum}}@Min({{.}}){{/minimum}}{{#maximum}} @Max({{.}}) {{/maximum}}{{/isInteger}}{{! +}}{{#isInteger}}{{#minimum}}@Min(value={{.}}{{#vendorExtensions.x-minimum-message}}, message="{{vendorExtensions.x-minimum-message}}"{{/vendorExtensions.x-minimum-message}}){{/minimum}}{{#maximum}} @Max(value={{.}}{{#vendorExtensions.x-maximum-message}}, message="{{vendorExtensions.x-maximum-message}}"{{/vendorExtensions.x-maximum-message}}) {{/maximum}}{{/isInteger}}{{! isLong set -}}{{#isLong}}{{#minimum}}@Min({{.}}L){{/minimum}}{{#maximum}} @Max({{.}}L) {{/maximum}}{{/isLong}}{{! +}}{{#isLong}}{{#minimum}}@Min(value={{.}}L{{#vendorExtensions.x-minimum-message}}, message="{{vendorExtensions.x-minimum-message}}"{{/vendorExtensions.x-minimum-message}}){{/minimum}}{{#maximum}} @Max(value={{.}}L{{#vendorExtensions.x-maximum-message}}, message="{{vendorExtensions.x-maximum-message}}"{{/vendorExtensions.x-maximum-message}}) {{/maximum}}{{/isLong}}{{! Not Integer, not Long => we have a decimal value! -}}{{^isInteger}}{{^isLong}}{{#minimum}}@DecimalMin("{{.}}"){{/minimum}}{{#maximum}} @DecimalMax("{{.}}") {{/maximum}}{{/isLong}}{{/isInteger}} \ No newline at end of file +}}{{^isInteger}}{{^isLong}}{{#minimum}}@DecimalMin(value="{{.}}"{{#vendorExtensions.x-minimum-message}}, message="{{vendorExtensions.x-minimum-message}}"{{/vendorExtensions.x-minimum-message}}){{/minimum}}{{#maximum}} @DecimalMax(value="{{.}}"{{#vendorExtensions.x-maximum-message}}, message="{{vendorExtensions.x-maximum-message}}"{{/vendorExtensions.x-maximum-message}}) {{/maximum}}{{/isLong}}{{/isInteger}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationModel.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationModel.mustache index 583ee37f90e0..13e661bc5075 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationModel.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationModel.mustache @@ -7,32 +7,32 @@ pattern set @get:Pattern(regexp="{{{pattern}}}"{{#vendorExtensions.x-pattern-message}}, message="{{vendorExtensions.x-pattern-message}}"{{/vendorExtensions.x-pattern-message}}){{/pattern}}{{! minLength && maxLength set }}{{#minLength}}{{#maxLength}} - @get:Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! + @get:Size(min={{minLength}},max={{maxLength}}{{#vendorExtensions.x-size-message}}, message="{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}){{/maxLength}}{{/minLength}}{{! minLength set, maxLength not }}{{#minLength}}{{^maxLength}} - @get:Size(min={{minLength}}){{/maxLength}}{{/minLength}}{{! + @get:Size(min={{minLength}}{{#vendorExtensions.x-size-message}}, message="{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}){{/maxLength}}{{/minLength}}{{! minLength not set, maxLength set }}{{^minLength}}{{#maxLength}} - @get:Size(max={{.}}){{/maxLength}}{{/minLength}}{{! + @get:Size(max={{.}}{{#vendorExtensions.x-size-message}}, message="{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}){{/maxLength}}{{/minLength}}{{! @Size: minItems && maxItems set }}{{#minItems}}{{#maxItems}} - @get:Size(min={{minItems}},max={{maxItems}}) {{/maxItems}}{{/minItems}}{{! + @get:Size(min={{minItems}},max={{maxItems}}{{#vendorExtensions.x-size-message}}, message="{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}) {{/maxItems}}{{/minItems}}{{! @Size: minItems set, maxItems not }}{{#minItems}}{{^maxItems}} - @get:Size(min={{minItems}}){{/maxItems}}{{/minItems}}{{! + @get:Size(min={{minItems}}{{#vendorExtensions.x-size-message}}, message="{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}){{/maxItems}}{{/minItems}}{{! @Size: minItems not set && maxItems set }}{{^minItems}}{{#maxItems}} - @get:Size(max={{.}}){{/maxItems}}{{/minItems}}{{! + @get:Size(max={{.}}{{#vendorExtensions.x-size-message}}, message="{{vendorExtensions.x-size-message}}"{{/vendorExtensions.x-size-message}}){{/maxItems}}{{/minItems}}{{! check for integer or long / all others=decimal type with @Decimal* isInteger set }}{{#isInteger}}{{#minimum}} - @get:Min({{.}}){{/minimum}}{{#maximum}} - @get:Max({{.}}){{/maximum}}{{/isInteger}}{{! + @get:Min(value={{.}}{{#vendorExtensions.x-minimum-message}}, message="{{vendorExtensions.x-minimum-message}}"{{/vendorExtensions.x-minimum-message}}){{/minimum}}{{#maximum}} + @get:Max(value={{.}}{{#vendorExtensions.x-maximum-message}}, message="{{vendorExtensions.x-maximum-message}}"{{/vendorExtensions.x-maximum-message}}){{/maximum}}{{/isInteger}}{{! isLong set }}{{#isLong}}{{#minimum}} - @get:Min({{.}}L){{/minimum}}{{#maximum}} - @get:Max({{.}}L){{/maximum}}{{/isLong}}{{! + @get:Min(value={{.}}L{{#vendorExtensions.x-minimum-message}}, message="{{vendorExtensions.x-minimum-message}}"{{/vendorExtensions.x-minimum-message}}){{/minimum}}{{#maximum}} + @get:Max(value={{.}}L{{#vendorExtensions.x-maximum-message}}, message="{{vendorExtensions.x-maximum-message}}"{{/vendorExtensions.x-maximum-message}}){{/maximum}}{{/isLong}}{{! Not Integer, not Long => we have a decimal value! }}{{^isInteger}}{{^isLong}}{{#minimum}} - @get:DecimalMin("{{.}}"){{/minimum}}{{#maximum}} - @get:DecimalMax("{{.}}"){{/maximum}}{{/isLong}}{{/isInteger}} \ No newline at end of file + @get:DecimalMin(value="{{.}}"{{#vendorExtensions.x-minimum-message}}, message="{{vendorExtensions.x-minimum-message}}"{{/vendorExtensions.x-minimum-message}}){{/minimum}}{{#maximum}} + @get:DecimalMax(value="{{.}}"{{#vendorExtensions.x-maximum-message}}, message="{{vendorExtensions.x-maximum-message}}"{{/vendorExtensions.x-maximum-message}}){{/maximum}}{{/isLong}}{{/isInteger}} \ No newline at end of file diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/AbstractAnnotationsAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/AbstractAnnotationsAssert.java index fef36947d8d1..2275945f64c9 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/AbstractAnnotationsAssert.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/AbstractAnnotationsAssert.java @@ -50,7 +50,7 @@ public ACTUAL containsWithNameAndAttributes(final String name, final Map attributes) { + public ACTUAL containsWithNameAndDoesNotContainAttributes(final String name, final List attributes) { super .withFailMessage("Should have annotation with name: " + name + " and no attributes: " + attributes + ", but was: " + actual) .anyMatch(annotation -> annotation.getNameAsString().equals(name) && hasNotAttributes(annotation, attributes)); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java index a45c7a8e97e3..e9b28d9a65a7 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java @@ -3758,22 +3758,22 @@ public void testModelsWithNoneOptionalAndJsonNullable() throws IOException { .withType("JsonNullable<@Size(max = 1) String>") .toType() .assertProperty("intMinMaxNullable") - .withType("JsonNullable<@Min(1) @Max(10) Integer>") + .withType("JsonNullable<@Min(value = 1) @Max(value = 10) Integer>") .toType() .assertProperty("intMinNullable") - .withType("JsonNullable<@Min(1) Integer>") + .withType("JsonNullable<@Min(value = 1) Integer>") .toType() .assertProperty("intMaxNullable") - .withType("JsonNullable<@Max(10) Integer>") + .withType("JsonNullable<@Max(value = 10) Integer>") .toType() .assertProperty("numberMinMaxNullable") - .withType("JsonNullable<@DecimalMin(\"1\") @DecimalMax(\"10\") BigDecimal>") + .withType("JsonNullable<@DecimalMin(value = \"1\") @DecimalMax(value = \"10\") BigDecimal>") .toType() .assertProperty("numberMinNullable") - .withType("JsonNullable<@DecimalMin(\"1\") BigDecimal>") + .withType("JsonNullable<@DecimalMin(value = \"1\") BigDecimal>") .toType() .assertProperty("numberMaxNullable") - .withType("JsonNullable<@DecimalMax(\"10\") BigDecimal>") + .withType("JsonNullable<@DecimalMax(value = \"10\") BigDecimal>") .toType() .assertProperty("stringDefaultNullable") .withType("JsonNullable<@Size(max = 1) String>") @@ -3862,12 +3862,12 @@ public void testModelsWithNoneOptionalAndJsonNullable() throws IOException { assertJsonNullableMethod(javaFileAssert, String.class, "stringMinLengthNullable", "JsonNullable<@Size(min = 1) String>"); assertJsonNullableMethod(javaFileAssert, String.class, "stringMaxLengthNullable", "JsonNullable<@Size(max = 1) String>"); assertJsonNullableMethod(javaFileAssert, String.class, "stringEmailNullable", "JsonNullable<@jakarta.validation.constraints.Email String>"); - assertJsonNullableMethod(javaFileAssert, Integer.class, "intMinMaxNullable", "JsonNullable<@Min(1) @Max(10) Integer>"); - assertJsonNullableMethod(javaFileAssert, Integer.class, "intMinNullable", "JsonNullable<@Min(1) Integer>"); - assertJsonNullableMethod(javaFileAssert, Integer.class, "intMaxNullable", "JsonNullable<@Max(10) Integer>"); - assertJsonNullableMethod(javaFileAssert, BigDecimal.class, "numberMinMaxNullable", "JsonNullable<@DecimalMin(\"1\") @DecimalMax(\"10\") BigDecimal>"); - assertJsonNullableMethod(javaFileAssert, BigDecimal.class, "numberMinNullable", "JsonNullable<@DecimalMin(\"1\") BigDecimal>"); - assertJsonNullableMethod(javaFileAssert, BigDecimal.class, "numberMaxNullable", "JsonNullable<@DecimalMax(\"10\") BigDecimal>"); + assertJsonNullableMethod(javaFileAssert, Integer.class, "intMinMaxNullable", "JsonNullable<@Min(value = 1) @Max(value = 10) Integer>"); + assertJsonNullableMethod(javaFileAssert, Integer.class, "intMinNullable", "JsonNullable<@Min(value = 1) Integer>"); + assertJsonNullableMethod(javaFileAssert, Integer.class, "intMaxNullable", "JsonNullable<@Max(value = 10) Integer>"); + assertJsonNullableMethod(javaFileAssert, BigDecimal.class, "numberMinMaxNullable", "JsonNullable<@DecimalMin(value = \"1\") @DecimalMax(value = \"10\") BigDecimal>"); + assertJsonNullableMethod(javaFileAssert, BigDecimal.class, "numberMinNullable", "JsonNullable<@DecimalMin(value = \"1\") BigDecimal>"); + assertJsonNullableMethod(javaFileAssert, BigDecimal.class, "numberMaxNullable", "JsonNullable<@DecimalMax(value = \"10\") BigDecimal>"); } @@ -3936,22 +3936,22 @@ public void testModelsWithOptionalAndJsonNullable() throws IOException { .withType("Optional<@jakarta.validation.constraints.Email String>") .toType() .assertProperty("intMinMax") - .withType("Optional<@Min(1) @Max(10) Integer>") + .withType("Optional<@Min(value = 1) @Max(value = 10) Integer>") .toType() .assertProperty("intMin") - .withType("Optional<@Min(1) Integer>") + .withType("Optional<@Min(value = 1) Integer>") .toType() .assertProperty("intMax") - .withType("Optional<@Max(10) Integer>") + .withType("Optional<@Max(value = 10) Integer>") .toType() .assertProperty("numberMinMax") - .withType("Optional<@DecimalMin(\"1\") @DecimalMax(\"10\") BigDecimal>") + .withType("Optional<@DecimalMin(value = \"1\") @DecimalMax(value = \"10\") BigDecimal>") .toType() .assertProperty("numberMin") - .withType("Optional<@DecimalMin(\"1\") BigDecimal>") + .withType("Optional<@DecimalMin(value = \"1\") BigDecimal>") .toType() .assertProperty("numberMax") - .withType("Optional<@DecimalMax(\"10\") BigDecimal>") + .withType("Optional<@DecimalMax(value = \"10\") BigDecimal>") .toType() .assertProperty("stringDefault") .withType("Optional<@Size(max = 1) String>") @@ -3974,22 +3974,22 @@ public void testModelsWithOptionalAndJsonNullable() throws IOException { .withType("JsonNullable<@Size(max = 1) String>") .toType() .assertProperty("intMinMaxNullable") - .withType("JsonNullable<@Min(1) @Max(10) Integer>") + .withType("JsonNullable<@Min(value = 1) @Max(value = 10) Integer>") .toType() .assertProperty("intMinNullable") - .withType("JsonNullable<@Min(1) Integer>") + .withType("JsonNullable<@Min(value = 1) Integer>") .toType() .assertProperty("intMaxNullable") - .withType("JsonNullable<@Max(10) Integer>") + .withType("JsonNullable<@Max(value = 10) Integer>") .toType() .assertProperty("numberMinMaxNullable") - .withType("JsonNullable<@DecimalMin(\"1\") @DecimalMax(\"10\") BigDecimal>") + .withType("JsonNullable<@DecimalMin(value = \"1\") @DecimalMax(value = \"10\") BigDecimal>") .toType() .assertProperty("numberMinNullable") - .withType("JsonNullable<@DecimalMin(\"1\") BigDecimal>") + .withType("JsonNullable<@DecimalMin(value = \"1\") BigDecimal>") .toType() .assertProperty("numberMaxNullable") - .withType("JsonNullable<@DecimalMax(\"10\") BigDecimal>") + .withType("JsonNullable<@DecimalMax(value = \"10\") BigDecimal>") .toType() .assertProperty("stringDefaultNullable") .withType("JsonNullable<@Size(max = 1) String>") @@ -4065,12 +4065,12 @@ public void testModelsWithOptionalAndJsonNullable() throws IOException { assertOptionalMethod(javaFileAssert, String.class, "stringMinLength", "Optional<@Size(min = 1) String>"); assertOptionalMethod(javaFileAssert, String.class, "stringMaxLength", "Optional<@Size(max = 1) String>"); assertOptionalMethod(javaFileAssert, String.class, "stringEmail", "Optional<@jakarta.validation.constraints.Email String>"); - assertOptionalMethod(javaFileAssert, Integer.class, "intMinMax", "Optional<@Min(1) @Max(10) Integer>"); - assertOptionalMethod(javaFileAssert, Integer.class, "intMin", "Optional<@Min(1) Integer>"); - assertOptionalMethod(javaFileAssert, Integer.class, "intMax", "Optional<@Max(10) Integer>"); - assertOptionalMethod(javaFileAssert, BigDecimal.class, "numberMinMax", "Optional<@DecimalMin(\"1\") @DecimalMax(\"10\") BigDecimal>"); - assertOptionalMethod(javaFileAssert, BigDecimal.class, "numberMin", "Optional<@DecimalMin(\"1\") BigDecimal>"); - assertOptionalMethod(javaFileAssert, BigDecimal.class, "numberMax", "Optional<@DecimalMax(\"10\") BigDecimal>"); + assertOptionalMethod(javaFileAssert, Integer.class, "intMinMax", "Optional<@Min(value = 1) @Max(value = 10) Integer>"); + assertOptionalMethod(javaFileAssert, Integer.class, "intMin", "Optional<@Min(value = 1) Integer>"); + assertOptionalMethod(javaFileAssert, Integer.class, "intMax", "Optional<@Max(value = 10) Integer>"); + assertOptionalMethod(javaFileAssert, BigDecimal.class, "numberMinMax", "Optional<@DecimalMin(value = \"1\") @DecimalMax(value = \"10\") BigDecimal>"); + assertOptionalMethod(javaFileAssert, BigDecimal.class, "numberMin", "Optional<@DecimalMin(value = \"1\") BigDecimal>"); + assertOptionalMethod(javaFileAssert, BigDecimal.class, "numberMax", "Optional<@DecimalMax(value = \"10\") BigDecimal>"); assertOptionalMethod(javaFileAssert, "Zebra", "zebra", "Optional"); assertJsonNullableMethod(javaFileAssert, String.class, "stringPatternNullable", "JsonNullable<@Pattern(regexp = \"[a-z]\") String>"); @@ -4078,12 +4078,12 @@ public void testModelsWithOptionalAndJsonNullable() throws IOException { assertJsonNullableMethod(javaFileAssert, String.class, "stringMinLengthNullable", "JsonNullable<@Size(min = 1) String>"); assertJsonNullableMethod(javaFileAssert, String.class, "stringMaxLengthNullable", "JsonNullable<@Size(max = 1) String>"); assertJsonNullableMethod(javaFileAssert, String.class, "stringEmailNullable", "JsonNullable<@jakarta.validation.constraints.Email String>"); - assertJsonNullableMethod(javaFileAssert, Integer.class, "intMinMaxNullable", "JsonNullable<@Min(1) @Max(10) Integer>"); - assertJsonNullableMethod(javaFileAssert, Integer.class, "intMinNullable", "JsonNullable<@Min(1) Integer>"); - assertJsonNullableMethod(javaFileAssert, Integer.class, "intMaxNullable", "JsonNullable<@Max(10) Integer>"); - assertJsonNullableMethod(javaFileAssert, BigDecimal.class, "numberMinMaxNullable", "JsonNullable<@DecimalMin(\"1\") @DecimalMax(\"10\") BigDecimal>"); - assertJsonNullableMethod(javaFileAssert, BigDecimal.class, "numberMinNullable", "JsonNullable<@DecimalMin(\"1\") BigDecimal>"); - assertJsonNullableMethod(javaFileAssert, BigDecimal.class, "numberMaxNullable", "JsonNullable<@DecimalMax(\"10\") BigDecimal>"); + assertJsonNullableMethod(javaFileAssert, Integer.class, "intMinMaxNullable", "JsonNullable<@Min(value = 1) @Max(value = 10) Integer>"); + assertJsonNullableMethod(javaFileAssert, Integer.class, "intMinNullable", "JsonNullable<@Min(value = 1) Integer>"); + assertJsonNullableMethod(javaFileAssert, Integer.class, "intMaxNullable", "JsonNullable<@Max(value = 10) Integer>"); + assertJsonNullableMethod(javaFileAssert, BigDecimal.class, "numberMinMaxNullable", "JsonNullable<@DecimalMin(value = \"1\") @DecimalMax(value = \"10\") BigDecimal>"); + assertJsonNullableMethod(javaFileAssert, BigDecimal.class, "numberMinNullable", "JsonNullable<@DecimalMin(value = \"1\") BigDecimal>"); + assertJsonNullableMethod(javaFileAssert, BigDecimal.class, "numberMaxNullable", "JsonNullable<@DecimalMax(value = \"10\") BigDecimal>"); } @@ -5757,6 +5757,318 @@ public void testApiVersion() throws IOException { .assertMethod("getNones") .assertMethodAnnotations() - .containsWithNameAndDoesContainAttributes("RequestMapping", List.of("version")); + .containsWithNameAndDoesNotContainAttributes("RequestMapping", List.of("version")); + } + + @Test + public void testXSizeMessage_length() throws IOException { + final Map files = generateFromContract("src/test/resources/3_0/error-message-for-size-max-min.yaml", SPRING_BOOT); + JavaFileAssert.assertThat(files.get("TestApi.java")) + .assertMethod("lengthTest") + .assertParameter("word") + .assertParameterAnnotations() + .containsWithNameAndAttributes("Size", ImmutableMap.of( + "max", "10", + "message", "\"Must be max 10 characters\"" + )) + .toParameter() + .toMethod() + .assertParameter("token") + .assertParameterAnnotations() + .containsWithNameAndAttributes("Size", ImmutableMap.of( + "min", "1", + "message", "\"Must not be empty\"" + )) + .toParameter() + .toMethod() + .assertParameter("clientId") + .assertParameterAnnotations() + .containsWithNameAndAttributes("Size", ImmutableMap.of( + "min", "3", + "max", "5", + "message", "\"Must be between 3 and 5 characters\"" + )); + JavaFileAssert.assertThat(files.get("LengthTest.java")) + .assertMethod("getField1") + .assertMethodAnnotations() + .containsWithNameAndAttributes("Size", ImmutableMap.of( + "max", "10", + "message", "\"Must be max 10 characters\"" + )) + .toMethod() + .toFileAssert() + .assertMethod("getField2") + .assertMethodAnnotations() + .containsWithNameAndAttributes("Size", ImmutableMap.of( + "min", "1", + "message", "\"Must not be empty\"" + )) + .toMethod() + .toFileAssert() + .assertMethod("getField3") + .assertMethodAnnotations() + .containsWithNameAndAttributes("Size", ImmutableMap.of( + "min", "3", + "max", "5", + "message", "\"Must be between 3 and 5 characters\"" + )) + .toMethod() + .toFileAssert() + .assertMethod("getField4") + .assertMethodAnnotations() + .containsWithNameAndDoesNotContainAttributes("Size", List.of("message")) + .toMethod() + .toFileAssert() + .assertMethod("getField5") + .assertMethodAnnotations() + .containsWithNameAndDoesNotContainAttributes("Size", List.of("message")) + .toMethod() + .toFileAssert() + .assertMethod("getField6") + .assertMethodAnnotations() + .containsWithNameAndDoesNotContainAttributes("Size", List.of("message")); + } + + @Test + public void testXSizeMessage_size() throws IOException { + final Map files = generateFromContract("src/test/resources/3_0/error-message-for-size-max-min.yaml", SPRING_BOOT); + JavaFileAssert.assertThat(files.get("TestApi.java")) + .assertMethod("sizeTest") + .assertParameter("values") + .assertParameterAnnotations() + .containsWithNameAndAttributes("Size", ImmutableMap.of( + "max", "10", + "message", "\"Must be max 10 elements\"" + )) + .toParameter() + .toMethod() + .assertParameter("tokens") + .assertParameterAnnotations() + .containsWithNameAndAttributes("Size", ImmutableMap.of( + "min", "1", + "message", "\"Must not be empty\"" + )) + .toParameter() + .toMethod() + .assertParameter("clientIds") + .assertParameterAnnotations() + .containsWithNameAndAttributes("Size", ImmutableMap.of( + "min", "3", + "max", "5", + "message", "\"Must be between 3 and 5 elements\"" + )); + JavaFileAssert.assertThat(files.get("SizeTest.java")) + .assertMethod("getField1") + .assertMethodAnnotations() + .containsWithNameAndAttributes("Size", ImmutableMap.of( + "max", "10", + "message", "\"Must be max 10 elements\"" + )) + .toMethod() + .toFileAssert() + .assertMethod("getField2") + .assertMethodAnnotations() + .containsWithNameAndAttributes("Size", ImmutableMap.of( + "min", "1", + "message", "\"Must not be empty\"" + )) + .toMethod() + .toFileAssert() + .assertMethod("getField3") + .assertMethodAnnotations() + .containsWithNameAndAttributes("Size", ImmutableMap.of( + "min", "3", + "max", "5", + "message", "\"Must be between 3 and 5 elements\"" + )) + .toMethod() + .toFileAssert() + .assertMethod("getField4") + .assertMethodAnnotations() + .containsWithNameAndDoesNotContainAttributes("Size", List.of("message")) + .toMethod() + .toFileAssert() + .assertMethod("getField5") + .assertMethodAnnotations() + .containsWithNameAndDoesNotContainAttributes("Size", List.of("message")) + .toMethod() + .toFileAssert() + .assertMethod("getField6") + .assertMethodAnnotations() + .containsWithNameAndDoesNotContainAttributes("Size", List.of("message")); + } + + @Test + public void testXMinimumMessageAndXMaximumMessage_decimal() throws IOException { + final Map files = generateFromContract("src/test/resources/3_0/error-message-for-size-max-min.yaml", SPRING_BOOT); + JavaFileAssert.assertThat(files.get("TestApi.java")) + .assertMethod("minmaxNumberTest") + .assertParameter("number") + .assertParameterAnnotations() + .containsWithNameAndAttributes("DecimalMin", ImmutableMap.of( + "value", "\"0.1\"", + "message", "\"Must be positive\"" + )) + .containsWithNameAndAttributes("DecimalMax", ImmutableMap.of( + "value", "\"99.9\"", + "message", "\"Must be less than 100\"" + )) + .toParameter() + .toMethod() + .assertParameter("token") + .assertParameterAnnotations() + .containsWithNameAndAttributes("DecimalMin", ImmutableMap.of( + "value", "\"0.1\"", + "message", "\"Must be positive\"" + )) + .containsWithNameAndAttributes("DecimalMax", ImmutableMap.of( + "value", "\"99.9\"", + "message", "\"Must be less than 100\"" + )) + .toParameter() + .toMethod() + .assertParameter("clientNumber") + .assertParameterAnnotations() + .containsWithNameAndAttributes("DecimalMin", ImmutableMap.of( + "value", "\"0.1\"", + "message", "\"Must be positive\"" + )) + .containsWithNameAndAttributes("DecimalMax", ImmutableMap.of( + "value", "\"99.9\"", + "message", "\"Must be less than 100\"" + )); + JavaFileAssert.assertThat(files.get("NumberTest.java")) + .assertMethod("getField1") + .assertMethodAnnotations() + .containsWithNameAndAttributes("DecimalMin", ImmutableMap.of( + "value", "\"0.1\"", + "message", "\"Must be positive\"" + )) + .containsWithNameAndAttributes("DecimalMax", ImmutableMap.of( + "value", "\"99.9\"", + "message", "\"Must be less than 100\"" + )) + .toMethod() + .toFileAssert() + .assertMethod("getField2") + .assertMethodAnnotations() + .containsWithNameAndDoesNotContainAttributes("DecimalMin", List.of("message")) + .containsWithNameAndDoesNotContainAttributes("DecimalMax", List.of("message")); + } + + @Test + public void testXMinimumMessageAndXMaximumMessage_integer() throws IOException { + final Map files = generateFromContract("src/test/resources/3_0/error-message-for-size-max-min.yaml", SPRING_BOOT); + JavaFileAssert.assertThat(files.get("TestApi.java")) + .assertMethod("minmaxIntegerTest") + .assertParameter("number") + .assertParameterAnnotations() + .containsWithNameAndAttributes("Min", ImmutableMap.of( + "value", "1", + "message", "\"Must be positive\"" + )) + .containsWithNameAndAttributes("Max", ImmutableMap.of( + "value", "99", + "message", "\"Must be less than 100\"" + )) + .toParameter() + .toMethod() + .assertParameter("token") + .assertParameterAnnotations() + .containsWithNameAndAttributes("Min", ImmutableMap.of( + "value", "1", + "message", "\"Must be positive\"" + )) + .containsWithNameAndAttributes("Max", ImmutableMap.of( + "value", "99", + "message", "\"Must be less than 100\"" + )) + .toParameter() + .toMethod() + .assertParameter("clientNumber") + .assertParameterAnnotations() + .containsWithNameAndAttributes("Min", ImmutableMap.of( + "value", "1", + "message", "\"Must be positive\"" + )) + .containsWithNameAndAttributes("Max", ImmutableMap.of( + "value", "99", + "message", "\"Must be less than 100\"" + )); + JavaFileAssert.assertThat(files.get("IntegerTest.java")) + .assertMethod("getField1") + .assertMethodAnnotations() + .containsWithNameAndAttributes("Min", ImmutableMap.of( + "value", "1", + "message", "\"Must be positive\"" + )) + .containsWithNameAndAttributes("Max", ImmutableMap.of( + "value", "99", + "message", "\"Must be less than 100\"" + )) + .toMethod() + .toFileAssert() + .assertMethod("getField2") + .assertMethodAnnotations() + .containsWithNameAndDoesNotContainAttributes("Min", List.of("message")) + .containsWithNameAndDoesNotContainAttributes("Max", List.of("message")); + } + + @Test + public void testXMinimumMessageAndXMaximumMessage_long() throws IOException { + final Map files = generateFromContract("src/test/resources/3_0/error-message-for-size-max-min.yaml", SPRING_BOOT); + JavaFileAssert.assertThat(files.get("TestApi.java")) + .assertMethod("minmaxLongTest") + .assertParameter("number") + .assertParameterAnnotations() + .containsWithNameAndAttributes("Min", ImmutableMap.of( + "value", "1L", + "message", "\"Must be positive\"" + )) + .containsWithNameAndAttributes("Max", ImmutableMap.of( + "value", "99L", + "message", "\"Must be less than 100\"" + )) + .toParameter() + .toMethod() + .assertParameter("token") + .assertParameterAnnotations() + .containsWithNameAndAttributes("Min", ImmutableMap.of( + "value", "1L", + "message", "\"Must be positive\"" + )) + .containsWithNameAndAttributes("Max", ImmutableMap.of( + "value", "99L", + "message", "\"Must be less than 100\"" + )) + .toParameter() + .toMethod() + .assertParameter("clientNumber") + .assertParameterAnnotations() + .containsWithNameAndAttributes("Min", ImmutableMap.of( + "value", "1L", + "message", "\"Must be positive\"" + )) + .containsWithNameAndAttributes("Max", ImmutableMap.of( + "value", "99L", + "message", "\"Must be less than 100\"" + )); + JavaFileAssert.assertThat(files.get("LongTest.java")) + .assertMethod("getField1") + .assertMethodAnnotations() + .containsWithNameAndAttributes("Min", ImmutableMap.of( + "value", "1L", + "message", "\"Must be positive\"" + )) + .containsWithNameAndAttributes("Max", ImmutableMap.of( + "value", "99L", + "message", "\"Must be less than 100\"" + )) + .toMethod() + .toFileAssert() + .assertMethod("getField2") + .assertMethodAnnotations() + .containsWithNameAndDoesNotContainAttributes("Min", List.of("message")) + .containsWithNameAndDoesNotContainAttributes("Max", List.of("message")); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/AbstractAnnotationAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/AbstractAnnotationAssert.java new file mode 100644 index 000000000000..3d1316f7010f --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/AbstractAnnotationAssert.java @@ -0,0 +1,45 @@ +package org.openapitools.codegen.kotlin.assertions; + +import org.assertj.core.api.AbstractAssert; +import org.assertj.core.api.Assertions; +import org.assertj.core.util.CanIgnoreReturnValue; +import org.jetbrains.kotlin.psi.KtAnnotationEntry; + +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +@CanIgnoreReturnValue +abstract class AbstractAnnotationAssert> extends AbstractAssert { + + AbstractAnnotationAssert(final KtAnnotationEntry annotationEntry, final Class selfType) { + super(annotationEntry, selfType); + } + + public SELF hasAttributes(final Map expectedAttributes) { + final Map actualAttributes = actual.getValueArguments().stream() + .collect(Collectors.toMap( + a -> a.getArgumentName() != null ? a.getArgumentName().getAsName().asString() : null, + a -> a.getArgumentExpression() != null ? a.getArgumentExpression().getText() : null + )); + final boolean allAttributesFound = expectedAttributes.entrySet().stream() + .allMatch(expected -> Objects.equals(actualAttributes.get(expected.getKey()), expected.getValue())); + Assertions.assertThat(allAttributesFound) + .withFailMessage("Expected annotation to have attributes %s, but has %s", expectedAttributes, actualAttributes) + .isTrue(); + + return myself; + } + + public SELF hasNotAttributes(final List notExpectedAttributes) { + final List actualAttributes = actual.getValueArguments().stream() + .map(a -> a.getArgumentName() != null ? a.getArgumentName().getAsName().asString() : null) + .collect(Collectors.toList()); + Assertions.assertThat(actualAttributes) + .withFailMessage("Expected annotation to not have attributes %s, but has %s", notExpectedAttributes, actualAttributes) + .noneMatch(notExpectedAttributes::contains); + + return myself; + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/ClassAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/ClassAssert.java new file mode 100644 index 000000000000..71bc54ed7432 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/ClassAssert.java @@ -0,0 +1,51 @@ +package org.openapitools.codegen.kotlin.assertions; + +import org.assertj.core.api.AbstractAssert; +import org.assertj.core.api.Assertions; +import org.assertj.core.util.CanIgnoreReturnValue; +import org.jetbrains.kotlin.psi.KtClass; +import org.jetbrains.kotlin.psi.KtNamedFunction; +import org.jetbrains.kotlin.psi.KtParameter; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +@CanIgnoreReturnValue +public class ClassAssert extends AbstractAssert { + private final KotlinFileAssert fileAssert; + + ClassAssert(final KotlinFileAssert fileAssert, final KtClass actual) { + super(actual, ClassAssert.class); + this.fileAssert = fileAssert; + } + + public MethodAssert assertMethod(final String methodName) { + Assertions.assertThat(actual.getBody()) + .withFailMessage("Expected class to have a body, but it was null") + .isNotNull(); + final List methods = actual.getBody().getFunctions().stream() + .filter(f -> Objects.equals(f.getName(), methodName)) + .collect(Collectors.toList()); + Assertions.assertThat(methods) + .withFailMessage("Expected class to have a single method %s, but found %s", methodName, methods.size()) + .hasSize(1); + + return new MethodAssert(this, methods.get(0)); + } + + public PrimaryConstructorParameterAssert assertPrimaryConstructorParameter(final String propertyName) { + final List parameters = actual.getPrimaryConstructorParameters().stream() + .filter(p -> Objects.equals(p.getName(), propertyName)) + .collect(Collectors.toList()); + Assertions.assertThat(parameters) + .withFailMessage("Expected class to have a single property %s, but found %s", propertyName, parameters.size()) + .hasSize(1); + + return new PrimaryConstructorParameterAssert(this, parameters.get(0)); + } + + public KotlinFileAssert toFile() { + return fileAssert; + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/KotlinFileAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/KotlinFileAssert.java new file mode 100644 index 000000000000..1ef32f09be98 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/KotlinFileAssert.java @@ -0,0 +1,52 @@ +package org.openapitools.codegen.kotlin.assertions; + +import org.assertj.core.api.AbstractAssert; +import org.assertj.core.api.Assertions; +import org.assertj.core.util.CanIgnoreReturnValue; +import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys; +import org.jetbrains.kotlin.cli.common.messages.MessageCollector; +import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles; +import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment; +import org.jetbrains.kotlin.com.intellij.openapi.util.Disposer; +import org.jetbrains.kotlin.com.intellij.openapi.vfs.VirtualFile; +import org.jetbrains.kotlin.com.intellij.openapi.vfs.local.CoreLocalFileSystem; +import org.jetbrains.kotlin.com.intellij.psi.PsiManager; +import org.jetbrains.kotlin.config.CompilerConfiguration; +import org.jetbrains.kotlin.psi.KtClass; +import org.jetbrains.kotlin.psi.KtFile; + +import java.io.File; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +@CanIgnoreReturnValue +public class KotlinFileAssert extends AbstractAssert { + + private KotlinFileAssert(final KtFile ktFile) { + super(ktFile, KotlinFileAssert.class); + } + + public static KotlinFileAssert assertThat(final File file) { + final CompilerConfiguration config = new CompilerConfiguration(); + config.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, MessageCollector.Companion.getNONE()); + final KotlinCoreEnvironment env = KotlinCoreEnvironment.createForProduction(Disposer.newDisposable(), config, EnvironmentConfigFiles.JVM_CONFIG_FILES); + final VirtualFile vFile = new CoreLocalFileSystem().findFileByIoFile(file); + Assertions.assertThat(vFile) + .withFailMessage("Expected file %s to exist but was not found", file.getAbsolutePath()) + .isNotNull(); + final KtFile ktFile = (KtFile) PsiManager.getInstance(env.getProject()).findFile(vFile); + return new KotlinFileAssert(ktFile); + } + + public ClassAssert assertClass(final String className) { + final List ktClasses = Arrays.stream(actual.findChildrenByClass(KtClass.class)) + .filter(clazz -> Objects.equals(clazz.getName(), className)).collect(Collectors.toList()); + Assertions.assertThat(ktClasses) + .withFailMessage("Expected file to have single class %s, but found %s", className, ktClasses.size()) + .hasSize(1); + + return new ClassAssert(this, ktClasses.get(0)); + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/MethodAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/MethodAssert.java new file mode 100644 index 000000000000..ed13a950bfed --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/MethodAssert.java @@ -0,0 +1,36 @@ +package org.openapitools.codegen.kotlin.assertions; + +import org.assertj.core.api.AbstractAssert; +import org.assertj.core.api.Assertions; +import org.assertj.core.util.CanIgnoreReturnValue; +import org.jetbrains.kotlin.psi.KtNamedFunction; +import org.jetbrains.kotlin.psi.KtParameter; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +@CanIgnoreReturnValue +public class MethodAssert extends AbstractAssert { + private final ClassAssert classAssert; + + MethodAssert(final ClassAssert classAssert, final KtNamedFunction method) { + super(method, MethodAssert.class); + this.classAssert = classAssert; + } + + public ParameterAssert assertParameter(final String parameterName) { + final List parameters = actual.getValueParameters().stream() + .filter(p -> Objects.equals(p.getName(), parameterName)) + .collect(Collectors.toList()); + Assertions.assertThat(parameters) + .withFailMessage("Expected class to have a single parameter %s, but found %s", parameterName, parameters.size()) + .hasSize(1); + + return new ParameterAssert(this, parameters.get(0)); + } + + public ClassAssert toClass() { + return classAssert; + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/ParameterAnnotationAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/ParameterAnnotationAssert.java new file mode 100644 index 000000000000..032187072a46 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/ParameterAnnotationAssert.java @@ -0,0 +1,18 @@ +package org.openapitools.codegen.kotlin.assertions; + +import org.assertj.core.util.CanIgnoreReturnValue; +import org.jetbrains.kotlin.psi.KtAnnotationEntry; + +@CanIgnoreReturnValue +public class ParameterAnnotationAssert extends AbstractAnnotationAssert { + private final ParameterAssert parameterAssert; + + ParameterAnnotationAssert(final ParameterAssert parameterAssert, final KtAnnotationEntry annotationEntry) { + super(annotationEntry, ParameterAnnotationAssert.class); + this.parameterAssert = parameterAssert; + } + + public ParameterAssert toParameter() { + return parameterAssert; + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/ParameterAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/ParameterAssert.java new file mode 100644 index 000000000000..4fae22049aef --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/ParameterAssert.java @@ -0,0 +1,36 @@ +package org.openapitools.codegen.kotlin.assertions; + +import org.assertj.core.api.AbstractAssert; +import org.assertj.core.api.Assertions; +import org.assertj.core.util.CanIgnoreReturnValue; +import org.jetbrains.kotlin.psi.KtAnnotationEntry; +import org.jetbrains.kotlin.psi.KtParameter; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +@CanIgnoreReturnValue +public class ParameterAssert extends AbstractAssert { + private final MethodAssert methodAssert; + + ParameterAssert(final MethodAssert methodAssert, final KtParameter parameter) { + super(parameter, ParameterAssert.class); + this.methodAssert = methodAssert; + } + + public ParameterAnnotationAssert assertParameterAnnotation(final String annotationName) { + final List annotations = actual.getAnnotationEntries().stream() + .filter(a -> Objects.equals(a.getShortName() != null ? a.getShortName().asString() : null, annotationName)) + .collect(Collectors.toList()); + Assertions.assertThat(annotations) + .withFailMessage("Expected parameter to have a single annotation %s, but found %s", annotationName, annotations.size()) + .hasSize(1); + + return new ParameterAnnotationAssert(this, annotations.get(0)); + } + + public MethodAssert toMethod() { + return methodAssert; + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/PrimaryConstructorParameterAnnotationAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/PrimaryConstructorParameterAnnotationAssert.java new file mode 100644 index 000000000000..6d1a714b42d2 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/PrimaryConstructorParameterAnnotationAssert.java @@ -0,0 +1,18 @@ +package org.openapitools.codegen.kotlin.assertions; + +import org.assertj.core.util.CanIgnoreReturnValue; +import org.jetbrains.kotlin.psi.KtAnnotationEntry; + +@CanIgnoreReturnValue +public class PrimaryConstructorParameterAnnotationAssert extends AbstractAnnotationAssert { + private final PrimaryConstructorParameterAssert parameterAssert; + + PrimaryConstructorParameterAnnotationAssert(final PrimaryConstructorParameterAssert parameterAssert, final KtAnnotationEntry annotationEntry) { + super(annotationEntry, PrimaryConstructorParameterAnnotationAssert.class); + this.parameterAssert = parameterAssert; + } + + public PrimaryConstructorParameterAssert toPrimaryConstructorParameter() { + return parameterAssert; + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/PrimaryConstructorParameterAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/PrimaryConstructorParameterAssert.java new file mode 100644 index 000000000000..cd8b1edb0a91 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/assertions/PrimaryConstructorParameterAssert.java @@ -0,0 +1,38 @@ +package org.openapitools.codegen.kotlin.assertions; + +import org.assertj.core.api.AbstractAssert; +import org.assertj.core.api.Assertions; +import org.assertj.core.util.CanIgnoreReturnValue; +import org.jetbrains.kotlin.psi.KtAnnotationEntry; +import org.jetbrains.kotlin.psi.KtParameter; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +@CanIgnoreReturnValue +public class PrimaryConstructorParameterAssert extends AbstractAssert { + private final ClassAssert classAssert; + + PrimaryConstructorParameterAssert(final ClassAssert classAssert, final KtParameter parameter) { + super(parameter, PrimaryConstructorParameterAssert.class); + this.classAssert = classAssert; + } + + public PrimaryConstructorParameterAnnotationAssert assertParameterAnnotation(final String annotationName, final String useSiteTarget) { + final List annotations = actual.getAnnotationEntries().stream() + .filter(a -> + Objects.equals(a.getShortName() != null ? a.getShortName().asString() : null, annotationName) + && Objects.equals(a.getUseSiteTarget() != null ? a.getUseSiteTarget().getText() : null, useSiteTarget)) + .collect(Collectors.toList()); + Assertions.assertThat(annotations) + .withFailMessage("Expected property to have a single annotation %s, but found %s", annotationName, annotations.size()) + .hasSize(1); + + return new PrimaryConstructorParameterAnnotationAssert(this, annotations.get(0)); + } + + public ClassAssert toClass() { + return classAssert; + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java index d036a1f94339..0ee3934eda0e 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java @@ -1,5 +1,6 @@ package org.openapitools.codegen.kotlin.spring; +import com.google.common.collect.ImmutableMap; import io.swagger.parser.OpenAPIParser; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.info.Info; @@ -17,6 +18,7 @@ import org.openapitools.codegen.TestUtils; import org.openapitools.codegen.config.CodegenConfigurator; import org.openapitools.codegen.kotlin.KotlinTestUtils; +import org.openapitools.codegen.kotlin.assertions.KotlinFileAssert; import org.openapitools.codegen.languages.KotlinSpringServerCodegen; import org.openapitools.codegen.languages.features.CXFServerFeatures; import org.openapitools.codegen.languages.features.DocumentationProviderFeatures; @@ -752,7 +754,7 @@ public void useBeanValidationGenerateAnnotationsForRequestBody() throws IOExcept assertFileContains( Paths.get(files.get("AddApi.kt").getAbsolutePath()), - "@Min(2)" + "@Min(value=2)" ); } @@ -1377,6 +1379,358 @@ public void testDocumentationAnnotationInPathParams_Issue17997( }); } + @Test + public void testXSizeMessage_length() throws IOException { + final Map files = generateFromContract("src/test/resources/3_0/error-message-for-size-max-min.yaml"); + KotlinFileAssert.assertThat(files.get("TestApiController.kt")) + .assertClass("TestApiController") + .assertMethod("lengthTest") + .assertParameter("word") + .assertParameterAnnotation("Size") + .hasAttributes(ImmutableMap.of( + "max", "10", + "message", "\"Must be max 10 characters\"" + )) + .toParameter() + .toMethod() + .assertParameter("token") + .assertParameterAnnotation("Size") + .hasAttributes(ImmutableMap.of( + "min", "1", + "message", "\"Must not be empty\"" + )) + .toParameter() + .toMethod() + .assertParameter("clientId") + .assertParameterAnnotation("Size") + .hasAttributes(ImmutableMap.of( + "min", "3", + "max", "5", + "message", "\"Must be between 3 and 5 characters\"" + )); + KotlinFileAssert.assertThat(files.get("LengthTest.kt")) + .assertClass("LengthTest") + .assertPrimaryConstructorParameter("field1") + .assertParameterAnnotation("Size", "get") + .hasAttributes(ImmutableMap.of( + "max", "10", + "message", "\"Must be max 10 characters\"" + )) + .toPrimaryConstructorParameter() + .toClass() + .assertPrimaryConstructorParameter("field2") + .assertParameterAnnotation("Size", "get") + .hasAttributes(ImmutableMap.of( + "min", "1", + "message", "\"Must not be empty\"" + )) + .toPrimaryConstructorParameter() + .toClass() + .assertPrimaryConstructorParameter("field3") + .assertParameterAnnotation("Size", "get") + .hasAttributes(ImmutableMap.of( + "min", "3", + "max", "5", + "message", "\"Must be between 3 and 5 characters\"" + )) + .toPrimaryConstructorParameter() + .toClass() + .assertPrimaryConstructorParameter("field4") + .assertParameterAnnotation("Size", "get") + .hasNotAttributes(List.of("message")) + .toPrimaryConstructorParameter() + .toClass() + .assertPrimaryConstructorParameter("field5") + .assertParameterAnnotation("Size", "get") + .hasNotAttributes(List.of("message")) + .toPrimaryConstructorParameter() + .toClass() + .assertPrimaryConstructorParameter("field6") + .assertParameterAnnotation("Size", "get") + .hasNotAttributes(List.of("message")); + } + + @Test + public void testXSizeMessage_size() throws IOException { + final Map files = generateFromContract("src/test/resources/3_0/error-message-for-size-max-min.yaml"); + KotlinFileAssert.assertThat(files.get("TestApiController.kt")) + .assertClass("TestApiController") + .assertMethod("sizeTest") + .assertParameter("values") + .assertParameterAnnotation("Size") + .hasAttributes(ImmutableMap.of( + "max", "10", + "message", "\"Must be max 10 elements\"" + )) + .toParameter() + .toMethod() + .assertParameter("tokens") + .assertParameterAnnotation("Size") + .hasAttributes(ImmutableMap.of( + "min", "1", + "message", "\"Must not be empty\"" + )) + .toParameter() + .toMethod() + .assertParameter("clientIds") + .assertParameterAnnotation("Size") + .hasAttributes(ImmutableMap.of( + "min", "3", + "max", "5", + "message", "\"Must be between 3 and 5 elements\"" + )); + KotlinFileAssert.assertThat(files.get("SizeTest.kt")) + .assertClass("SizeTest") + .assertPrimaryConstructorParameter("field1") + .assertParameterAnnotation("Size", "get") + .hasAttributes(ImmutableMap.of( + "max", "10", + "message", "\"Must be max 10 elements\"" + )) + .toPrimaryConstructorParameter() + .toClass() + .assertPrimaryConstructorParameter("field2") + .assertParameterAnnotation("Size", "get") + .hasAttributes(ImmutableMap.of( + "min", "1", + "message", "\"Must not be empty\"" + )) + .toPrimaryConstructorParameter() + .toClass() + .assertPrimaryConstructorParameter("field3") + .assertParameterAnnotation("Size", "get") + .hasAttributes(ImmutableMap.of( + "min", "3", + "max", "5", + "message", "\"Must be between 3 and 5 elements\"" + )) + .toPrimaryConstructorParameter() + .toClass() + .assertPrimaryConstructorParameter("field4") + .assertParameterAnnotation("Size", "get") + .hasNotAttributes(List.of("message")) + .toPrimaryConstructorParameter() + .toClass() + .assertPrimaryConstructorParameter("field5") + .assertParameterAnnotation("Size", "get") + .hasNotAttributes(List.of("message")) + .toPrimaryConstructorParameter() + .toClass() + .assertPrimaryConstructorParameter("field6") + .assertParameterAnnotation("Size", "get") + .hasNotAttributes(List.of("message")); + } + + @Test + public void testXMinimumMessageAndXMaximumMessage_decimal() throws IOException { + final Map files = generateFromContract("src/test/resources/3_0/error-message-for-size-max-min.yaml"); + KotlinFileAssert.assertThat(files.get("TestApiController.kt")) + .assertClass("TestApiController") + .assertMethod("minmaxNumberTest") + .assertParameter("number") + .assertParameterAnnotation("DecimalMin") + .hasAttributes(ImmutableMap.of( + "value", "\"0.1\"", + "message", "\"Must be positive\"" + )) + .toParameter() + .assertParameterAnnotation("DecimalMax") + .hasAttributes(ImmutableMap.of( + "value", "\"99.9\"", + "message", "\"Must be less than 100\"" + )) + .toParameter() + .toMethod() + .assertParameter("token") + .assertParameterAnnotation("DecimalMin") + .hasAttributes(ImmutableMap.of( + "value", "\"0.1\"", + "message", "\"Must be positive\"" + )) + .toParameter() + .assertParameterAnnotation("DecimalMax") + .hasAttributes(ImmutableMap.of( + "value", "\"99.9\"", + "message", "\"Must be less than 100\"" + )) + .toParameter() + .toMethod() + .assertParameter("clientNumber") + .assertParameterAnnotation("DecimalMin") + .hasAttributes(ImmutableMap.of( + "value", "\"0.1\"", + "message", "\"Must be positive\"" + )) + .toParameter() + .assertParameterAnnotation("DecimalMax") + .hasAttributes(ImmutableMap.of( + "value", "\"99.9\"", + "message", "\"Must be less than 100\"" + )); + KotlinFileAssert.assertThat(files.get("NumberTest.kt")) + .assertClass("NumberTest") + .assertPrimaryConstructorParameter("field1") + .assertParameterAnnotation("DecimalMin", "get") + .hasAttributes(ImmutableMap.of( + "value", "\"0.1\"", + "message", "\"Must be positive\"" + )) + .toPrimaryConstructorParameter() + .assertParameterAnnotation("DecimalMax", "get") + .hasAttributes(ImmutableMap.of( + "value", "\"99.9\"", + "message", "\"Must be less than 100\"" + )) + .toPrimaryConstructorParameter() + .toClass() + .assertPrimaryConstructorParameter("field2") + .assertParameterAnnotation("DecimalMin", "get") + .hasNotAttributes(List.of("message")) + .toPrimaryConstructorParameter() + .assertParameterAnnotation("DecimalMax", "get") + .hasNotAttributes(List.of("message")); + } + + @Test + public void testXMinimumMessageAndXMaximumMessage_integer() throws IOException { + final Map files = generateFromContract("src/test/resources/3_0/error-message-for-size-max-min.yaml"); + KotlinFileAssert.assertThat(files.get("TestApiController.kt")) + .assertClass("TestApiController") + .assertMethod("minmaxIntegerTest") + .assertParameter("number") + .assertParameterAnnotation("Min") + .hasAttributes(ImmutableMap.of( + "value", "1", + "message", "\"Must be positive\"" + )) + .toParameter() + .assertParameterAnnotation("Max") + .hasAttributes(ImmutableMap.of( + "value", "99", + "message", "\"Must be less than 100\"" + )) + .toParameter() + .toMethod() + .assertParameter("token") + .assertParameterAnnotation("Min") + .hasAttributes(ImmutableMap.of( + "value", "1", + "message", "\"Must be positive\"" + )) + .toParameter() + .assertParameterAnnotation("Max") + .hasAttributes(ImmutableMap.of( + "value", "99", + "message", "\"Must be less than 100\"" + )) + .toParameter() + .toMethod() + .assertParameter("clientNumber") + .assertParameterAnnotation("Min") + .hasAttributes(ImmutableMap.of( + "value", "1", + "message", "\"Must be positive\"" + )) + .toParameter() + .assertParameterAnnotation("Max") + .hasAttributes(ImmutableMap.of( + "value", "99", + "message", "\"Must be less than 100\"" + )); + KotlinFileAssert.assertThat(files.get("IntegerTest.kt")) + .assertClass("IntegerTest") + .assertPrimaryConstructorParameter("field1") + .assertParameterAnnotation("Min", "get") + .hasAttributes(ImmutableMap.of( + "value", "1", + "message", "\"Must be positive\"" + )) + .toPrimaryConstructorParameter() + .assertParameterAnnotation("Max", "get") + .hasAttributes(ImmutableMap.of( + "value", "99", + "message", "\"Must be less than 100\"" + )) + .toPrimaryConstructorParameter() + .toClass() + .assertPrimaryConstructorParameter("field2") + .assertParameterAnnotation("Min", "get") + .hasNotAttributes(List.of("message")) + .toPrimaryConstructorParameter() + .assertParameterAnnotation("Max", "get") + .hasNotAttributes(List.of("message")); + } + + @Test + public void testXMinimumMessageAndXMaximumMessage_long() throws IOException { + final Map files = generateFromContract("src/test/resources/3_0/error-message-for-size-max-min.yaml"); + KotlinFileAssert.assertThat(files.get("TestApiController.kt")) + .assertClass("TestApiController") + .assertMethod("minmaxLongTest") + .assertParameter("number") + .assertParameterAnnotation("Min") + .hasAttributes(ImmutableMap.of( + "value", "1L", + "message", "\"Must be positive\"" + )) + .toParameter() + .assertParameterAnnotation("Max") + .hasAttributes(ImmutableMap.of( + "value", "99L", + "message", "\"Must be less than 100\"" + )) + .toParameter() + .toMethod() + .assertParameter("token") + .assertParameterAnnotation("Min") + .hasAttributes(ImmutableMap.of( + "value", "1L", + "message", "\"Must be positive\"" + )) + .toParameter() + .assertParameterAnnotation("Max") + .hasAttributes(ImmutableMap.of( + "value", "99L", + "message", "\"Must be less than 100\"" + )) + .toParameter() + .toMethod() + .assertParameter("clientNumber") + .assertParameterAnnotation("Min") + .hasAttributes(ImmutableMap.of( + "value", "1L", + "message", "\"Must be positive\"" + )) + .toParameter() + .assertParameterAnnotation("Max") + .hasAttributes(ImmutableMap.of( + "value", "99L", + "message", "\"Must be less than 100\"" + )); + KotlinFileAssert.assertThat(files.get("LongTest.kt")) + .assertClass("LongTest") + .assertPrimaryConstructorParameter("field1") + .assertParameterAnnotation("Min", "get") + .hasAttributes(ImmutableMap.of( + "value", "1L", + "message", "\"Must be positive\"" + )) + .toPrimaryConstructorParameter() + .assertParameterAnnotation("Max", "get") + .hasAttributes(ImmutableMap.of( + "value", "99L", + "message", "\"Must be less than 100\"" + )) + .toPrimaryConstructorParameter() + .toClass() + .assertPrimaryConstructorParameter("field2") + .assertParameterAnnotation("Min", "get") + .hasNotAttributes(List.of("message")) + .toPrimaryConstructorParameter() + .assertParameterAnnotation("Max", "get") + .hasNotAttributes(List.of("message")); + } + private Map generateFromContract(String url) throws IOException { return generateFromContract(url, new HashMap<>(), new HashMap<>()); } diff --git a/modules/openapi-generator/src/test/resources/3_0/error-message-for-size-max-min.yaml b/modules/openapi-generator/src/test/resources/3_0/error-message-for-size-max-min.yaml new file mode 100644 index 000000000000..baac8e86c0e8 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/error-message-for-size-max-min.yaml @@ -0,0 +1,310 @@ +openapi: 3.0.3 +info: + title: sample spec + version: 1.0.0 +paths: + /test/length/{word}: + post: + operationId: lengthTest + parameters: + - in: path + name: word + required: true + schema: + type: string + maxLength: 10 + x-size-message: "Must be max 10 characters" + - in: query + name: token + required: true + schema: + type: string + minLength: 1 + x-size-message: "Must not be empty" + - in: header + name: clientId + required: true + schema: + type: string + minLength: 3 + maxLength: 5 + x-size-message: "Must be between 3 and 5 characters" + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/LengthTest' + responses: + 201: + description: success + /test/size/{values}: + post: + operationId: sizeTest + parameters: + - in: path + name: values + required: true + schema: + type: array + maxItems: 10 + x-size-message: "Must be max 10 elements" + items: + type: string + - in: query + name: tokens + required: true + schema: + type: array + minItems: 1 + x-size-message: "Must not be empty" + items: + type: string + - in: header + name: clientIds + required: true + schema: + type: array + minItems: 3 + maxItems: 5 + x-size-message: "Must be between 3 and 5 elements" + items: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SizeTest' + responses: + 201: + description: success + /test/number/minmax/{number}: + post: + operationId: minmaxNumberTest + parameters: + - in: path + name: number + required: true + schema: + type: number + minimum: 0.1 + maximum: 99.9 + x-minimum-message: "Must be positive" + x-maximum-message: "Must be less than 100" + - in: query + name: token + required: true + schema: + type: number + minimum: 0.1 + maximum: 99.9 + x-minimum-message: "Must be positive" + x-maximum-message: "Must be less than 100" + - in: header + name: clientNumber + required: true + schema: + type: number + minimum: 0.1 + maximum: 99.9 + x-minimum-message: "Must be positive" + x-maximum-message: "Must be less than 100" + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/NumberTest' + responses: + 201: + description: success + /test/integer/minmax/{number}: + post: + operationId: minmaxIntegerTest + parameters: + - in: path + name: number + required: true + schema: + type: integer + format: int32 + minimum: 1 + maximum: 99 + x-minimum-message: "Must be positive" + x-maximum-message: "Must be less than 100" + - in: query + name: token + required: true + schema: + type: integer + format: int32 + minimum: 1 + maximum: 99 + x-minimum-message: "Must be positive" + x-maximum-message: "Must be less than 100" + - in: header + name: clientNumber + required: true + schema: + type: integer + format: int32 + minimum: 1 + maximum: 99 + x-minimum-message: "Must be positive" + x-maximum-message: "Must be less than 100" + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/IntegerTest' + responses: + 201: + description: success + /test/long/minmax/{number}: + post: + operationId: minmaxLongTest + parameters: + - in: path + name: number + required: true + schema: + type: integer + format: int64 + minimum: 1 + maximum: 99 + x-minimum-message: "Must be positive" + x-maximum-message: "Must be less than 100" + - in: query + name: token + required: true + schema: + type: integer + format: int64 + minimum: 1 + maximum: 99 + x-minimum-message: "Must be positive" + x-maximum-message: "Must be less than 100" + - in: header + name: clientNumber + required: true + schema: + type: integer + format: int64 + minimum: 1 + maximum: 99 + x-minimum-message: "Must be positive" + x-maximum-message: "Must be less than 100" + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/LongTest' + responses: + 201: + description: success +components: + schemas: + LengthTest: + type: object + properties: + field1: + type: string + maxLength: 10 + x-size-message: "Must be max 10 characters" + field2: + type: string + minLength: 1 + x-size-message: "Must not be empty" + field3: + type: string + minLength: 3 + maxLength: 5 + x-size-message: "Must be between 3 and 5 characters" + field4: + type: string + minLength: 3 + maxLength: 5 + field5: + type: string + minLength: 3 + field6: + type: string + maxLength: 5 + SizeTest: + type: object + properties: + field1: + type: array + maxItems: 10 + x-size-message: "Must be max 10 elements" + items: + type: string + field2: + type: array + minItems: 1 + x-size-message: "Must not be empty" + items: + type: string + field3: + type: array + minItems: 3 + maxItems: 5 + x-size-message: "Must be between 3 and 5 elements" + items: + type: string + field4: + type: array + minItems: 3 + maxItems: 5 + items: + type: string + field5: + type: array + minItems: 3 + items: + type: string + field6: + type: array + maxItems: 5 + items: + type: string + NumberTest: + type: object + properties: + field1: + type: number + minimum: 0.1 + maximum: 99.9 + x-minimum-message: "Must be positive" + x-maximum-message: "Must be less than 100" + field2: + type: number + minimum: 0.1 + maximum: 99.9 + IntegerTest: + type: object + properties: + field1: + type: integer + format: int32 + minimum: 1 + maximum: 99 + x-minimum-message: "Must be positive" + x-maximum-message: "Must be less than 100" + field2: + type: integer + format: int32 + minimum: 1 + maximum: 99 + LongTest: + properties: + field1: + type: integer + format: int64 + minimum: 1 + maximum: 99 + x-minimum-message: "Must be positive" + x-maximum-message: "Must be less than 100" + field2: + type: integer + format: int64 + minimum: 1 + maximum: 99 diff --git a/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/api/StoreApi.java b/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/api/StoreApi.java index ccf2ae1d7c58..c67db72e7800 100644 --- a/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/api/StoreApi.java @@ -131,7 +131,7 @@ ResponseEntity> getInventory( ) ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId ); diff --git a/samples/client/petstore/spring-cloud-feign-without-url/src/main/java/org/openapitools/api/StoreApi.java b/samples/client/petstore/spring-cloud-feign-without-url/src/main/java/org/openapitools/api/StoreApi.java index 1e451a74b4a9..e9fad8583244 100644 --- a/samples/client/petstore/spring-cloud-feign-without-url/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/client/petstore/spring-cloud-feign-without-url/src/main/java/org/openapitools/api/StoreApi.java @@ -118,7 +118,7 @@ ResponseEntity> getInventory( ) ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") Long orderId ); diff --git a/samples/client/petstore/spring-cloud-tags/src/main/java/org/openapitools/api/StoreController.java b/samples/client/petstore/spring-cloud-tags/src/main/java/org/openapitools/api/StoreController.java index ce59fc0be998..7ebdc11186c0 100644 --- a/samples/client/petstore/spring-cloud-tags/src/main/java/org/openapitools/api/StoreController.java +++ b/samples/client/petstore/spring-cloud-tags/src/main/java/org/openapitools/api/StoreController.java @@ -118,7 +118,7 @@ ResponseEntity> getInventory( ) ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") Long orderId ); diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApi.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApi.java index 1e451a74b4a9..e9fad8583244 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApi.java @@ -118,7 +118,7 @@ ResponseEntity> getInventory( ) ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") Long orderId ); diff --git a/samples/openapi3/client/petstore/spring-cloud-3-with-optional/src/main/java/org/openapitools/api/StoreApi.java b/samples/openapi3/client/petstore/spring-cloud-3-with-optional/src/main/java/org/openapitools/api/StoreApi.java index a1591b46eb2c..b63a5f833415 100644 --- a/samples/openapi3/client/petstore/spring-cloud-3-with-optional/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/openapi3/client/petstore/spring-cloud-3-with-optional/src/main/java/org/openapitools/api/StoreApi.java @@ -80,7 +80,7 @@ ResponseEntity> getInventory( ) ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @PathVariable("orderId") Long orderId ); diff --git a/samples/openapi3/client/petstore/spring-cloud-3/src/main/java/org/openapitools/api/StoreApi.java b/samples/openapi3/client/petstore/spring-cloud-3/src/main/java/org/openapitools/api/StoreApi.java index 6d0587f98b0e..99b372612fab 100644 --- a/samples/openapi3/client/petstore/spring-cloud-3/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/openapi3/client/petstore/spring-cloud-3/src/main/java/org/openapitools/api/StoreApi.java @@ -131,7 +131,7 @@ ResponseEntity> getInventory( ) ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId ); diff --git a/samples/openapi3/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/StoreApi.java b/samples/openapi3/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/StoreApi.java index 9cf71b6932ae..952c61babbb9 100644 --- a/samples/openapi3/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/openapi3/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/StoreApi.java @@ -132,7 +132,7 @@ CompletableFuture>> getInventory( ) CompletableFuture> getOrderById( - @NotNull @Min(1L) @Max(5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId ); diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/FakeApi.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/FakeApi.java index c851f839af26..b3ee791c15c9 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/FakeApi.java @@ -324,14 +324,14 @@ ResponseEntity testClientModel( ) ResponseEntity testEndpointParameters( - @Parameter(name = "number", description = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, - @Parameter(name = "double", description = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @Parameter(name = "number", description = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @Parameter(name = "double", description = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @Parameter(name = "pattern_without_delimiter", description = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @Parameter(name = "byte", description = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, - @Parameter(name = "integer", description = "None") @Min(10) @Max(100) @Valid @RequestParam(value = "integer", required = false) Integer integer, - @Parameter(name = "int32", description = "None") @Min(20) @Max(200) @Valid @RequestParam(value = "int32", required = false) Integer int32, + @Parameter(name = "integer", description = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, + @Parameter(name = "int32", description = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @Parameter(name = "int64", description = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, - @Parameter(name = "float", description = "None") @DecimalMax("987.6") @Valid @RequestParam(value = "float", required = false) Float _float, + @Parameter(name = "float", description = "None") @DecimalMax(value = "987.6") @Valid @RequestParam(value = "float", required = false) Float _float, @Parameter(name = "string", description = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestParam(value = "string", required = false) String string, @Parameter(name = "binary", description = "None") @RequestPart(value = "binary", required = false) MultipartFile binary, @Parameter(name = "date", description = "None") @Valid @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/StoreApi.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/StoreApi.java index b4ffe7085b46..4b3345796b90 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/StoreApi.java @@ -131,7 +131,7 @@ ResponseEntity> getInventory( ) ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @Parameter(name = "order_id", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("order_id") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "order_id", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("order_id") Long orderId ); diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/FormatTest.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/FormatTest.java index 30b0afa0077e..2bba7bd87680 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/FormatTest.java @@ -75,7 +75,7 @@ public FormatTest integer(@Nullable Integer integer) { * maximum: 100 * @return integer */ - @Min(10) @Max(100) + @Min(value = 10) @Max(value = 100) @Schema(name = "integer", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("integer") public @Nullable Integer getInteger() { @@ -97,7 +97,7 @@ public FormatTest int32(@Nullable Integer int32) { * maximum: 200 * @return int32 */ - @Min(20) @Max(200) + @Min(value = 20) @Max(value = 200) @Schema(name = "int32", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("int32") public @Nullable Integer getInt32() { @@ -139,7 +139,7 @@ public FormatTest number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Schema(name = "number", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("number") public BigDecimal getNumber() { @@ -161,7 +161,7 @@ public FormatTest _float(@Nullable Float _float) { * maximum: 987.6 * @return _float */ - @DecimalMin("54.3") @DecimalMax("987.6") + @DecimalMin(value = "54.3") @DecimalMax(value = "987.6") @Schema(name = "float", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("float") public @Nullable Float getFloat() { @@ -183,7 +183,7 @@ public FormatTest _double(@Nullable Double _double) { * maximum: 123.4 * @return _double */ - @DecimalMin("67.8") @DecimalMax("123.4") + @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Schema(name = "double", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("double") public @Nullable Double getDouble() { diff --git a/samples/openapi3/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/api/StoreApi.java b/samples/openapi3/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/api/StoreApi.java index fa015b077e1f..df18eeabc761 100644 --- a/samples/openapi3/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/openapi3/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/api/StoreApi.java @@ -131,7 +131,7 @@ ResponseEntity> getInventory( ) ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId ); diff --git a/samples/openapi3/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApi.java b/samples/openapi3/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApi.java index ccf2ae1d7c58..c67db72e7800 100644 --- a/samples/openapi3/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/openapi3/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApi.java @@ -131,7 +131,7 @@ ResponseEntity> getInventory( ) ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId ); diff --git a/samples/openapi3/client/petstore/spring-stubs-skip-default-interface/src/main/java/org/openapitools/api/StoreApi.java b/samples/openapi3/client/petstore/spring-stubs-skip-default-interface/src/main/java/org/openapitools/api/StoreApi.java index 8749f906520f..15f5501edccb 100644 --- a/samples/openapi3/client/petstore/spring-stubs-skip-default-interface/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/openapi3/client/petstore/spring-stubs-skip-default-interface/src/main/java/org/openapitools/api/StoreApi.java @@ -131,7 +131,7 @@ ResponseEntity> getInventory( ) ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId ) throws Exception; diff --git a/samples/openapi3/client/petstore/spring-stubs/src/main/java/org/openapitools/api/StoreApi.java b/samples/openapi3/client/petstore/spring-stubs/src/main/java/org/openapitools/api/StoreApi.java index f23fb06bf120..10ab0121165f 100644 --- a/samples/openapi3/client/petstore/spring-stubs/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/openapi3/client/petstore/spring-stubs/src/main/java/org/openapitools/api/StoreApi.java @@ -141,7 +141,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId ) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/openapi3/server/petstore/spring-boot-springdoc/src/main/java/org/openapitools/api/StoreApi.java b/samples/openapi3/server/petstore/spring-boot-springdoc/src/main/java/org/openapitools/api/StoreApi.java index 20a928253047..f31f1ec336f2 100644 --- a/samples/openapi3/server/petstore/spring-boot-springdoc/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/openapi3/server/petstore/spring-boot-springdoc/src/main/java/org/openapitools/api/StoreApi.java @@ -141,7 +141,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId ) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/api/StoreApi.java b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/api/StoreApi.java index 59ba999b5c8d..e77744de94ce 100644 --- a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/api/StoreApi.java @@ -141,7 +141,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId ) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java index 153dadf21959..e33e731dcea5 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java @@ -371,14 +371,14 @@ default ResponseEntity testClientModel( ) default ResponseEntity testEndpointParameters( - @Parameter(name = "number", description = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, - @Parameter(name = "double", description = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @Parameter(name = "number", description = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @Parameter(name = "double", description = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @Parameter(name = "pattern_without_delimiter", description = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @Parameter(name = "byte", description = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, - @Parameter(name = "integer", description = "None") @Min(10) @Max(100) @Valid @RequestParam(value = "integer", required = false) Integer integer, - @Parameter(name = "int32", description = "None") @Min(20) @Max(200) @Valid @RequestParam(value = "int32", required = false) Integer int32, + @Parameter(name = "integer", description = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, + @Parameter(name = "int32", description = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @Parameter(name = "int64", description = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, - @Parameter(name = "float", description = "None") @DecimalMax("987.6") @Valid @RequestParam(value = "float", required = false) Float _float, + @Parameter(name = "float", description = "None") @DecimalMax(value = "987.6") @Valid @RequestParam(value = "float", required = false) Float _float, @Parameter(name = "string", description = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestParam(value = "string", required = false) String string, @Parameter(name = "binary", description = "None") @RequestPart(value = "binary", required = false) MultipartFile binary, @Parameter(name = "date", description = "None") @Valid @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApi.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApi.java index 7298d2656466..2696a346dfb9 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApi.java @@ -135,7 +135,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @Parameter(name = "order_id", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("order_id") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "order_id", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("order_id") Long orderId ) { return getDelegate().getOrderById(orderId); } diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FormatTest.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FormatTest.java index 70f9656c7018..59ccdf6d432e 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FormatTest.java @@ -85,7 +85,7 @@ public FormatTest integer(@Nullable Integer integer) { * maximum: 100 * @return integer */ - @Min(10) @Max(100) + @Min(value = 10) @Max(value = 100) @Schema(name = "integer", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("integer") public @Nullable Integer getInteger() { @@ -107,7 +107,7 @@ public FormatTest int32(@Nullable Integer int32) { * maximum: 200 * @return int32 */ - @Min(20) @Max(200) + @Min(value = 20) @Max(value = 200) @Schema(name = "int32", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("int32") public @Nullable Integer getInt32() { @@ -149,7 +149,7 @@ public FormatTest number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Schema(name = "number", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("number") public BigDecimal getNumber() { @@ -171,7 +171,7 @@ public FormatTest _float(@Nullable Float _float) { * maximum: 987.6 * @return _float */ - @DecimalMin("54.3") @DecimalMax("987.6") + @DecimalMin(value = "54.3") @DecimalMax(value = "987.6") @Schema(name = "float", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("float") public @Nullable Float getFloat() { @@ -193,7 +193,7 @@ public FormatTest _double(@Nullable Double _double) { * maximum: 123.4 * @return _double */ - @DecimalMin("67.8") @DecimalMax("123.4") + @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Schema(name = "double", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("double") public @Nullable Double getDouble() { diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java index 47e59284993a..54d0d983cbc1 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java @@ -411,14 +411,14 @@ default ResponseEntity testClientModel( ) default ResponseEntity testEndpointParameters( - @Parameter(name = "number", description = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, - @Parameter(name = "double", description = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @Parameter(name = "number", description = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @Parameter(name = "double", description = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @Parameter(name = "pattern_without_delimiter", description = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @Parameter(name = "byte", description = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, - @Parameter(name = "integer", description = "None") @Min(10) @Max(100) @Valid @RequestParam(value = "integer", required = false) Integer integer, - @Parameter(name = "int32", description = "None") @Min(20) @Max(200) @Valid @RequestParam(value = "int32", required = false) Integer int32, + @Parameter(name = "integer", description = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, + @Parameter(name = "int32", description = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @Parameter(name = "int64", description = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, - @Parameter(name = "float", description = "None") @DecimalMax("987.6") @Valid @RequestParam(value = "float", required = false) Float _float, + @Parameter(name = "float", description = "None") @DecimalMax(value = "987.6") @Valid @RequestParam(value = "float", required = false) Float _float, @Parameter(name = "string", description = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestParam(value = "string", required = false) String string, @Parameter(name = "binary", description = "None") @RequestPart(value = "binary", required = false) MultipartFile binary, @Parameter(name = "date", description = "None") @Valid @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/StoreApi.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/StoreApi.java index 34b02a05f55e..304bb21c3255 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/StoreApi.java @@ -141,7 +141,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @Parameter(name = "order_id", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("order_id") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "order_id", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("order_id") Long orderId ) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/FormatTest.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/FormatTest.java index 70f9656c7018..59ccdf6d432e 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/FormatTest.java @@ -85,7 +85,7 @@ public FormatTest integer(@Nullable Integer integer) { * maximum: 100 * @return integer */ - @Min(10) @Max(100) + @Min(value = 10) @Max(value = 100) @Schema(name = "integer", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("integer") public @Nullable Integer getInteger() { @@ -107,7 +107,7 @@ public FormatTest int32(@Nullable Integer int32) { * maximum: 200 * @return int32 */ - @Min(20) @Max(200) + @Min(value = 20) @Max(value = 200) @Schema(name = "int32", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("int32") public @Nullable Integer getInt32() { @@ -149,7 +149,7 @@ public FormatTest number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Schema(name = "number", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("number") public BigDecimal getNumber() { @@ -171,7 +171,7 @@ public FormatTest _float(@Nullable Float _float) { * maximum: 987.6 * @return _float */ - @DecimalMin("54.3") @DecimalMax("987.6") + @DecimalMin(value = "54.3") @DecimalMax(value = "987.6") @Schema(name = "float", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("float") public @Nullable Float getFloat() { @@ -193,7 +193,7 @@ public FormatTest _double(@Nullable Double _double) { * maximum: 123.4 * @return _double */ - @DecimalMin("67.8") @DecimalMax("123.4") + @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Schema(name = "double", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("double") public @Nullable Double getDouble() { diff --git a/samples/openapi3/server/petstore/springboot-source/src/main/java/org/openapitools/api/StoreApi.java b/samples/openapi3/server/petstore/springboot-source/src/main/java/org/openapitools/api/StoreApi.java index 7322f6a83d5a..f8298a724929 100644 --- a/samples/openapi3/server/petstore/springboot-source/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/openapi3/server/petstore/springboot-source/src/main/java/org/openapitools/api/StoreApi.java @@ -90,7 +90,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @PathVariable("orderId") Long orderId ) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/api/StoreApi.java b/samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/api/StoreApi.java index d0481548da25..3c2ab4e4e521 100644 --- a/samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/api/StoreApi.java @@ -142,7 +142,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId ) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/StoreApi.kt index afc1ad687127..514e234e602f 100644 --- a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/StoreApi.kt +++ b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -56,7 +56,7 @@ interface StoreApi { value = ["/store/order/{orderId}"], produces = ["application/xml", "application/json"] ) - fun getOrderById(@Min(1L) @Max(5L) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { + fun getOrderById(@Min(value=1L) @Max(value=5L) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/StoreApiController.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/StoreApiController.kt index ad2a726a09d6..c7a3cab4ff92 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/StoreApiController.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/StoreApiController.kt @@ -80,7 +80,7 @@ class StoreApiController() { value = ["/store/order/{orderId}"], produces = ["application/xml", "application/json"] ) - fun getOrderById(@Min(1L) @Max(5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { + fun getOrderById(@Min(value=1L) @Max(value=5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/StoreApiController.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/StoreApiController.kt index 7a12f122864c..dfec4ecc73fc 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/StoreApiController.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/StoreApiController.kt @@ -52,7 +52,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic value = ["/store/order/{orderId}"], produces = ["application/xml", "application/json"] ) - fun getOrderById(@Min(1L) @Max(5L) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { + fun getOrderById(@Min(value=1L) @Max(value=5L) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/api/StoreApiController.kt b/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/api/StoreApiController.kt index 7a12f122864c..dfec4ecc73fc 100644 --- a/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/api/StoreApiController.kt +++ b/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/api/StoreApiController.kt @@ -52,7 +52,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic value = ["/store/order/{orderId}"], produces = ["application/xml", "application/json"] ) - fun getOrderById(@Min(1L) @Max(5L) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { + fun getOrderById(@Min(value=1L) @Max(value=5L) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/StoreApi.kt index e77a11aba02a..1e359f8b8c69 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/StoreApi.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -93,7 +93,7 @@ interface StoreApi { value = ["/store/order/{orderId}"], produces = ["application/xml", "application/json"] ) - fun getOrderById(@Min(1L) @Max(5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { + fun getOrderById(@Min(value=1L) @Max(value=5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { return getDelegate().getOrderById(orderId) } diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/StoreApi.kt index 0f66c50b44c5..76c38c394a41 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/StoreApi.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -92,7 +92,7 @@ interface StoreApi { value = ["/store/order/{orderId}"], produces = ["application/xml", "application/json"] ) - fun getOrderById(@Min(1L) @Max(5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { + fun getOrderById(@Min(value=1L) @Max(value=5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { return getDelegate().getOrderById(orderId) } diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiController.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiController.kt index 09afab084a7a..a74a81d00667 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiController.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiController.kt @@ -80,7 +80,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic value = ["/store/order/{orderId}"], produces = ["application/xml", "application/json"] ) - fun getOrderById(@Min(1L) @Max(5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { + fun getOrderById(@Min(value=1L) @Max(value=5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/api/StoreApiController.kt b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/api/StoreApiController.kt index d376c35f1597..db2e659b5edd 100644 --- a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/api/StoreApiController.kt +++ b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/api/StoreApiController.kt @@ -81,7 +81,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic value = ["/store/order/{orderId}"], produces = ["application/xml", "application/json"] ) - suspend fun getOrderById(@Min(1L) @Max(5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { + suspend fun getOrderById(@Min(value=1L) @Max(value=5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiController.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiController.kt index d376c35f1597..db2e659b5edd 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiController.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiController.kt @@ -81,7 +81,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic value = ["/store/order/{orderId}"], produces = ["application/xml", "application/json"] ) - suspend fun getOrderById(@Min(1L) @Max(5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { + suspend fun getOrderById(@Min(value=1L) @Max(value=5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/api/StoreApi.kt index 960e2bbb02dd..b5451ba3847d 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/api/StoreApi.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -90,7 +90,7 @@ interface StoreApi { value = ["/store/order/{order_id}"], produces = ["application/xml", "application/json"] ) - fun getOrderById(@Min(1L) @Max(5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") orderId: kotlin.Long): ResponseEntity { + fun getOrderById(@Min(value=1L) @Max(value=5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") orderId: kotlin.Long): ResponseEntity { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/StoreApiController.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/StoreApiController.kt index 764c1073e564..9990c01e2d2a 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/StoreApiController.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/StoreApiController.kt @@ -83,7 +83,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic value = ["/store/order/{orderId}"], produces = ["application/xml", "application/json"] ) - fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { + fun getOrderById(@Min(value=1L) @Max(value=5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/StoreApiController.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/StoreApiController.kt index 09afab084a7a..a74a81d00667 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/StoreApiController.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/StoreApiController.kt @@ -80,7 +80,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic value = ["/store/order/{orderId}"], produces = ["application/xml", "application/json"] ) - fun getOrderById(@Min(1L) @Max(5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { + fun getOrderById(@Min(value=1L) @Max(value=5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/StoreApiController.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/StoreApiController.kt index 764c1073e564..9990c01e2d2a 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/StoreApiController.kt +++ b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/StoreApiController.kt @@ -83,7 +83,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic value = ["/store/order/{orderId}"], produces = ["application/xml", "application/json"] ) - fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { + fun getOrderById(@Min(value=1L) @Max(value=5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/StoreApi.kt index a5b8b7c5cd8b..ae0522640828 100644 --- a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/StoreApi.kt +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -53,7 +53,7 @@ interface StoreApi { value = ["/store/order/{orderId}"], produces = ["application/json"] ) - fun getOrderById(@Min(1) @Max(5) @PathVariable("orderId") orderId: kotlin.Int): ResponseEntity + fun getOrderById(@Min(value=1) @Max(value=5) @PathVariable("orderId") orderId: kotlin.Int): ResponseEntity @RequestMapping( diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiController.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiController.kt index 6cbb8279976f..61477d325bfb 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiController.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiController.kt @@ -53,7 +53,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic value = ["/store/order/{orderId}"], produces = ["application/xml", "application/json"] ) - fun getOrderById(@Min(1L) @Max(5L) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { + fun getOrderById(@Min(value=1L) @Max(value=5L) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity { return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/api/FakeApi.java index dba4053b8c72..3eea04e0f090 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/api/FakeApi.java @@ -353,14 +353,14 @@ ResponseEntity testClientModel( ) ResponseEntity testEndpointParameters( - @Parameter(name = "number", description = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, - @Parameter(name = "double", description = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @Parameter(name = "number", description = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @Parameter(name = "double", description = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @Parameter(name = "pattern_without_delimiter", description = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @Parameter(name = "byte", description = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, - @Parameter(name = "integer", description = "None") @Min(10) @Max(100) @Valid @RequestParam(value = "integer", required = false) Integer integer, - @Parameter(name = "int32", description = "None") @Min(20) @Max(200) @Valid @RequestParam(value = "int32", required = false) Integer int32, + @Parameter(name = "integer", description = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, + @Parameter(name = "int32", description = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @Parameter(name = "int64", description = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, - @Parameter(name = "float", description = "None") @DecimalMax("987.6") @Valid @RequestParam(value = "float", required = false) Float _float, + @Parameter(name = "float", description = "None") @DecimalMax(value = "987.6") @Valid @RequestParam(value = "float", required = false) Float _float, @Parameter(name = "string", description = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestParam(value = "string", required = false) String string, @Parameter(name = "binary", description = "None") @RequestPart(value = "binary", required = false) MultipartFile binary, @Parameter(name = "date", description = "None") @Valid @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/api/StoreApi.java index eabbdcb1deba..845bd9fec6c3 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/api/StoreApi.java @@ -131,7 +131,7 @@ ResponseEntity> getInventory( ) ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @Parameter(name = "order_id", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("order_id") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "order_id", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("order_id") Long orderId ) throws Exception; diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/FormatTest.java index 70f9656c7018..59ccdf6d432e 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/FormatTest.java @@ -85,7 +85,7 @@ public FormatTest integer(@Nullable Integer integer) { * maximum: 100 * @return integer */ - @Min(10) @Max(100) + @Min(value = 10) @Max(value = 100) @Schema(name = "integer", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("integer") public @Nullable Integer getInteger() { @@ -107,7 +107,7 @@ public FormatTest int32(@Nullable Integer int32) { * maximum: 200 * @return int32 */ - @Min(20) @Max(200) + @Min(value = 20) @Max(value = 200) @Schema(name = "int32", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("int32") public @Nullable Integer getInt32() { @@ -149,7 +149,7 @@ public FormatTest number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Schema(name = "number", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("number") public BigDecimal getNumber() { @@ -171,7 +171,7 @@ public FormatTest _float(@Nullable Float _float) { * maximum: 987.6 * @return _float */ - @DecimalMin("54.3") @DecimalMax("987.6") + @DecimalMin(value = "54.3") @DecimalMax(value = "987.6") @Schema(name = "float", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("float") public @Nullable Float getFloat() { @@ -193,7 +193,7 @@ public FormatTest _double(@Nullable Double _double) { * maximum: 123.4 * @return _double */ - @DecimalMin("67.8") @DecimalMax("123.4") + @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Schema(name = "double", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("double") public @Nullable Double getDouble() { diff --git a/samples/server/petstore/springboot-api-response-examples/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-api-response-examples/src/main/java/org/openapitools/model/Dog.java index 06035502e248..bca5ac19068a 100644 --- a/samples/server/petstore/springboot-api-response-examples/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-api-response-examples/src/main/java/org/openapitools/model/Dog.java @@ -35,7 +35,7 @@ public Dog name(@Nullable String name) { * Get name * @return name */ - @Pattern(regexp = "^[a-zA-Z]+$", message="Name must contain only letters") @Size(max = 50) + @Pattern(regexp = "^[a-zA-Z]+$", message = "Name must contain only letters") @Size(max = 50) @Schema(name = "name", example = "Rex", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("name") public @Nullable String getName() { @@ -56,7 +56,7 @@ public Dog age(@Nullable Integer age) { * minimum: 0 * @return age */ - @Min(0) + @Min(value = 0) @Schema(name = "age", example = "5", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("age") public @Nullable Integer getAge() { diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/FakeApi.java index 8e49bc950270..1673d325965e 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/FakeApi.java @@ -403,14 +403,14 @@ default ResponseEntity testClientModel( ) default ResponseEntity testEndpointParameters( - @ApiParam(value = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, - @ApiParam(value = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, - @ApiParam(value = "None") @Min(10) @Max(100) @Valid @RequestParam(value = "integer", required = false) Integer integer, - @ApiParam(value = "None") @Min(20) @Max(200) @Valid @RequestParam(value = "int32", required = false) Integer int32, + @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, + @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, - @ApiParam(value = "None") @DecimalMax("987.6") @Valid @RequestParam(value = "float", required = false) Float _float, + @ApiParam(value = "None") @DecimalMax(value = "987.6") @Valid @RequestParam(value = "float", required = false) Float _float, @ApiParam(value = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestParam(value = "string", required = false) String string, @ApiParam(value = "None") @RequestPart(value = "binary", required = false) MultipartFile binary, @ApiParam(value = "None") @Valid @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/StoreApi.java index 9db407d6f1b2..5c30d598c4ad 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/StoreApi.java @@ -128,7 +128,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId ) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/FormatTest.java index d86135870ef0..21408607cce0 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/FormatTest.java @@ -85,7 +85,7 @@ public FormatTest integer(@Nullable Integer integer) { * maximum: 100 * @return integer */ - @Min(10) @Max(100) + @Min(value = 10) @Max(value = 100) @ApiModelProperty(value = "") @JsonProperty("integer") public @Nullable Integer getInteger() { @@ -107,7 +107,7 @@ public FormatTest int32(@Nullable Integer int32) { * maximum: 200 * @return int32 */ - @Min(20) @Max(200) + @Min(value = 20) @Max(value = 200) @ApiModelProperty(value = "") @JsonProperty("int32") public @Nullable Integer getInt32() { @@ -149,7 +149,7 @@ public FormatTest number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @ApiModelProperty(required = true, value = "") @JsonProperty("number") public BigDecimal getNumber() { @@ -171,7 +171,7 @@ public FormatTest _float(@Nullable Float _float) { * maximum: 987.6 * @return _float */ - @DecimalMin("54.3") @DecimalMax("987.6") + @DecimalMin(value = "54.3") @DecimalMax(value = "987.6") @ApiModelProperty(value = "") @JsonProperty("float") public @Nullable Float getFloat() { @@ -193,7 +193,7 @@ public FormatTest _double(@Nullable Double _double) { * maximum: 123.4 * @return _double */ - @DecimalMin("67.8") @DecimalMax("123.4") + @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @ApiModelProperty(value = "") @JsonProperty("double") public @Nullable Double getDouble() { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java index 8e49bc950270..1673d325965e 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java @@ -403,14 +403,14 @@ default ResponseEntity testClientModel( ) default ResponseEntity testEndpointParameters( - @ApiParam(value = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, - @ApiParam(value = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, - @ApiParam(value = "None") @Min(10) @Max(100) @Valid @RequestParam(value = "integer", required = false) Integer integer, - @ApiParam(value = "None") @Min(20) @Max(200) @Valid @RequestParam(value = "int32", required = false) Integer int32, + @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, + @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, - @ApiParam(value = "None") @DecimalMax("987.6") @Valid @RequestParam(value = "float", required = false) Float _float, + @ApiParam(value = "None") @DecimalMax(value = "987.6") @Valid @RequestParam(value = "float", required = false) Float _float, @ApiParam(value = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestParam(value = "string", required = false) String string, @ApiParam(value = "None") @RequestPart(value = "binary", required = false) MultipartFile binary, @ApiParam(value = "None") @Valid @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/StoreApi.java index 9db407d6f1b2..5c30d598c4ad 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/StoreApi.java @@ -128,7 +128,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId ) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/FormatTest.java index badd3e2713b4..567314f1e85a 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/FormatTest.java @@ -86,7 +86,7 @@ public FormatTest integer(@Nullable Integer integer) { * maximum: 100 * @return integer */ - @Min(10) @Max(100) + @Min(value = 10) @Max(value = 100) @ApiModelProperty(value = "") @JsonProperty("integer") public @Nullable Integer getInteger() { @@ -108,7 +108,7 @@ public FormatTest int32(@Nullable Integer int32) { * maximum: 200 * @return int32 */ - @Min(20) @Max(200) + @Min(value = 20) @Max(value = 200) @ApiModelProperty(value = "") @JsonProperty("int32") public @Nullable Integer getInt32() { @@ -150,7 +150,7 @@ public FormatTest number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @ApiModelProperty(required = true, value = "") @JsonProperty("number") public BigDecimal getNumber() { @@ -172,7 +172,7 @@ public FormatTest _float(@Nullable Float _float) { * maximum: 987.6 * @return _float */ - @DecimalMin("54.3") @DecimalMax("987.6") + @DecimalMin(value = "54.3") @DecimalMax(value = "987.6") @ApiModelProperty(value = "") @JsonProperty("float") public @Nullable Float getFloat() { @@ -194,7 +194,7 @@ public FormatTest _double(@Nullable Double _double) { * maximum: 123.4 * @return _double */ - @DecimalMin("67.8") @DecimalMax("123.4") + @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @ApiModelProperty(value = "") @JsonProperty("double") public @Nullable Double getDouble() { diff --git a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/api/FakeApi.java index af625d38513a..8cee18f3594b 100644 --- a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/api/FakeApi.java @@ -403,14 +403,14 @@ default ResponseEntity testClientModel( ) default ResponseEntity testEndpointParameters( - @ApiParam(value = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, - @ApiParam(value = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, - @ApiParam(value = "None") @Min(10) @Max(100) @Valid @RequestParam(value = "integer", required = false) Integer integer, - @ApiParam(value = "None") @Min(20) @Max(200) @Valid @RequestParam(value = "int32", required = false) Integer int32, + @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, + @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, - @ApiParam(value = "None") @DecimalMax("987.6") @Valid @RequestParam(value = "float", required = false) Float _float, + @ApiParam(value = "None") @DecimalMax(value = "987.6") @Valid @RequestParam(value = "float", required = false) Float _float, @ApiParam(value = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestParam(value = "string", required = false) String string, @ApiParam(value = "None") @RequestPart(value = "binary", required = false) MultipartFile binary, @ApiParam(value = "None") @Valid @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, diff --git a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/api/StoreApi.java index 3dccadba6533..3455aec33533 100644 --- a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/api/StoreApi.java @@ -128,7 +128,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId ) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/FormatTest.java index badd3e2713b4..567314f1e85a 100644 --- a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/FormatTest.java @@ -86,7 +86,7 @@ public FormatTest integer(@Nullable Integer integer) { * maximum: 100 * @return integer */ - @Min(10) @Max(100) + @Min(value = 10) @Max(value = 100) @ApiModelProperty(value = "") @JsonProperty("integer") public @Nullable Integer getInteger() { @@ -108,7 +108,7 @@ public FormatTest int32(@Nullable Integer int32) { * maximum: 200 * @return int32 */ - @Min(20) @Max(200) + @Min(value = 20) @Max(value = 200) @ApiModelProperty(value = "") @JsonProperty("int32") public @Nullable Integer getInt32() { @@ -150,7 +150,7 @@ public FormatTest number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @ApiModelProperty(required = true, value = "") @JsonProperty("number") public BigDecimal getNumber() { @@ -172,7 +172,7 @@ public FormatTest _float(@Nullable Float _float) { * maximum: 987.6 * @return _float */ - @DecimalMin("54.3") @DecimalMax("987.6") + @DecimalMin(value = "54.3") @DecimalMax(value = "987.6") @ApiModelProperty(value = "") @JsonProperty("float") public @Nullable Float getFloat() { @@ -194,7 +194,7 @@ public FormatTest _double(@Nullable Double _double) { * maximum: 123.4 * @return _double */ - @DecimalMin("67.8") @DecimalMax("123.4") + @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @ApiModelProperty(value = "") @JsonProperty("double") public @Nullable Double getDouble() { diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java index cfe5e622e7da..dda008fe6d96 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java @@ -363,14 +363,14 @@ default ResponseEntity testClientModel( ) default ResponseEntity testEndpointParameters( - @ApiParam(value = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, - @ApiParam(value = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, - @ApiParam(value = "None") @Min(10) @Max(100) @Valid @RequestParam(value = "integer", required = false) Integer integer, - @ApiParam(value = "None") @Min(20) @Max(200) @Valid @RequestParam(value = "int32", required = false) Integer int32, + @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, + @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, - @ApiParam(value = "None") @DecimalMax("987.6") @Valid @RequestParam(value = "float", required = false) Float _float, + @ApiParam(value = "None") @DecimalMax(value = "987.6") @Valid @RequestParam(value = "float", required = false) Float _float, @ApiParam(value = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestParam(value = "string", required = false) String string, @ApiParam(value = "None") @RequestPart(value = "binary", required = false) MultipartFile binary, @ApiParam(value = "None") @Valid @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/StoreApi.java index 6e3674540d93..7a0cc34d7306 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/StoreApi.java @@ -122,7 +122,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId ) { return getDelegate().getOrderById(orderId); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/FormatTest.java index badd3e2713b4..567314f1e85a 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/FormatTest.java @@ -86,7 +86,7 @@ public FormatTest integer(@Nullable Integer integer) { * maximum: 100 * @return integer */ - @Min(10) @Max(100) + @Min(value = 10) @Max(value = 100) @ApiModelProperty(value = "") @JsonProperty("integer") public @Nullable Integer getInteger() { @@ -108,7 +108,7 @@ public FormatTest int32(@Nullable Integer int32) { * maximum: 200 * @return int32 */ - @Min(20) @Max(200) + @Min(value = 20) @Max(value = 200) @ApiModelProperty(value = "") @JsonProperty("int32") public @Nullable Integer getInt32() { @@ -150,7 +150,7 @@ public FormatTest number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @ApiModelProperty(required = true, value = "") @JsonProperty("number") public BigDecimal getNumber() { @@ -172,7 +172,7 @@ public FormatTest _float(@Nullable Float _float) { * maximum: 987.6 * @return _float */ - @DecimalMin("54.3") @DecimalMax("987.6") + @DecimalMin(value = "54.3") @DecimalMax(value = "987.6") @ApiModelProperty(value = "") @JsonProperty("float") public @Nullable Float getFloat() { @@ -194,7 +194,7 @@ public FormatTest _double(@Nullable Double _double) { * maximum: 123.4 * @return _double */ - @DecimalMin("67.8") @DecimalMax("123.4") + @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @ApiModelProperty(value = "") @JsonProperty("double") public @Nullable Double getDouble() { diff --git a/samples/server/petstore/springboot-delegate-no-response-entity/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-delegate-no-response-entity/src/main/java/org/openapitools/api/StoreApi.java index 9ad2acb96195..48e5f072cb7c 100644 --- a/samples/server/petstore/springboot-delegate-no-response-entity/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-delegate-no-response-entity/src/main/java/org/openapitools/api/StoreApi.java @@ -125,7 +125,7 @@ default Map getInventory( @ResponseStatus(HttpStatus.OK) default Order getOrderById( - @NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") Long orderId ) { return getDelegate().getOrderById(orderId); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java index cfe5e622e7da..dda008fe6d96 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java @@ -363,14 +363,14 @@ default ResponseEntity testClientModel( ) default ResponseEntity testEndpointParameters( - @ApiParam(value = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, - @ApiParam(value = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, - @ApiParam(value = "None") @Min(10) @Max(100) @Valid @RequestParam(value = "integer", required = false) Integer integer, - @ApiParam(value = "None") @Min(20) @Max(200) @Valid @RequestParam(value = "int32", required = false) Integer int32, + @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, + @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, - @ApiParam(value = "None") @DecimalMax("987.6") @Valid @RequestParam(value = "float", required = false) Float _float, + @ApiParam(value = "None") @DecimalMax(value = "987.6") @Valid @RequestParam(value = "float", required = false) Float _float, @ApiParam(value = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestParam(value = "string", required = false) String string, @ApiParam(value = "None") @RequestPart(value = "binary", required = false) MultipartFile binary, @ApiParam(value = "None") @Valid @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApi.java index 6e3674540d93..7a0cc34d7306 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/StoreApi.java @@ -122,7 +122,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId ) { return getDelegate().getOrderById(orderId); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FormatTest.java index f5c706737b04..876f3b98a4ba 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FormatTest.java @@ -106,7 +106,7 @@ public FormatTest integer(@Nullable Integer integer) { * maximum: 100 * @return integer */ - @Min(10) @Max(100) + @Min(value = 10) @Max(value = 100) @ApiModelProperty(value = "") @JsonProperty("integer") public @Nullable Integer getInteger() { @@ -128,7 +128,7 @@ public FormatTest int32(@Nullable Integer int32) { * maximum: 200 * @return int32 */ - @Min(20) @Max(200) + @Min(value = 20) @Max(value = 200) @ApiModelProperty(value = "") @JsonProperty("int32") public @Nullable Integer getInt32() { @@ -170,7 +170,7 @@ public FormatTest number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @ApiModelProperty(required = true, value = "") @JsonProperty("number") public BigDecimal getNumber() { @@ -192,7 +192,7 @@ public FormatTest _float(@Nullable Float _float) { * maximum: 987.6 * @return _float */ - @DecimalMin("54.3") @DecimalMax("987.6") + @DecimalMin(value = "54.3") @DecimalMax(value = "987.6") @ApiModelProperty(value = "") @JsonProperty("float") public @Nullable Float getFloat() { @@ -214,7 +214,7 @@ public FormatTest _double(@Nullable Double _double) { * maximum: 123.4 * @return _double */ - @DecimalMin("67.8") @DecimalMax("123.4") + @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @ApiModelProperty(value = "") @JsonProperty("double") public @Nullable Double getDouble() { diff --git a/samples/server/petstore/springboot-implicitHeaders-annotationLibrary/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-implicitHeaders-annotationLibrary/src/main/java/org/openapitools/api/StoreApi.java index 7322f6a83d5a..f8298a724929 100644 --- a/samples/server/petstore/springboot-implicitHeaders-annotationLibrary/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-implicitHeaders-annotationLibrary/src/main/java/org/openapitools/api/StoreApi.java @@ -90,7 +90,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @PathVariable("orderId") Long orderId ) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java index 84ded191fdad..f96ecb5e271e 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java @@ -403,14 +403,14 @@ default ResponseEntity testClientModel( ) default ResponseEntity testEndpointParameters( - @ApiParam(value = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, - @ApiParam(value = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, - @ApiParam(value = "None") @Min(10) @Max(100) @Valid @RequestParam(value = "integer", required = false) Integer integer, - @ApiParam(value = "None") @Min(20) @Max(200) @Valid @RequestParam(value = "int32", required = false) Integer int32, + @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, + @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, - @ApiParam(value = "None") @DecimalMax("987.6") @Valid @RequestParam(value = "float", required = false) Float _float, + @ApiParam(value = "None") @DecimalMax(value = "987.6") @Valid @RequestParam(value = "float", required = false) Float _float, @ApiParam(value = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestParam(value = "string", required = false) String string, @ApiParam(value = "None") @RequestPart(value = "binary", required = false) MultipartFile binary, @ApiParam(value = "None") @Valid @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/StoreApi.java index 9db407d6f1b2..5c30d598c4ad 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/StoreApi.java @@ -128,7 +128,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId ) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/FormatTest.java index badd3e2713b4..567314f1e85a 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/FormatTest.java @@ -86,7 +86,7 @@ public FormatTest integer(@Nullable Integer integer) { * maximum: 100 * @return integer */ - @Min(10) @Max(100) + @Min(value = 10) @Max(value = 100) @ApiModelProperty(value = "") @JsonProperty("integer") public @Nullable Integer getInteger() { @@ -108,7 +108,7 @@ public FormatTest int32(@Nullable Integer int32) { * maximum: 200 * @return int32 */ - @Min(20) @Max(200) + @Min(value = 20) @Max(value = 200) @ApiModelProperty(value = "") @JsonProperty("int32") public @Nullable Integer getInt32() { @@ -150,7 +150,7 @@ public FormatTest number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @ApiModelProperty(required = true, value = "") @JsonProperty("number") public BigDecimal getNumber() { @@ -172,7 +172,7 @@ public FormatTest _float(@Nullable Float _float) { * maximum: 987.6 * @return _float */ - @DecimalMin("54.3") @DecimalMax("987.6") + @DecimalMin(value = "54.3") @DecimalMax(value = "987.6") @ApiModelProperty(value = "") @JsonProperty("float") public @Nullable Float getFloat() { @@ -194,7 +194,7 @@ public FormatTest _double(@Nullable Double _double) { * maximum: 123.4 * @return _double */ - @DecimalMin("67.8") @DecimalMax("123.4") + @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @ApiModelProperty(value = "") @JsonProperty("double") public @Nullable Double getDouble() { diff --git a/samples/server/petstore/springboot-lombok-data/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-lombok-data/src/main/java/org/openapitools/api/StoreApi.java index 20a928253047..f31f1ec336f2 100644 --- a/samples/server/petstore/springboot-lombok-data/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-lombok-data/src/main/java/org/openapitools/api/StoreApi.java @@ -141,7 +141,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId ) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/api/StoreApi.java index 59ba999b5c8d..e77744de94ce 100644 --- a/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/api/StoreApi.java @@ -141,7 +141,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId ) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/server/petstore/springboot-petstore-with-api-response-examples/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-petstore-with-api-response-examples/src/main/java/org/openapitools/api/StoreApi.java index 1850bdca5561..daefc25e679d 100644 --- a/samples/server/petstore/springboot-petstore-with-api-response-examples/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-petstore-with-api-response-examples/src/main/java/org/openapitools/api/StoreApi.java @@ -135,7 +135,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId ) { return getDelegate().getOrderById(orderId); } diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java index bbc3cdc970a7..e0925c19791c 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java @@ -387,14 +387,14 @@ default Mono testClientModel( @ResponseStatus(HttpStatus.BAD_REQUEST) default Mono testEndpointParameters( - @ApiParam(value = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestPart(value = "number", required = true) BigDecimal number, - @ApiParam(value = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestPart(value = "double", required = true) Double _double, + @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestPart(value = "number", required = true) BigDecimal number, + @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestPart(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestPart(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @ApiParam(value = "None", required = true) @Valid @RequestPart(value = "byte", required = true) byte[] _byte, - @ApiParam(value = "None") @Min(10) @Max(100) @Valid @RequestPart(value = "integer", required = false) Integer integer, - @ApiParam(value = "None") @Min(20) @Max(200) @Valid @RequestPart(value = "int32", required = false) Integer int32, + @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestPart(value = "integer", required = false) Integer integer, + @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestPart(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestPart(value = "int64", required = false) Long int64, - @ApiParam(value = "None") @DecimalMax("987.6") @Valid @RequestPart(value = "float", required = false) Float _float, + @ApiParam(value = "None") @DecimalMax(value = "987.6") @Valid @RequestPart(value = "float", required = false) Float _float, @ApiParam(value = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestPart(value = "string", required = false) String string, @ApiParam(value = "None") @RequestPart(value = "binary", required = false) Part binary, @ApiParam(value = "None") @Valid @RequestPart(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/StoreApi.java index 9c1f67fb7721..03dd2811423a 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/StoreApi.java @@ -131,7 +131,7 @@ default Mono> getInventory( @ResponseStatus(HttpStatus.OK) default Mono getOrderById( - @NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId, + @NotNull @Min(value = 1L) @Max(value = 5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId, @ApiIgnore final ServerWebExchange exchange ) { return getDelegate().getOrderById(orderId, exchange); diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/FormatTest.java index badd3e2713b4..567314f1e85a 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/FormatTest.java @@ -86,7 +86,7 @@ public FormatTest integer(@Nullable Integer integer) { * maximum: 100 * @return integer */ - @Min(10) @Max(100) + @Min(value = 10) @Max(value = 100) @ApiModelProperty(value = "") @JsonProperty("integer") public @Nullable Integer getInteger() { @@ -108,7 +108,7 @@ public FormatTest int32(@Nullable Integer int32) { * maximum: 200 * @return int32 */ - @Min(20) @Max(200) + @Min(value = 20) @Max(value = 200) @ApiModelProperty(value = "") @JsonProperty("int32") public @Nullable Integer getInt32() { @@ -150,7 +150,7 @@ public FormatTest number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @ApiModelProperty(required = true, value = "") @JsonProperty("number") public BigDecimal getNumber() { @@ -172,7 +172,7 @@ public FormatTest _float(@Nullable Float _float) { * maximum: 987.6 * @return _float */ - @DecimalMin("54.3") @DecimalMax("987.6") + @DecimalMin(value = "54.3") @DecimalMax(value = "987.6") @ApiModelProperty(value = "") @JsonProperty("float") public @Nullable Float getFloat() { @@ -194,7 +194,7 @@ public FormatTest _double(@Nullable Double _double) { * maximum: 123.4 * @return _double */ - @DecimalMin("67.8") @DecimalMax("123.4") + @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @ApiModelProperty(value = "") @JsonProperty("double") public @Nullable Double getDouble() { diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java index f627d54a4154..e1d7f2b8f0f9 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java @@ -377,14 +377,14 @@ default Mono> testClientModel( ) default Mono> testEndpointParameters( - @ApiParam(value = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestPart(value = "number", required = true) BigDecimal number, - @ApiParam(value = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestPart(value = "double", required = true) Double _double, + @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestPart(value = "number", required = true) BigDecimal number, + @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestPart(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestPart(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @ApiParam(value = "None", required = true) @Valid @RequestPart(value = "byte", required = true) byte[] _byte, - @ApiParam(value = "None") @Min(10) @Max(100) @Valid @RequestPart(value = "integer", required = false) Integer integer, - @ApiParam(value = "None") @Min(20) @Max(200) @Valid @RequestPart(value = "int32", required = false) Integer int32, + @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestPart(value = "integer", required = false) Integer integer, + @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestPart(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestPart(value = "int64", required = false) Long int64, - @ApiParam(value = "None") @DecimalMax("987.6") @Valid @RequestPart(value = "float", required = false) Float _float, + @ApiParam(value = "None") @DecimalMax(value = "987.6") @Valid @RequestPart(value = "float", required = false) Float _float, @ApiParam(value = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestPart(value = "string", required = false) String string, @ApiParam(value = "None") @RequestPart(value = "binary", required = false) Part binary, @ApiParam(value = "None") @Valid @RequestPart(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApi.java index b1b090aef442..87213fed908c 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApi.java @@ -128,7 +128,7 @@ default Mono>> getInventory( ) default Mono> getOrderById( - @NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId, + @NotNull @Min(value = 1L) @Max(value = 5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId, @ApiIgnore final ServerWebExchange exchange ) { return getDelegate().getOrderById(orderId, exchange); diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/FormatTest.java index badd3e2713b4..567314f1e85a 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/FormatTest.java @@ -86,7 +86,7 @@ public FormatTest integer(@Nullable Integer integer) { * maximum: 100 * @return integer */ - @Min(10) @Max(100) + @Min(value = 10) @Max(value = 100) @ApiModelProperty(value = "") @JsonProperty("integer") public @Nullable Integer getInteger() { @@ -108,7 +108,7 @@ public FormatTest int32(@Nullable Integer int32) { * maximum: 200 * @return int32 */ - @Min(20) @Max(200) + @Min(value = 20) @Max(value = 200) @ApiModelProperty(value = "") @JsonProperty("int32") public @Nullable Integer getInt32() { @@ -150,7 +150,7 @@ public FormatTest number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @ApiModelProperty(required = true, value = "") @JsonProperty("number") public BigDecimal getNumber() { @@ -172,7 +172,7 @@ public FormatTest _float(@Nullable Float _float) { * maximum: 987.6 * @return _float */ - @DecimalMin("54.3") @DecimalMax("987.6") + @DecimalMin(value = "54.3") @DecimalMax(value = "987.6") @ApiModelProperty(value = "") @JsonProperty("float") public @Nullable Float getFloat() { @@ -194,7 +194,7 @@ public FormatTest _double(@Nullable Double _double) { * maximum: 123.4 * @return _double */ - @DecimalMin("67.8") @DecimalMax("123.4") + @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @ApiModelProperty(value = "") @JsonProperty("double") public @Nullable Double getDouble() { diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/FakeApi.java index ea0567452ce0..e3ba5bbbd4da 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/FakeApi.java @@ -327,14 +327,14 @@ default ResponseEntity testClientModel( ) default ResponseEntity testEndpointParameters( - @ApiParam(value = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, - @ApiParam(value = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, - @ApiParam(value = "None") @Min(10) @Max(100) @Valid @RequestParam(value = "integer", required = false) Integer integer, - @ApiParam(value = "None") @Min(20) @Max(200) @Valid @RequestParam(value = "int32", required = false) Integer int32, + @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, + @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, - @ApiParam(value = "None") @DecimalMax("987.6") @Valid @RequestParam(value = "float", required = false) Float _float, + @ApiParam(value = "None") @DecimalMax(value = "987.6") @Valid @RequestParam(value = "float", required = false) Float _float, @ApiParam(value = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestParam(value = "string", required = false) String string, @ApiParam(value = "None") @RequestPart(value = "binary", required = false) MultipartFile binary, @ApiParam(value = "None") @Valid @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/StoreApi.java index aa1454a2cb7f..bcbff1d410d4 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/StoreApi.java @@ -122,7 +122,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId ) { return getDelegate().getOrderById(orderId); } diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/FormatTest.java index badd3e2713b4..567314f1e85a 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/FormatTest.java @@ -86,7 +86,7 @@ public FormatTest integer(@Nullable Integer integer) { * maximum: 100 * @return integer */ - @Min(10) @Max(100) + @Min(value = 10) @Max(value = 100) @ApiModelProperty(value = "") @JsonProperty("integer") public @Nullable Integer getInteger() { @@ -108,7 +108,7 @@ public FormatTest int32(@Nullable Integer int32) { * maximum: 200 * @return int32 */ - @Min(20) @Max(200) + @Min(value = 20) @Max(value = 200) @ApiModelProperty(value = "") @JsonProperty("int32") public @Nullable Integer getInt32() { @@ -150,7 +150,7 @@ public FormatTest number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @ApiModelProperty(required = true, value = "") @JsonProperty("number") public BigDecimal getNumber() { @@ -172,7 +172,7 @@ public FormatTest _float(@Nullable Float _float) { * maximum: 987.6 * @return _float */ - @DecimalMin("54.3") @DecimalMax("987.6") + @DecimalMin(value = "54.3") @DecimalMax(value = "987.6") @ApiModelProperty(value = "") @JsonProperty("float") public @Nullable Float getFloat() { @@ -194,7 +194,7 @@ public FormatTest _double(@Nullable Double _double) { * maximum: 123.4 * @return _double */ - @DecimalMin("67.8") @DecimalMax("123.4") + @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @ApiModelProperty(value = "") @JsonProperty("double") public @Nullable Double getDouble() { diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/FakeApi.java index ea0567452ce0..e3ba5bbbd4da 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/FakeApi.java @@ -327,14 +327,14 @@ default ResponseEntity testClientModel( ) default ResponseEntity testEndpointParameters( - @ApiParam(value = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, - @ApiParam(value = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, - @ApiParam(value = "None") @Min(10) @Max(100) @Valid @RequestParam(value = "integer", required = false) Integer integer, - @ApiParam(value = "None") @Min(20) @Max(200) @Valid @RequestParam(value = "int32", required = false) Integer int32, + @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, + @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, - @ApiParam(value = "None") @DecimalMax("987.6") @Valid @RequestParam(value = "float", required = false) Float _float, + @ApiParam(value = "None") @DecimalMax(value = "987.6") @Valid @RequestParam(value = "float", required = false) Float _float, @ApiParam(value = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestParam(value = "string", required = false) String string, @ApiParam(value = "None") @RequestPart(value = "binary", required = false) MultipartFile binary, @ApiParam(value = "None") @Valid @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/StoreApi.java index aa1454a2cb7f..bcbff1d410d4 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/StoreApi.java @@ -122,7 +122,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId ) { return getDelegate().getOrderById(orderId); } diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/FormatTest.java index badd3e2713b4..567314f1e85a 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/FormatTest.java @@ -86,7 +86,7 @@ public FormatTest integer(@Nullable Integer integer) { * maximum: 100 * @return integer */ - @Min(10) @Max(100) + @Min(value = 10) @Max(value = 100) @ApiModelProperty(value = "") @JsonProperty("integer") public @Nullable Integer getInteger() { @@ -108,7 +108,7 @@ public FormatTest int32(@Nullable Integer int32) { * maximum: 200 * @return int32 */ - @Min(20) @Max(200) + @Min(value = 20) @Max(value = 200) @ApiModelProperty(value = "") @JsonProperty("int32") public @Nullable Integer getInt32() { @@ -150,7 +150,7 @@ public FormatTest number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @ApiModelProperty(required = true, value = "") @JsonProperty("number") public BigDecimal getNumber() { @@ -172,7 +172,7 @@ public FormatTest _float(@Nullable Float _float) { * maximum: 987.6 * @return _float */ - @DecimalMin("54.3") @DecimalMax("987.6") + @DecimalMin(value = "54.3") @DecimalMax(value = "987.6") @ApiModelProperty(value = "") @JsonProperty("float") public @Nullable Float getFloat() { @@ -194,7 +194,7 @@ public FormatTest _double(@Nullable Double _double) { * maximum: 123.4 * @return _double */ - @DecimalMin("67.8") @DecimalMax("123.4") + @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @ApiModelProperty(value = "") @JsonProperty("double") public @Nullable Double getDouble() { diff --git a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/FakeApi.java index 858206ed6b10..032a566fb077 100644 --- a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/FakeApi.java @@ -357,14 +357,14 @@ default ResponseEntity testClientModel( ) default ResponseEntity testEndpointParameters( - @ApiParam(value = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, - @ApiParam(value = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, - @ApiParam(value = "None") @Min(10) @Max(100) @Valid @RequestParam(value = "integer", required = false) Integer integer, - @ApiParam(value = "None") @Min(20) @Max(200) @Valid @RequestParam(value = "int32", required = false) Integer int32, + @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, + @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, - @ApiParam(value = "None") @DecimalMax("987.6") @Valid @RequestParam(value = "float", required = false) Float _float, + @ApiParam(value = "None") @DecimalMax(value = "987.6") @Valid @RequestParam(value = "float", required = false) Float _float, @ApiParam(value = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestParam(value = "string", required = false) String string, @ApiParam(value = "None") @RequestPart(value = "binary", required = false) MultipartFile binary, @ApiParam(value = "None") @Valid @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, diff --git a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/StoreApi.java index 3b4c9bf408f0..146a0aeb86dd 100644 --- a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/StoreApi.java @@ -128,7 +128,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId ) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/FormatTest.java index badd3e2713b4..567314f1e85a 100644 --- a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/FormatTest.java @@ -86,7 +86,7 @@ public FormatTest integer(@Nullable Integer integer) { * maximum: 100 * @return integer */ - @Min(10) @Max(100) + @Min(value = 10) @Max(value = 100) @ApiModelProperty(value = "") @JsonProperty("integer") public @Nullable Integer getInteger() { @@ -108,7 +108,7 @@ public FormatTest int32(@Nullable Integer int32) { * maximum: 200 * @return int32 */ - @Min(20) @Max(200) + @Min(value = 20) @Max(value = 200) @ApiModelProperty(value = "") @JsonProperty("int32") public @Nullable Integer getInt32() { @@ -150,7 +150,7 @@ public FormatTest number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @ApiModelProperty(required = true, value = "") @JsonProperty("number") public BigDecimal getNumber() { @@ -172,7 +172,7 @@ public FormatTest _float(@Nullable Float _float) { * maximum: 987.6 * @return _float */ - @DecimalMin("54.3") @DecimalMax("987.6") + @DecimalMin(value = "54.3") @DecimalMax(value = "987.6") @ApiModelProperty(value = "") @JsonProperty("float") public @Nullable Float getFloat() { @@ -194,7 +194,7 @@ public FormatTest _double(@Nullable Double _double) { * maximum: 123.4 * @return _double */ - @DecimalMin("67.8") @DecimalMax("123.4") + @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @ApiModelProperty(value = "") @JsonProperty("double") public @Nullable Double getDouble() { diff --git a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/FakeApi.java index 858206ed6b10..032a566fb077 100644 --- a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/FakeApi.java @@ -357,14 +357,14 @@ default ResponseEntity testClientModel( ) default ResponseEntity testEndpointParameters( - @ApiParam(value = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, - @ApiParam(value = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, - @ApiParam(value = "None") @Min(10) @Max(100) @Valid @RequestParam(value = "integer", required = false) Integer integer, - @ApiParam(value = "None") @Min(20) @Max(200) @Valid @RequestParam(value = "int32", required = false) Integer int32, + @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, + @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, - @ApiParam(value = "None") @DecimalMax("987.6") @Valid @RequestParam(value = "float", required = false) Float _float, + @ApiParam(value = "None") @DecimalMax(value = "987.6") @Valid @RequestParam(value = "float", required = false) Float _float, @ApiParam(value = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestParam(value = "string", required = false) String string, @ApiParam(value = "None") @RequestPart(value = "binary", required = false) MultipartFile binary, @ApiParam(value = "None") @Valid @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, diff --git a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/StoreApi.java index 3b4c9bf408f0..146a0aeb86dd 100644 --- a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/StoreApi.java @@ -128,7 +128,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId ) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/FormatTest.java index badd3e2713b4..567314f1e85a 100644 --- a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/FormatTest.java @@ -86,7 +86,7 @@ public FormatTest integer(@Nullable Integer integer) { * maximum: 100 * @return integer */ - @Min(10) @Max(100) + @Min(value = 10) @Max(value = 100) @ApiModelProperty(value = "") @JsonProperty("integer") public @Nullable Integer getInteger() { @@ -108,7 +108,7 @@ public FormatTest int32(@Nullable Integer int32) { * maximum: 200 * @return int32 */ - @Min(20) @Max(200) + @Min(value = 20) @Max(value = 200) @ApiModelProperty(value = "") @JsonProperty("int32") public @Nullable Integer getInt32() { @@ -150,7 +150,7 @@ public FormatTest number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @ApiModelProperty(required = true, value = "") @JsonProperty("number") public BigDecimal getNumber() { @@ -172,7 +172,7 @@ public FormatTest _float(@Nullable Float _float) { * maximum: 987.6 * @return _float */ - @DecimalMin("54.3") @DecimalMax("987.6") + @DecimalMin(value = "54.3") @DecimalMax(value = "987.6") @ApiModelProperty(value = "") @JsonProperty("float") public @Nullable Float getFloat() { @@ -194,7 +194,7 @@ public FormatTest _double(@Nullable Double _double) { * maximum: 123.4 * @return _double */ - @DecimalMin("67.8") @DecimalMax("123.4") + @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @ApiModelProperty(value = "") @JsonProperty("double") public @Nullable Double getDouble() { diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java index 20350d1136e5..ba60546483e8 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java @@ -403,8 +403,8 @@ default ResponseEntity testClientModel( ) default ResponseEntity testEndpointParameters( - @ApiParam(value = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, - @ApiParam(value = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, @ApiParam(value = "None") @Valid @RequestParam(value = "integer", required = false) Optional integer, diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/StoreApi.java index 9db407d6f1b2..5c30d598c4ad 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/StoreApi.java @@ -128,7 +128,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId ) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java index 43a0da5c68f5..3fffde154c05 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java @@ -31,17 +31,17 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") public class FormatTest { - private Optional<@Min(10) @Max(100) Integer> integer = Optional.empty(); + private Optional<@Min(value = 10) @Max(value = 100) Integer> integer = Optional.empty(); - private Optional<@Min(20) @Max(200) Integer> int32 = Optional.empty(); + private Optional<@Min(value = 20) @Max(value = 200) Integer> int32 = Optional.empty(); private Optional int64 = Optional.empty(); private BigDecimal number; - private Optional<@DecimalMin("54.3") @DecimalMax("987.6") Float> _float = Optional.empty(); + private Optional<@DecimalMin(value = "54.3") @DecimalMax(value = "987.6") Float> _float = Optional.empty(); - private Optional<@DecimalMin("67.8") @DecimalMax("123.4") Double> _double = Optional.empty(); + private Optional<@DecimalMin(value = "67.8") @DecimalMax(value = "123.4") Double> _double = Optional.empty(); private Optional<@Pattern(regexp = "/[a-z]/i") String> string = Optional.empty(); @@ -89,7 +89,7 @@ public FormatTest integer(Integer integer) { @ApiModelProperty(value = "") @JsonProperty("integer") - public Optional<@Min(10) @Max(100) Integer> getInteger() { + public Optional<@Min(value = 10) @Max(value = 100) Integer> getInteger() { return integer; } @@ -111,7 +111,7 @@ public FormatTest int32(Integer int32) { @ApiModelProperty(value = "") @JsonProperty("int32") - public Optional<@Min(20) @Max(200) Integer> getInt32() { + public Optional<@Min(value = 20) @Max(value = 200) Integer> getInt32() { return int32; } @@ -150,7 +150,7 @@ public FormatTest number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @ApiModelProperty(required = true, value = "") @JsonProperty("number") public BigDecimal getNumber() { @@ -175,7 +175,7 @@ public FormatTest _float(Float _float) { @ApiModelProperty(value = "") @JsonProperty("float") - public Optional<@DecimalMin("54.3") @DecimalMax("987.6") Float> getFloat() { + public Optional<@DecimalMin(value = "54.3") @DecimalMax(value = "987.6") Float> getFloat() { return _float; } @@ -197,7 +197,7 @@ public FormatTest _double(Double _double) { @ApiModelProperty(value = "") @JsonProperty("double") - public Optional<@DecimalMin("67.8") @DecimalMax("123.4") Double> getDouble() { + public Optional<@DecimalMin(value = "67.8") @DecimalMax(value = "123.4") Double> getDouble() { return _double; } diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java index 781e8ed74dd8..5c6ebaceeecd 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java @@ -424,14 +424,14 @@ default ResponseEntity testClientModel( ) default ResponseEntity testEndpointParameters( - @Parameter(name = "number", description = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, - @Parameter(name = "double", description = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @Parameter(name = "number", description = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @Parameter(name = "double", description = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @Parameter(name = "pattern_without_delimiter", description = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @Parameter(name = "byte", description = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, - @Parameter(name = "integer", description = "None") @Min(10) @Max(100) @Valid @RequestParam(value = "integer", required = false) Integer integer, - @Parameter(name = "int32", description = "None") @Min(20) @Max(200) @Valid @RequestParam(value = "int32", required = false) Integer int32, + @Parameter(name = "integer", description = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, + @Parameter(name = "int32", description = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @Parameter(name = "int64", description = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, - @Parameter(name = "float", description = "None") @DecimalMax("987.6") @Valid @RequestParam(value = "float", required = false) Float _float, + @Parameter(name = "float", description = "None") @DecimalMax(value = "987.6") @Valid @RequestParam(value = "float", required = false) Float _float, @Parameter(name = "string", description = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestParam(value = "string", required = false) String string, @Parameter(name = "binary", description = "None") @RequestPart(value = "binary", required = false) MultipartFile binary, @Parameter(name = "date", description = "None") @Valid @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/StoreApi.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/StoreApi.java index 43bdca95ebc5..e1e320ad4324 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/StoreApi.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/StoreApi.java @@ -147,7 +147,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @Parameter(name = "order_id", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("order_id") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "order_id", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("order_id") Long orderId ) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/FormatTest.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/FormatTest.java index 11ac50e1d479..c7998fa8d670 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/FormatTest.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/FormatTest.java @@ -85,7 +85,7 @@ public FormatTest integer(@Nullable Integer integer) { * maximum: 100 * @return integer */ - @Min(10) @Max(100) + @Min(value = 10) @Max(value = 100) @Schema(name = "integer", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("integer") public @Nullable Integer getInteger() { @@ -107,7 +107,7 @@ public FormatTest int32(@Nullable Integer int32) { * maximum: 200 * @return int32 */ - @Min(20) @Max(200) + @Min(value = 20) @Max(value = 200) @Schema(name = "int32", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("int32") public @Nullable Integer getInt32() { @@ -149,7 +149,7 @@ public FormatTest number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Schema(name = "number", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("number") public BigDecimal getNumber() { @@ -171,7 +171,7 @@ public FormatTest _float(@Nullable Float _float) { * maximum: 987.6 * @return _float */ - @DecimalMin("54.3") @DecimalMax("987.6") + @DecimalMin(value = "54.3") @DecimalMax(value = "987.6") @Schema(name = "float", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("float") public @Nullable Float getFloat() { @@ -193,7 +193,7 @@ public FormatTest _double(@Nullable Double _double) { * maximum: 123.4 * @return _double */ - @DecimalMin("67.8") @DecimalMax("123.4") + @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Schema(name = "double", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonProperty("double") public @Nullable Double getDouble() { diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java index 4dccefae10d6..59567e6a37ce 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java @@ -403,14 +403,14 @@ default ResponseEntity testClientModel( ) default ResponseEntity testEndpointParameters( - @ApiParam(value = "None", required = true) @DecimalMin("32.1") @DecimalMax("543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, - @ApiParam(value = "None", required = true) @DecimalMin("67.8") @DecimalMax("123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, - @ApiParam(value = "None") @Min(10) @Max(100) @Valid @RequestParam(value = "integer", required = false) Integer integer, - @ApiParam(value = "None") @Min(20) @Max(200) @Valid @RequestParam(value = "int32", required = false) Integer int32, + @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, + @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, - @ApiParam(value = "None") @DecimalMax("987.6") @Valid @RequestParam(value = "float", required = false) Float _float, + @ApiParam(value = "None") @DecimalMax(value = "987.6") @Valid @RequestParam(value = "float", required = false) Float _float, @ApiParam(value = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestParam(value = "string", required = false) String string, @ApiParam(value = "None") @RequestPart(value = "binary", required = false) MultipartFile binary, @ApiParam(value = "None") @Valid @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/StoreApi.java index b6b7acb5075c..307dbf9fe3c7 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/StoreApi.java @@ -128,7 +128,7 @@ default ResponseEntity> getInventory( ) default ResponseEntity getOrderById( - @NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId + @NotNull @Min(value = 1L) @Max(value = 5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId ) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/FormatTestDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/FormatTestDto.java index abafe102a10d..9bb5f020065c 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/FormatTestDto.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/FormatTestDto.java @@ -86,7 +86,7 @@ public FormatTestDto integer(@Nullable Integer integer) { * maximum: 100 * @return integer */ - @Min(10) @Max(100) + @Min(value = 10) @Max(value = 100) @ApiModelProperty(value = "") @JsonProperty("integer") public @Nullable Integer getInteger() { @@ -108,7 +108,7 @@ public FormatTestDto int32(@Nullable Integer int32) { * maximum: 200 * @return int32 */ - @Min(20) @Max(200) + @Min(value = 20) @Max(value = 200) @ApiModelProperty(value = "") @JsonProperty("int32") public @Nullable Integer getInt32() { @@ -150,7 +150,7 @@ public FormatTestDto number(BigDecimal number) { * maximum: 543.2 * @return number */ - @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + @NotNull @Valid @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @ApiModelProperty(required = true, value = "") @JsonProperty("number") public BigDecimal getNumber() { @@ -172,7 +172,7 @@ public FormatTestDto _float(@Nullable Float _float) { * maximum: 987.6 * @return _float */ - @DecimalMin("54.3") @DecimalMax("987.6") + @DecimalMin(value = "54.3") @DecimalMax(value = "987.6") @ApiModelProperty(value = "") @JsonProperty("float") public @Nullable Float getFloat() { @@ -194,7 +194,7 @@ public FormatTestDto _double(@Nullable Double _double) { * maximum: 123.4 * @return _double */ - @DecimalMin("67.8") @DecimalMax("123.4") + @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @ApiModelProperty(value = "") @JsonProperty("double") public @Nullable Double getDouble() {