From a87f55900f5ffecbe4035e54d1d46c86b9f0e99c Mon Sep 17 00:00:00 2001 From: Peter Storch Date: Fri, 9 May 2025 21:45:12 +0200 Subject: [PATCH] fix #21238 regression in kotlin-spring generator --- .../src/main/resources/kotlin-spring/queryParams.mustache | 2 +- .../src/main/kotlin/org/openapitools/api/PetApi.kt | 4 ++-- .../src/main/kotlin/org/openapitools/api/UserApi.kt | 2 +- .../src/main/kotlin/org/openapitools/api/PetApiController.kt | 4 ++-- .../src/main/kotlin/org/openapitools/api/UserApiController.kt | 2 +- .../src/main/kotlin/org/openapitools/api/PetApiController.kt | 4 ++-- .../src/main/kotlin/org/openapitools/api/UserApiController.kt | 2 +- .../src/main/kotlin/org/openapitools/api/PetApi.kt | 4 ++-- .../src/main/kotlin/org/openapitools/api/UserApi.kt | 2 +- .../src/main/kotlin/org/openapitools/api/PetApi.kt | 4 ++-- .../src/main/kotlin/org/openapitools/api/UserApi.kt | 2 +- .../src/main/kotlin/org/openapitools/api/PetApiController.kt | 4 ++-- .../src/main/kotlin/org/openapitools/api/UserApiController.kt | 2 +- .../src/main/kotlin/org/openapitools/api/PetApiController.kt | 4 ++-- .../src/main/kotlin/org/openapitools/api/UserApiController.kt | 2 +- .../src/main/kotlin/org/openapitools/api/PetApiController.kt | 4 ++-- .../src/main/kotlin/org/openapitools/api/UserApiController.kt | 2 +- .../src/main/kotlin/org/openapitools/api/PetApi.kt | 4 ++-- .../src/main/kotlin/org/openapitools/api/UserApi.kt | 2 +- .../src/main/kotlin/org/openapitools/api/PetApiController.kt | 4 ++-- .../src/main/kotlin/org/openapitools/api/UserApiController.kt | 2 +- .../src/main/kotlin/org/openapitools/api/PetApiController.kt | 4 ++-- .../src/main/kotlin/org/openapitools/api/UserApiController.kt | 2 +- .../src/main/kotlin/org/openapitools/api/PetApiController.kt | 4 ++-- .../src/main/kotlin/org/openapitools/api/UserApiController.kt | 2 +- .../src/main/kotlin/org/openapitools/api/PetApiController.kt | 4 ++-- .../src/main/kotlin/org/openapitools/api/UserApiController.kt | 2 +- 27 files changed, 40 insertions(+), 40 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/queryParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/queryParams.mustache index 0c9d5f15499..2bf764c9963 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/queryParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/queryParams.mustache @@ -1 +1 @@ -{{#isQueryParam}}{{^isModel}} @RequestParam(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{^isContainer}}{{#defaultValue}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}){{/isModel}}{{#isDate}} @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE){{/isDate}}{{#isDateTime}} @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME){{/isDateTime}} {{{paramName}}}: {{>optionalDataType}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/isContainer}}{{/defaultValue}}{{/allowableValues}}){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}){{/swagger1AnnotationLibrary}}{{#useBeanValidation}} @Valid{{/useBeanValidation}}{{^isModel}} @RequestParam(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{^isContainer}}{{#defaultValue}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}){{/isModel}}{{#isDate}} @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE){{/isDate}}{{#isDateTime}} @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME){{/isDateTime}} {{{paramName}}}: {{>optionalDataType}}{{/isQueryParam}} \ No newline at end of file diff --git a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/PetApi.kt index 735ebcdc70d..5c33996c1eb 100644 --- a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/PetApi.kt +++ b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -58,7 +58,7 @@ interface PetApi { value = ["/pet/findByStatus"], produces = ["application/xml", "application/json"] ) - fun findPetsByStatus( @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { + fun findPetsByStatus(@NotNull @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } @@ -68,7 +68,7 @@ interface PetApi { value = ["/pet/findByTags"], produces = ["application/xml", "application/json"] ) - fun findPetsByTags( @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { + fun findPetsByTags(@NotNull @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } diff --git a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/UserApi.kt index fa1122f23a7..1eafbf6dbcb 100644 --- a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/UserApi.kt +++ b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -86,7 +86,7 @@ interface UserApi { value = ["/user/login"], produces = ["application/xml", "application/json"] ) - fun loginUser( @RequestParam(value = "username", required = true) username: kotlin.String, @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { + fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @Valid @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/PetApiController.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/PetApiController.kt index 92ce7d2bf8b..3e424010725 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/PetApiController.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/PetApiController.kt @@ -83,7 +83,7 @@ class PetApiController() { value = ["/pet/findByStatus"], produces = ["application/xml", "application/json"] ) - fun findPetsByStatus( @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { + fun findPetsByStatus(@NotNull @Parameter(description = "Status values that need to be considered for filter", required = true, schema = Schema(allowableValues = ["available", "pending", "sold"])) @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } @@ -101,7 +101,7 @@ class PetApiController() { value = ["/pet/findByTags"], produces = ["application/xml", "application/json"] ) - fun findPetsByTags( @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { + fun findPetsByTags(@NotNull @Parameter(description = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/UserApiController.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/UserApiController.kt index 16d71e61198..6577de75e45 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/UserApiController.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/UserApiController.kt @@ -132,7 +132,7 @@ class UserApiController() { value = ["/user/login"], produces = ["application/xml", "application/json"] ) - fun loginUser( @RequestParam(value = "username", required = true) username: kotlin.String, @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { + fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @Parameter(description = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @Parameter(description = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/PetApiController.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/PetApiController.kt index 7cbaca3438a..cd920cd5bcd 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/PetApiController.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/PetApiController.kt @@ -54,7 +54,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByStatus"], produces = ["application/xml", "application/json"] ) - fun findPetsByStatus( @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { + fun findPetsByStatus(@NotNull @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200)) } @@ -64,7 +64,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByTags"], produces = ["application/xml", "application/json"] ) - fun findPetsByTags( @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { + fun findPetsByTags(@NotNull @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/UserApiController.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/UserApiController.kt index e17ce507943..ce2c67c6042 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/UserApiController.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/UserApiController.kt @@ -82,7 +82,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/login"], produces = ["application/xml", "application/json"] ) - fun loginUser( @RequestParam(value = "username", required = true) username: kotlin.String, @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { + fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @Valid @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { return ResponseEntity(service.loginUser(username, password), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/PetApi.kt index c3d1329d10b..5f170061d0f 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/PetApi.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -96,7 +96,7 @@ interface PetApi { value = ["/pet/findByStatus"], produces = ["application/xml", "application/json"] ) - fun findPetsByStatus( @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { + fun findPetsByStatus(@NotNull @Parameter(description = "Status values that need to be considered for filter", required = true, schema = Schema(allowableValues = ["available", "pending", "sold"])) @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { return getDelegate().findPetsByStatus(status) } @@ -116,7 +116,7 @@ interface PetApi { value = ["/pet/findByTags"], produces = ["application/xml", "application/json"] ) - fun findPetsByTags( @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { + fun findPetsByTags(@NotNull @Parameter(description = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { return getDelegate().findPetsByTags(tags) } diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/UserApi.kt index 7155a4a8548..a256d8f8297 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/UserApi.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -151,7 +151,7 @@ interface UserApi { value = ["/user/login"], produces = ["application/xml", "application/json"] ) - fun loginUser( @RequestParam(value = "username", required = true) username: kotlin.String, @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { + fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @Parameter(description = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @Parameter(description = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { return getDelegate().loginUser(username, password) } diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/PetApi.kt index b929aa9d1b7..1b35209c6c2 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/PetApi.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -95,7 +95,7 @@ interface PetApi { value = ["/pet/findByStatus"], produces = ["application/xml", "application/json"] ) - fun findPetsByStatus( @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { + fun findPetsByStatus(@NotNull @Parameter(description = "Status values that need to be considered for filter", required = true, schema = Schema(allowableValues = ["available", "pending", "sold"])) @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { return getDelegate().findPetsByStatus(status) } @@ -115,7 +115,7 @@ interface PetApi { value = ["/pet/findByTags"], produces = ["application/xml", "application/json"] ) - fun findPetsByTags( @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { + fun findPetsByTags(@NotNull @Parameter(description = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { return getDelegate().findPetsByTags(tags) } diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/UserApi.kt index f95ac2e2ffa..e5205fccff2 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/UserApi.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -150,7 +150,7 @@ interface UserApi { value = ["/user/login"], produces = ["application/xml", "application/json"] ) - fun loginUser( @RequestParam(value = "username", required = true) username: kotlin.String, @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { + fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @Parameter(description = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @Parameter(description = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { return getDelegate().loginUser(username, password) } diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiController.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiController.kt index 7da41ce41bb..84c4333e894 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiController.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiController.kt @@ -81,7 +81,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByStatus"], produces = ["application/xml", "application/json"] ) - fun findPetsByStatus( @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { + fun findPetsByStatus(@NotNull @Parameter(description = "Status values that need to be considered for filter", required = true, schema = Schema(allowableValues = ["available", "pending", "sold"])) @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200)) } @@ -99,7 +99,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByTags"], produces = ["application/xml", "application/json"] ) - fun findPetsByTags( @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { + fun findPetsByTags(@NotNull @Parameter(description = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiController.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiController.kt index 122134a7ce9..08160bfaf0f 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiController.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiController.kt @@ -125,7 +125,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/login"], produces = ["application/xml", "application/json"] ) - fun loginUser( @RequestParam(value = "username", required = true) username: kotlin.String, @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { + fun loginUser(@NotNull @Parameter(description = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @Parameter(description = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { return ResponseEntity(service.loginUser(username, password), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/api/PetApiController.kt b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/api/PetApiController.kt index d57aaaf4657..05575e31959 100644 --- a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/api/PetApiController.kt +++ b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/api/PetApiController.kt @@ -84,7 +84,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByStatus"], produces = ["application/xml", "application/json"] ) - suspend fun findPetsByStatus( @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { + suspend fun findPetsByStatus(@NotNull @Parameter(description = "Status values that need to be considered for filter", required = true, schema = Schema(allowableValues = ["available", "pending", "sold"])) @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200)) } @@ -102,7 +102,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByTags"], produces = ["application/xml", "application/json"] ) - suspend fun findPetsByTags( @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { + suspend fun findPetsByTags(@NotNull @Parameter(description = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/api/UserApiController.kt b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/api/UserApiController.kt index 7cca92230af..8884b2a1a70 100644 --- a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/api/UserApiController.kt +++ b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/api/UserApiController.kt @@ -133,7 +133,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/login"], produces = ["application/xml", "application/json"] ) - suspend fun loginUser( @RequestParam(value = "username", required = true) username: kotlin.String, @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { + suspend fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @Parameter(description = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @Parameter(description = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { return ResponseEntity(service.loginUser(username, password), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiController.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiController.kt index 7319e5ce6b1..3a9a2760dd6 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiController.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiController.kt @@ -84,7 +84,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByStatus"], produces = ["application/xml", "application/json"] ) - fun findPetsByStatus( @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { + fun findPetsByStatus(@NotNull @Parameter(description = "Status values that need to be considered for filter", required = true, schema = Schema(allowableValues = ["available", "pending", "sold"])) @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200)) } @@ -102,7 +102,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByTags"], produces = ["application/xml", "application/json"] ) - fun findPetsByTags( @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { + fun findPetsByTags(@NotNull @Parameter(description = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiController.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiController.kt index 7cca92230af..8884b2a1a70 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiController.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiController.kt @@ -133,7 +133,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/login"], produces = ["application/xml", "application/json"] ) - suspend fun loginUser( @RequestParam(value = "username", required = true) username: kotlin.String, @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { + suspend fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @Parameter(description = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @Parameter(description = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { return ResponseEntity(service.loginUser(username, password), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/api/PetApi.kt index 2dac3bac9ca..58dc3c22fc8 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/api/PetApi.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -93,7 +93,7 @@ interface PetApi { value = ["/pet/findByStatus"], produces = ["application/xml", "application/json"] ) - fun findPetsByStatus( @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { + fun findPetsByStatus(@NotNull @Parameter(description = "Status values that need to be considered for filter", required = true, schema = Schema(allowableValues = ["available", "pending", "sold"])) @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } @@ -113,7 +113,7 @@ interface PetApi { value = ["/pet/findByTags"], produces = ["application/xml", "application/json"] ) - fun findPetsByTags( @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { + fun findPetsByTags(@NotNull @Parameter(description = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/api/UserApi.kt index 9261382312d..8ed5569b7db 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/api/UserApi.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -144,7 +144,7 @@ interface UserApi { value = ["/user/login"], produces = ["application/xml", "application/json"] ) - fun loginUser( @RequestParam(value = "username", required = true) username: kotlin.String, @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { + fun loginUser(@NotNull @Parameter(description = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @Parameter(description = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/PetApiController.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/PetApiController.kt index 885ca36499a..89a04feba59 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/PetApiController.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/PetApiController.kt @@ -85,7 +85,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByStatus"], produces = ["application/xml", "application/json"] ) - fun findPetsByStatus( @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { + fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200)) } @@ -104,7 +104,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByTags"], produces = ["application/xml", "application/json"] ) - fun findPetsByTags( @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { + fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/UserApiController.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/UserApiController.kt index ef1713dbf1a..5e7076f405c 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/UserApiController.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/UserApiController.kt @@ -126,7 +126,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/login"], produces = ["application/xml", "application/json"] ) - fun loginUser( @RequestParam(value = "username", required = true) username: kotlin.String, @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { + fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { return ResponseEntity(service.loginUser(username, password), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/PetApiController.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/PetApiController.kt index 7da41ce41bb..84c4333e894 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/PetApiController.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/PetApiController.kt @@ -81,7 +81,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByStatus"], produces = ["application/xml", "application/json"] ) - fun findPetsByStatus( @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { + fun findPetsByStatus(@NotNull @Parameter(description = "Status values that need to be considered for filter", required = true, schema = Schema(allowableValues = ["available", "pending", "sold"])) @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200)) } @@ -99,7 +99,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByTags"], produces = ["application/xml", "application/json"] ) - fun findPetsByTags( @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { + fun findPetsByTags(@NotNull @Parameter(description = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/UserApiController.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/UserApiController.kt index 122134a7ce9..08160bfaf0f 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/UserApiController.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/UserApiController.kt @@ -125,7 +125,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/login"], produces = ["application/xml", "application/json"] ) - fun loginUser( @RequestParam(value = "username", required = true) username: kotlin.String, @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { + fun loginUser(@NotNull @Parameter(description = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @Parameter(description = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { return ResponseEntity(service.loginUser(username, password), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiController.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiController.kt index 885ca36499a..89a04feba59 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiController.kt +++ b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiController.kt @@ -85,7 +85,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByStatus"], produces = ["application/xml", "application/json"] ) - fun findPetsByStatus( @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { + fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200)) } @@ -104,7 +104,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByTags"], produces = ["application/xml", "application/json"] ) - fun findPetsByTags( @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { + fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/UserApiController.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/UserApiController.kt index ef1713dbf1a..5e7076f405c 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/UserApiController.kt +++ b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/UserApiController.kt @@ -126,7 +126,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/login"], produces = ["application/xml", "application/json"] ) - fun loginUser( @RequestParam(value = "username", required = true) username: kotlin.String, @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { + fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { return ResponseEntity(service.loginUser(username, password), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiController.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiController.kt index 6bb0aab7adb..4e393ceef9b 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiController.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiController.kt @@ -54,7 +54,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByStatus"], produces = ["application/xml", "application/json"] ) - fun findPetsByStatus( @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { + fun findPetsByStatus(@NotNull @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> { return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200)) } @@ -64,7 +64,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByTags"], produces = ["application/xml", "application/json"] ) - fun findPetsByTags( @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { + fun findPetsByTags(@NotNull @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> { return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200)) } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiController.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiController.kt index 1d811c53384..daf5c943c2e 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiController.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiController.kt @@ -80,7 +80,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/login"], produces = ["application/xml", "application/json"] ) - fun loginUser( @RequestParam(value = "username", required = true) username: kotlin.String, @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { + fun loginUser(@NotNull @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @Valid @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity { return ResponseEntity(service.loginUser(username, password), HttpStatus.valueOf(200)) }