From 6ee83899dddb5133ac03596d2c3b99c693dbae69 Mon Sep 17 00:00:00 2001 From: Sylvain Moindron Date: Fri, 17 May 2019 15:45:59 +0200 Subject: [PATCH 01/16] kotlin spring : add reactivity via kotlin's coroutines --- docs/generators/kotlin-spring.md | 1 + .../languages/KotlinSpringServerCodegen.java | 18 +++++++++++++++++- .../main/resources/kotlin-spring/api.mustache | 12 ++++++++---- .../kotlin-spring/bodyParams.mustache | 2 +- .../spring-boot/buildGradleKts.mustache | 9 +++++++-- .../libraries/spring-boot/pom.mustache | 9 +++++++-- .../kotlin-spring/returnTypes.mustache | 2 +- .../resources/kotlin-spring/service.mustache | 6 ++++-- .../kotlin-spring/serviceImpl.mustache | 5 ++++- .../spring/KotlinSpringServerCodegenTest.java | 6 ++++++ 10 files changed, 56 insertions(+), 14 deletions(-) diff --git a/docs/generators/kotlin-spring.md b/docs/generators/kotlin-spring.md index 29f53a6c1ed2..29a98d53d3c6 100644 --- a/docs/generators/kotlin-spring.md +++ b/docs/generators/kotlin-spring.md @@ -26,4 +26,5 @@ sidebar_label: kotlin-spring |serviceInterface|generate service interfaces to go alongside controllers. In most cases this option would be used to update an existing project, so not to override implementations. Useful to help facilitate the generation gap pattern| |false| |serviceImplementation|generate stub service implementations that extends service interfaces. If this is set to true service interfaces will also be generated| |false| |useBeanValidation|Use BeanValidation API annotations to validate data types| |true| +|reactive| use coroutines for reactive behavior| |false| |library|library template (sub-template)|
**spring-boot**
Spring-boot Server application.
|spring-boot| 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 36fbb4924753..c57b38ceeca1 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 @@ -60,6 +60,8 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen public static final String SWAGGER_ANNOTATIONS = "swaggerAnnotations"; public static final String SERVICE_INTERFACE = "serviceInterface"; public static final String SERVICE_IMPLEMENTATION = "serviceImplementation"; + public static final String REACTIVE = "reactive"; + private String basePackage; private String invokerPackage; @@ -72,6 +74,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen private boolean swaggerAnnotations = false; private boolean serviceInterface = false; private boolean serviceImplementation = false; + private boolean reactive = false; public KotlinSpringServerCodegen() { super(); @@ -148,7 +151,7 @@ public KotlinSpringServerCodegen() { addSwitch(SERVICE_IMPLEMENTATION, "generate stub service implementations that extends service " + "interfaces. If this is set to true service interfaces will also be generated", serviceImplementation); addSwitch(USE_BEANVALIDATION, "Use BeanValidation API annotations to validate data types", useBeanValidation); - + addSwitch(REACTIVE, "use coroutines for reactive behavior (webflux only)", reactive); supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application."); setLibrary(SPRING_BOOT); @@ -239,6 +242,14 @@ public void setUseBeanValidation(boolean useBeanValidation) { this.useBeanValidation = useBeanValidation; } + public boolean isReactive() { + return reactive; + } + + public void setReactive(boolean reactive) { + this.reactive = reactive; + } + @Override public CodegenType getTag() { return CodegenType.SERVER; @@ -331,6 +342,11 @@ public void processOpts() { } writePropertyBack(USE_BEANVALIDATION, useBeanValidation); + if (additionalProperties.containsKey(REACTIVE) && library.equals(SPRING_BOOT)) { + this.setReactive(convertPropertyToBoolean(REACTIVE)); + } + writePropertyBack(REACTIVE, reactive); + modelTemplateFiles.put("model.mustache", ".kt"); apiTemplateFiles.put("api.mustache", ".kt"); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache index 83c84799b304..fcf43b083b87 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache @@ -14,7 +14,7 @@ import io.swagger.annotations.AuthorizationScope import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.stereotype.Controller + import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestPart import org.springframework.web.bind.annotation.RequestParam @@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestHeader import org.springframework.web.bind.annotation.RequestMethod import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController {{#useBeanValidation}} import org.springframework.validation.annotation.Validated {{/useBeanValidation}} @@ -39,10 +40,13 @@ import javax.validation.constraints.Pattern import javax.validation.constraints.Size {{/useBeanValidation}} +{{#reactive}} +import kotlinx.coroutines.flow.Flow; +{{/reactive}} import kotlin.collections.List import kotlin.collections.Map -@Controller +@RestController {{#useBeanValidation}} @Validated {{/useBeanValidation}} @@ -68,12 +72,12 @@ class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) v value = [{{#responses}}ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{#baseType}}, response = {{{baseType}}}::class{{/baseType}}{{#containerType}}, responseContainer = "{{{containerType}}}"{{/containerType}}){{#hasMore}},{{/hasMore}}{{/responses}}]){{/swaggerAnnotations}} @RequestMapping( value = ["{{#lambda.escapeDoubleQuote}}{{path}}{{/lambda.escapeDoubleQuote}}"],{{#singleContentTypes}}{{#hasProduces}} - produces = "{{{vendorExtensions.x-accepts}}}", {{/hasProduces}}{{#hasConsumes}} + produces = "{{{vendorExtensions.x-accepts}}}",{{/hasProduces}}{{#hasConsumes}} consumes = "{{{vendorExtensions.x-contentType}}}",{{/hasConsumes}}{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}} produces = [{{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}}], {{/hasProduces}}{{#hasConsumes}} consumes = [{{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}],{{/hasConsumes}}{{/singleContentTypes}} method = [RequestMethod.{{httpMethod}}]) - fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}): ResponseEntity<{{>returnTypes}}> { + {{#reactive}}{{^isListContainer}}suspend {{/isListContainer}}{{/reactive}}fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}): ResponseEntity<{{>returnTypes}}> { return {{>returnValue}} } {{/operation}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/bodyParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/bodyParams.mustache index c05599c7b027..9d51d6d8c04b 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/bodyParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/bodyParams.mustache @@ -1 +1 @@ -{{#isBodyParam}}{{#swaggerAnnotations}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{^isContainer}}{{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{/isContainer}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{/swaggerAnnotations}} {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestBody {{paramName}}: {{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isListContainer}}Mono{{/isListContainer}}{{#isListContainer}}Flux{{/isListContainer}}<{{{baseType}}}>{{/reactive}}{{/isBodyParam}} \ No newline at end of file +{{#isBodyParam}}{{#swaggerAnnotations}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{^isContainer}}{{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{/isContainer}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{/swaggerAnnotations}} {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestBody {{paramName}}: {{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isListContainer}}{{>optionalDataType}}{{/isListContainer}}{{#isListContainer}}Flow<{{{baseType}}}>{{/isListContainer}}{{/reactive}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache index a36b054d6330..2e8bd00c224f 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache @@ -23,18 +23,23 @@ tasks.withType { } plugins { - val kotlinVersion = "1.2.60" + val kotlinVersion = "1.3.30" id("org.jetbrains.kotlin.jvm") version kotlinVersion id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion - id("org.springframework.boot") version "2.0.3.RELEASE" + id("org.springframework.boot") version "2.2.0.M3" id("io.spring.dependency-management") version "1.0.5.RELEASE" } dependencies { compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compile("org.jetbrains.kotlin:kotlin-reflect") +{{^reactive}} compile("org.springframework.boot:spring-boot-starter-web") +{{/reactive}} +{{#reactive}} + compile("org.springframework.boot:spring-boot-starter-webflux") +{{/reactive}} {{#swaggerAnnotations}} compile("io.swagger:swagger-annotations:1.5.21") {{/swaggerAnnotations}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache index bc74aa267d99..55987522d990 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache @@ -6,12 +6,12 @@ {{artifactId}} {{artifactVersion}} - 1.2.60 + 1.3.30 org.springframework.boot spring-boot-starter-parent - 2.0.3.RELEASE + 2.2.0.M3 ${project.basedir}/src/main/kotlin @@ -77,7 +77,12 @@ org.springframework.boot +{{^reactive}} spring-boot-starter-web +{{/reactive}} +{{#reactive}} + spring-boot-starter-webflux +{{/reactive}} {{#swaggerAnnotations}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/returnTypes.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/returnTypes.mustache index 67d79cc198ce..498e0aab4fd1 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/returnTypes.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/returnTypes.mustache @@ -1 +1 @@ -{{#isMapContainer}}{{#reactive}}Mono<{{/reactive}}Map{{/reactive}}>{{/isMapContainer}}{{#isListContainer}}{{#reactive}}Flux{{/reactive}}{{^reactive}}List{{/reactive}}<{{{returnType}}}>{{/isListContainer}}{{^returnContainer}}{{#reactive}}Mono<{{{returnType}}}>{{/reactive}}{{^reactive}}{{{returnType}}}{{/reactive}}{{/returnContainer}} \ No newline at end of file +{{#isMapContainer}}Map{{/isMapContainer}}{{#isListContainer}}{{#reactive}}Flow{{/reactive}}{{^reactive}}List{{/reactive}}<{{{returnType}}}>{{/isListContainer}}{{^returnContainer}}{{{returnType}}}{{/returnContainer}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/service.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/service.mustache index 12b073f7009f..62056e62a712 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/service.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/service.mustache @@ -2,12 +2,14 @@ package {{package}} {{#imports}}import {{import}} {{/imports}} - +{{#reactive}} +import kotlinx.coroutines.flow.Flow; +{{/reactive}} {{#operations}} interface {{classname}}Service { {{#operation}} - fun {{operationId}}({{#allParams}}{{paramName}}: {{>optionalDataType}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): {{>returnTypes}} + {{#reactive}}{{^isListContainer}}suspend {{/isListContainer}}{{/reactive}}fun {{operationId}}({{#allParams}}{{paramName}}: {{>optionalDataType}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): {{>returnTypes}} {{/operation}} } {{/operations}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/serviceImpl.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/serviceImpl.mustache index 32e62866af21..1aeddbdba034 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/serviceImpl.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/serviceImpl.mustache @@ -2,13 +2,16 @@ package {{package}} {{#imports}}import {{import}} {{/imports}} +{{#reactive}} +import kotlinx.coroutines.flow.Flow; +{{/reactive}} import org.springframework.stereotype.Service @Service {{#operations}} class {{classname}}ServiceImpl : {{classname}}Service { {{#operation}} - override fun {{operationId}}({{#allParams}}{{paramName}}: {{>optionalDataType}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): {{>returnTypes}} { + override {{#reactive}}{{^isListContainer}}suspend {{/isListContainer}}{{/reactive}}fun {{operationId}}({{#allParams}}{{paramName}}: {{>optionalDataType}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): {{>returnTypes}} { TODO("Implement me") } {{/operation}} 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 87847e16cf71..c830cd29b969 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 @@ -47,6 +47,7 @@ public void testSettersForConfigValues() throws Exception { codegen.setServiceInterface(true); codegen.setServiceImplementation(true); codegen.setUseBeanValidation(false); + codegen.setReactive(false); codegen.processOpts(); Assert.assertEquals(codegen.modelPackage(), "xx.yyyyyyyy.model"); @@ -69,6 +70,8 @@ public void testSettersForConfigValues() throws Exception { Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.SERVICE_IMPLEMENTATION), true); Assert.assertFalse(codegen.getUseBeanValidation()); Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.USE_BEANVALIDATION), false); + Assert.assertFalse(codegen.isReactive()); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.REACTIVE), false); } @Test @@ -84,6 +87,7 @@ public void testAdditionalPropertiesPutForConfigValues() throws Exception { codegen.additionalProperties().put(KotlinSpringServerCodegen.SERVICE_INTERFACE, true); codegen.additionalProperties().put(KotlinSpringServerCodegen.SERVICE_IMPLEMENTATION, true); codegen.additionalProperties().put(KotlinSpringServerCodegen.USE_BEANVALIDATION, false); + codegen.additionalProperties().put(KotlinSpringServerCodegen.REACTIVE, false); codegen.processOpts(); final OpenAPI openAPI = new OpenAPI(); @@ -112,6 +116,8 @@ public void testAdditionalPropertiesPutForConfigValues() throws Exception { Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.SERVICE_IMPLEMENTATION), true); Assert.assertFalse(codegen.getUseBeanValidation()); Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.USE_BEANVALIDATION), false); + Assert.assertFalse(codegen.isReactive()); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.REACTIVE), false); } @Test From 2965f9dc9cf47cb76b75dd4b20762d6c296483a1 Mon Sep 17 00:00:00 2001 From: Sylvain Moindron Date: Fri, 17 May 2019 15:47:51 +0200 Subject: [PATCH 02/16] regenerate samples --- .../.openapi-generator/VERSION | 2 +- .../kotlin-springboot/build.gradle.kts | 2 +- .../petstore/kotlin-springboot/pom.xml | 2 +- .../kotlin/org/openapitools/api/PetApi.kt | 54 ++++++++++++++----- .../org/openapitools/api/PetApiService.kt | 17 +++--- .../org/openapitools/api/PetApiServiceImpl.kt | 9 ++-- .../kotlin/org/openapitools/api/StoreApi.kt | 31 ++++++++--- .../org/openapitools/api/StoreApiService.kt | 9 ++-- .../openapitools/api/StoreApiServiceImpl.kt | 1 - .../kotlin/org/openapitools/api/UserApi.kt | 45 +++++++++++----- .../org/openapitools/api/UserApiService.kt | 17 +++--- .../openapitools/api/UserApiServiceImpl.kt | 5 +- .../kotlin/org/openapitools/model/Category.kt | 9 +++- .../org/openapitools/model/InlineObject.kt | 9 +++- .../org/openapitools/model/InlineObject1.kt | 11 ++-- .../openapitools/model/ModelApiResponse.kt | 9 +++- .../kotlin/org/openapitools/model/Order.kt | 9 +++- .../main/kotlin/org/openapitools/model/Pet.kt | 9 +++- .../main/kotlin/org/openapitools/model/Tag.kt | 9 +++- .../kotlin/org/openapitools/model/User.kt | 9 +++- .../kotlin-springboot/build.gradle.kts | 2 +- .../server/petstore/kotlin-springboot/pom.xml | 2 +- .../kotlin/org/openapitools/api/PetApi.kt | 5 +- .../org/openapitools/api/PetApiService.kt | 17 +++--- .../kotlin/org/openapitools/api/StoreApi.kt | 5 +- .../org/openapitools/api/StoreApiService.kt | 9 ++-- .../kotlin/org/openapitools/api/UserApi.kt | 5 +- .../org/openapitools/api/UserApiService.kt | 17 +++--- 28 files changed, 213 insertions(+), 117 deletions(-) diff --git a/samples/server/openapi3/petstore/kotlin-springboot/.openapi-generator/VERSION b/samples/server/openapi3/petstore/kotlin-springboot/.openapi-generator/VERSION index afa636560641..06b5019af3f4 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/.openapi-generator/VERSION +++ b/samples/server/openapi3/petstore/kotlin-springboot/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.0-SNAPSHOT \ No newline at end of file +4.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/openapi3/petstore/kotlin-springboot/build.gradle.kts b/samples/server/openapi3/petstore/kotlin-springboot/build.gradle.kts index f7a2deac9960..028d241de8d5 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/build.gradle.kts +++ b/samples/server/openapi3/petstore/kotlin-springboot/build.gradle.kts @@ -27,7 +27,7 @@ plugins { id("org.jetbrains.kotlin.jvm") version kotlinVersion id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion - id("org.springframework.boot") version "2.0.3.RELEASE" + id("org.springframework.boot") version "2.2.0.M3" id("io.spring.dependency-management") version "1.0.5.RELEASE" } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/pom.xml b/samples/server/openapi3/petstore/kotlin-springboot/pom.xml index 96ed05a21d5b..f2a955aa900d 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/pom.xml +++ b/samples/server/openapi3/petstore/kotlin-springboot/pom.xml @@ -11,7 +11,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.3.RELEASE + 2.2.0.M3 ${project.basedir}/src/main/kotlin diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt index 8f49e172090d..21d677c730c5 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -2,11 +2,17 @@ package org.openapitools.api import org.openapitools.model.ModelApiResponse import org.openapitools.model.Pet -import io.swagger.annotations.* +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import io.swagger.annotations.ApiResponse +import io.swagger.annotations.ApiResponses +import io.swagger.annotations.Authorization +import io.swagger.annotations.AuthorizationScope import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.stereotype.Controller + import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestPart import org.springframework.web.bind.annotation.RequestParam @@ -14,18 +20,24 @@ import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestHeader import org.springframework.web.bind.annotation.RequestMethod import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest -import org.springframework.web.multipart.MultipartFile import org.springframework.beans.factory.annotation.Autowired import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import kotlin.collections.List import kotlin.collections.Map -@Controller +@RestController @Validated @Api(value = "Pet", description = "The Pet API") @RequestMapping("\${api.base-path:/v2}") @@ -42,7 +54,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet"], consumes = ["application/json", "application/xml"], method = [RequestMethod.POST]) - fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet): ResponseEntity { + fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet +): ResponseEntity { return ResponseEntity(service.addPet(pet), HttpStatus.OK) } @@ -56,7 +69,9 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @RequestMapping( value = ["/pet/{petId}"], method = [RequestMethod.DELETE]) - fun deletePet(@ApiParam(value = "Pet id to delete", required=true, defaultValue="null") @PathVariable("petId") petId: Long,@ApiParam(value = "" , defaultValue="null") @RequestHeader(value="api_key", required=false) apiKey: String): ResponseEntity { + fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: Long +,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: String? +): ResponseEntity { return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.OK) } @@ -73,7 +88,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByStatus"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "null") @Valid @RequestParam(value = "status", required = true, defaultValue="null") status: 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: List +): ResponseEntity> { return ResponseEntity(service.findPetsByStatus(status), HttpStatus.OK) } @@ -90,8 +106,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByTags"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "null") @Valid @RequestParam(value = "tags", required = true, defaultValue="null") tags: List): ResponseEntity> { - return ResponseEntity(service.findPetsByTags(tags), HttpStatus.OK) + fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: List +,@ApiParam(value = "Maximum number of items to return") @Valid @RequestParam(value = "maxCount", required = false) maxCount: Int? +): ResponseEntity> { + return ResponseEntity(service.findPetsByTags(tags, maxCount), HttpStatus.OK) } @ApiOperation( @@ -106,7 +124,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/{petId}"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun getPetById(@ApiParam(value = "ID of pet to return", required=true, defaultValue="null") @PathVariable("petId") petId: Long): ResponseEntity { + fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: Long +): ResponseEntity { return ResponseEntity(service.getPetById(petId), HttpStatus.OK) } @@ -121,7 +140,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet"], consumes = ["application/json", "application/xml"], method = [RequestMethod.PUT]) - fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet): ResponseEntity { + fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet +): ResponseEntity { return ResponseEntity(service.updatePet(pet), HttpStatus.OK) } @@ -136,7 +156,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/{petId}"], consumes = ["application/x-www-form-urlencoded"], method = [RequestMethod.POST]) - fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true, defaultValue="null") @PathVariable("petId") petId: Long,@ApiParam(value = "Updated name of the pet", defaultValue="null") @RequestParam(value="name", required=false) name: String ,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) status: String ): ResponseEntity { + fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: Long +,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: String? +,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: String? +): ResponseEntity { return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.OK) } @@ -153,7 +176,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { produces = ["application/json"], consumes = ["multipart/form-data"], method = [RequestMethod.POST]) - fun uploadFile(@ApiParam(value = "ID of pet to update", required=true, defaultValue="null") @PathVariable("petId") petId: Long,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: String ,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: MultipartFile): ResponseEntity { + fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: Long +,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: String? +,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource? +): ResponseEntity { return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.OK) } } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt index c2e81c4c66b6..1ef6953cb76c 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -2,22 +2,21 @@ package org.openapitools.api import org.openapitools.model.ModelApiResponse import org.openapitools.model.Pet - interface PetApiService { - fun addPet(pet: Pet): Unit + fun addPet(pet: Pet): Unit - fun deletePet(petId: Long,apiKey: String): Unit + fun deletePet(petId: Long, apiKey: String?): Unit - fun findPetsByStatus(status: List): List + fun findPetsByStatus(status: List): List - fun findPetsByTags(tags: List): List + fun findPetsByTags(tags: List, maxCount: Int?): List - fun getPetById(petId: Long): Pet + fun getPetById(petId: Long): Pet - fun updatePet(pet: Pet): Unit + fun updatePet(pet: Pet): Unit - fun updatePetWithForm(petId: Long,name: String,status: String): Unit + fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit - fun uploadFile(petId: Long,additionalMetadata: String,file: org.springframework.web.multipart.MultipartFile): ModelApiResponse + fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt index 86ae8e063208..2b9815beddda 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt @@ -3,7 +3,6 @@ package org.openapitools.api import org.openapitools.model.ModelApiResponse import org.openapitools.model.Pet import org.springframework.stereotype.Service - @Service class PetApiServiceImpl : PetApiService { @@ -11,7 +10,7 @@ class PetApiServiceImpl : PetApiService { TODO("Implement me") } - override fun deletePet(petId: Long,apiKey: String): Unit { + override fun deletePet(petId: Long, apiKey: String?): Unit { TODO("Implement me") } @@ -19,7 +18,7 @@ class PetApiServiceImpl : PetApiService { TODO("Implement me") } - override fun findPetsByTags(tags: List): List { + override fun findPetsByTags(tags: List, maxCount: Int?): List { TODO("Implement me") } @@ -31,11 +30,11 @@ class PetApiServiceImpl : PetApiService { TODO("Implement me") } - override fun updatePetWithForm(petId: Long,name: String,status: String): Unit { + override fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit { TODO("Implement me") } - override fun uploadFile(petId: Long,additionalMetadata: String,file: org.springframework.web.multipart.MultipartFile): ModelApiResponse { + override fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse { TODO("Implement me") } } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt index 6931bd2500c7..3f1615634b1a 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -1,11 +1,17 @@ package org.openapitools.api import org.openapitools.model.Order -import io.swagger.annotations.* +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import io.swagger.annotations.ApiResponse +import io.swagger.annotations.ApiResponses +import io.swagger.annotations.Authorization +import io.swagger.annotations.AuthorizationScope import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.stereotype.Controller + import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestPart import org.springframework.web.bind.annotation.RequestParam @@ -13,18 +19,24 @@ import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestHeader import org.springframework.web.bind.annotation.RequestMethod import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest -import org.springframework.web.multipart.MultipartFile import org.springframework.beans.factory.annotation.Autowired import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import kotlin.collections.List import kotlin.collections.Map -@Controller +@RestController @Validated @Api(value = "Store", description = "The Store API") @RequestMapping("\${api.base-path:/v2}") @@ -39,7 +51,8 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic @RequestMapping( value = ["/store/order/{orderId}"], method = [RequestMethod.DELETE]) - fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true, defaultValue="null") @PathVariable("orderId") orderId: String): ResponseEntity { + fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: String +): ResponseEntity { return ResponseEntity(service.deleteOrder(orderId), HttpStatus.OK) } @@ -71,7 +84,8 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic value = ["/store/order/{orderId}"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true, defaultValue="null") @PathVariable("orderId") orderId: Long): ResponseEntity { + fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: Long +): ResponseEntity { return ResponseEntity(service.getOrderById(orderId), HttpStatus.OK) } @@ -87,7 +101,8 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic produces = ["application/xml", "application/json"], consumes = ["application/json"], method = [RequestMethod.POST]) - fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody order: Order): ResponseEntity { + fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody order: Order +): ResponseEntity { return ResponseEntity(service.placeOrder(order), HttpStatus.OK) } } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt index 7767fa87a8a5..ce32895d2197 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt @@ -1,14 +1,13 @@ package org.openapitools.api import org.openapitools.model.Order - interface StoreApiService { - fun deleteOrder(orderId: String): Unit + fun deleteOrder(orderId: String): Unit - fun getInventory(): Map + fun getInventory(): Map - fun getOrderById(orderId: Long): Order + fun getOrderById(orderId: Long): Order - fun placeOrder(order: Order): Order + fun placeOrder(order: Order): Order } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt index 850853758fed..ab4e08e794c4 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt @@ -2,7 +2,6 @@ package org.openapitools.api import org.openapitools.model.Order import org.springframework.stereotype.Service - @Service class StoreApiServiceImpl : StoreApiService { diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt index 71d5afca249e..42f3e2609038 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -1,11 +1,17 @@ package org.openapitools.api import org.openapitools.model.User -import io.swagger.annotations.* +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import io.swagger.annotations.ApiResponse +import io.swagger.annotations.ApiResponses +import io.swagger.annotations.Authorization +import io.swagger.annotations.AuthorizationScope import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.stereotype.Controller + import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestPart import org.springframework.web.bind.annotation.RequestParam @@ -13,18 +19,24 @@ import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestHeader import org.springframework.web.bind.annotation.RequestMethod import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest -import org.springframework.web.multipart.MultipartFile import org.springframework.beans.factory.annotation.Autowired import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import kotlin.collections.List import kotlin.collections.Map -@Controller +@RestController @Validated @Api(value = "User", description = "The User API") @RequestMapping("\${api.base-path:/v2}") @@ -41,7 +53,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user"], consumes = ["application/json"], method = [RequestMethod.POST]) - fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody user: User): ResponseEntity { + fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody user: User +): ResponseEntity { return ResponseEntity(service.createUser(user), HttpStatus.OK) } @@ -56,7 +69,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/createWithArray"], consumes = ["application/json"], method = [RequestMethod.POST]) - fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: List): ResponseEntity { + fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: List +): ResponseEntity { return ResponseEntity(service.createUsersWithArrayInput(user), HttpStatus.OK) } @@ -71,7 +85,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/createWithList"], consumes = ["application/json"], method = [RequestMethod.POST]) - fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: List): ResponseEntity { + fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: List +): ResponseEntity { return ResponseEntity(service.createUsersWithListInput(user), HttpStatus.OK) } @@ -85,7 +100,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @RequestMapping( value = ["/user/{username}"], method = [RequestMethod.DELETE]) - fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true, defaultValue="null") @PathVariable("username") username: String): ResponseEntity { + fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: String +): ResponseEntity { return ResponseEntity(service.deleteUser(username), HttpStatus.OK) } @@ -100,7 +116,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/{username}"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true, defaultValue="null") @PathVariable("username") username: String): ResponseEntity { + fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: String +): ResponseEntity { return ResponseEntity(service.getUserByName(username), HttpStatus.OK) } @@ -115,7 +132,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/login"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiParam(value = "The user name for login", required = true, defaultValue = "null") @Valid @RequestParam(value = "username", required = true, defaultValue="null") username: String,@NotNull @ApiParam(value = "The password for login in clear text", required = true, defaultValue = "null") @Valid @RequestParam(value = "password", required = true, defaultValue="null") password: String): ResponseEntity { + fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: String +,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: String +): ResponseEntity { return ResponseEntity(service.loginUser(username, password), HttpStatus.OK) } @@ -144,7 +163,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/{username}"], consumes = ["application/json"], method = [RequestMethod.PUT]) - fun updateUser(@ApiParam(value = "name that need to be deleted", required=true, defaultValue="null") @PathVariable("username") username: String,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody user: User): ResponseEntity { + fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: String +,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody user: User +): ResponseEntity { return ResponseEntity(service.updateUser(username, user), HttpStatus.OK) } } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt index b8a3d7ebae1b..538b00df9bb6 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt @@ -1,22 +1,21 @@ package org.openapitools.api import org.openapitools.model.User - interface UserApiService { - fun createUser(user: User): Unit + fun createUser(user: User): Unit - fun createUsersWithArrayInput(user: List): Unit + fun createUsersWithArrayInput(user: List): Unit - fun createUsersWithListInput(user: List): Unit + fun createUsersWithListInput(user: List): Unit - fun deleteUser(username: String): Unit + fun deleteUser(username: String): Unit - fun getUserByName(username: String): User + fun getUserByName(username: String): User - fun loginUser(username: String,password: String): String + fun loginUser(username: String, password: String): String - fun logoutUser(): Unit + fun logoutUser(): Unit - fun updateUser(username: String,user: User): Unit + fun updateUser(username: String, user: User): Unit } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt index 62b365a6d823..c15ee34dbdb6 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt @@ -2,7 +2,6 @@ package org.openapitools.api import org.openapitools.model.User import org.springframework.stereotype.Service - @Service class UserApiServiceImpl : UserApiService { @@ -26,7 +25,7 @@ class UserApiServiceImpl : UserApiService { TODO("Implement me") } - override fun loginUser(username: String,password: String): String { + override fun loginUser(username: String, password: String): String { TODO("Implement me") } @@ -34,7 +33,7 @@ class UserApiServiceImpl : UserApiService { TODO("Implement me") } - override fun updateUser(username: String,user: User): Unit { + override fun updateUser(username: String, user: User): Unit { TODO("Implement me") } } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt index 499ed4743e10..e042a7f997c3 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt @@ -2,8 +2,13 @@ package org.openapitools.model import java.util.Objects import com.fasterxml.jackson.annotation.JsonProperty -import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import io.swagger.annotations.ApiModelProperty /** diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/InlineObject.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/InlineObject.kt index 3a1526a0db77..e998bc995ce4 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/InlineObject.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/InlineObject.kt @@ -2,8 +2,13 @@ package org.openapitools.model import java.util.Objects import com.fasterxml.jackson.annotation.JsonProperty -import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import io.swagger.annotations.ApiModelProperty /** diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/InlineObject1.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/InlineObject1.kt index 4600798bc9a1..d29578fd0c09 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/InlineObject1.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/InlineObject1.kt @@ -2,8 +2,13 @@ package org.openapitools.model import java.util.Objects import com.fasterxml.jackson.annotation.JsonProperty -import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import io.swagger.annotations.ApiModelProperty /** @@ -17,7 +22,7 @@ data class InlineObject1 ( @JsonProperty("additionalMetadata") val additionalMetadata: String? = null, @ApiModelProperty(example = "null", value = "file to upload") - @JsonProperty("file") val file: java.io.File? = null + @JsonProperty("file") val file: org.springframework.core.io.Resource? = null ) { } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 17697fdfe8d4..2f844a9c3565 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -2,8 +2,13 @@ package org.openapitools.model import java.util.Objects import com.fasterxml.jackson.annotation.JsonProperty -import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import io.swagger.annotations.ApiModelProperty /** diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt index be8e2f33fb37..e20d850491fa 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt @@ -3,8 +3,13 @@ package org.openapitools.model import java.util.Objects import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonValue -import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import io.swagger.annotations.ApiModelProperty /** diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt index 80af728b7e49..9e054ac22f73 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt @@ -5,8 +5,13 @@ import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonValue import org.openapitools.model.Category import org.openapitools.model.Tag -import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import io.swagger.annotations.ApiModelProperty /** diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt index 70c706d00a6e..40ef1b9a86b7 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt @@ -2,8 +2,13 @@ package org.openapitools.model import java.util.Objects import com.fasterxml.jackson.annotation.JsonProperty -import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import io.swagger.annotations.ApiModelProperty /** diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt index 4cfaf0988746..95fe12aa467b 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt @@ -2,8 +2,13 @@ package org.openapitools.model import java.util.Objects import com.fasterxml.jackson.annotation.JsonProperty -import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import io.swagger.annotations.ApiModelProperty /** diff --git a/samples/server/petstore/kotlin-springboot/build.gradle.kts b/samples/server/petstore/kotlin-springboot/build.gradle.kts index f7a2deac9960..028d241de8d5 100644 --- a/samples/server/petstore/kotlin-springboot/build.gradle.kts +++ b/samples/server/petstore/kotlin-springboot/build.gradle.kts @@ -27,7 +27,7 @@ plugins { id("org.jetbrains.kotlin.jvm") version kotlinVersion id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion - id("org.springframework.boot") version "2.0.3.RELEASE" + id("org.springframework.boot") version "2.2.0.M3" id("io.spring.dependency-management") version "1.0.5.RELEASE" } diff --git a/samples/server/petstore/kotlin-springboot/pom.xml b/samples/server/petstore/kotlin-springboot/pom.xml index 96ed05a21d5b..f2a955aa900d 100644 --- a/samples/server/petstore/kotlin-springboot/pom.xml +++ b/samples/server/petstore/kotlin-springboot/pom.xml @@ -11,7 +11,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.3.RELEASE + 2.2.0.M3 ${project.basedir}/src/main/kotlin diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt index 2f70853c857e..b62a21f79cf4 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -12,7 +12,7 @@ import io.swagger.annotations.AuthorizationScope import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.stereotype.Controller + import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestPart import org.springframework.web.bind.annotation.RequestParam @@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestHeader import org.springframework.web.bind.annotation.RequestMethod import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest import org.springframework.beans.factory.annotation.Autowired @@ -36,7 +37,7 @@ import javax.validation.constraints.Size import kotlin.collections.List import kotlin.collections.Map -@Controller +@RestController @Validated @Api(value = "Pet", description = "The Pet API") @RequestMapping("\${api.base-path:/v2}") diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt index 741a97d86038..8e5d3cfd6e1e 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -2,22 +2,21 @@ package org.openapitools.api import org.openapitools.model.ModelApiResponse import org.openapitools.model.Pet - interface PetApiService { - fun addPet(body: Pet): Unit + fun addPet(body: Pet): Unit - fun deletePet(petId: Long, apiKey: String?): Unit + fun deletePet(petId: Long, apiKey: String?): Unit - fun findPetsByStatus(status: List): List + fun findPetsByStatus(status: List): List - fun findPetsByTags(tags: List): List + fun findPetsByTags(tags: List): List - fun getPetById(petId: Long): Pet + fun getPetById(petId: Long): Pet - fun updatePet(body: Pet): Unit + fun updatePet(body: Pet): Unit - fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit + fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit - fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse + fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt index ed467c5700e1..b33120544b99 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -11,7 +11,7 @@ import io.swagger.annotations.AuthorizationScope import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.stereotype.Controller + import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestPart import org.springframework.web.bind.annotation.RequestParam @@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestHeader import org.springframework.web.bind.annotation.RequestMethod import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest import org.springframework.beans.factory.annotation.Autowired @@ -35,7 +36,7 @@ import javax.validation.constraints.Size import kotlin.collections.List import kotlin.collections.Map -@Controller +@RestController @Validated @Api(value = "Store", description = "The Store API") @RequestMapping("\${api.base-path:/v2}") diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt index cf479e2c8a71..8ddca95e7d56 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt @@ -1,14 +1,13 @@ package org.openapitools.api import org.openapitools.model.Order - interface StoreApiService { - fun deleteOrder(orderId: String): Unit + fun deleteOrder(orderId: String): Unit - fun getInventory(): Map + fun getInventory(): Map - fun getOrderById(orderId: Long): Order + fun getOrderById(orderId: Long): Order - fun placeOrder(body: Order): Order + fun placeOrder(body: Order): Order } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt index bab2a54b1175..a785944a279d 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -11,7 +11,7 @@ import io.swagger.annotations.AuthorizationScope import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.stereotype.Controller + import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestPart import org.springframework.web.bind.annotation.RequestParam @@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestHeader import org.springframework.web.bind.annotation.RequestMethod import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest import org.springframework.beans.factory.annotation.Autowired @@ -35,7 +36,7 @@ import javax.validation.constraints.Size import kotlin.collections.List import kotlin.collections.Map -@Controller +@RestController @Validated @Api(value = "User", description = "The User API") @RequestMapping("\${api.base-path:/v2}") diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt index de61cf72c437..f7286538c609 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt @@ -1,22 +1,21 @@ package org.openapitools.api import org.openapitools.model.User - interface UserApiService { - fun createUser(body: User): Unit + fun createUser(body: User): Unit - fun createUsersWithArrayInput(body: List): Unit + fun createUsersWithArrayInput(body: List): Unit - fun createUsersWithListInput(body: List): Unit + fun createUsersWithListInput(body: List): Unit - fun deleteUser(username: String): Unit + fun deleteUser(username: String): Unit - fun getUserByName(username: String): User + fun getUserByName(username: String): User - fun loginUser(username: String, password: String): String + fun loginUser(username: String, password: String): String - fun logoutUser(): Unit + fun logoutUser(): Unit - fun updateUser(username: String, body: User): Unit + fun updateUser(username: String, body: User): Unit } From ff91c0f176ef02c7109684d406e8f30b4495a856 Mon Sep 17 00:00:00 2001 From: Sylvain Moindron Date: Fri, 17 May 2019 15:49:44 +0200 Subject: [PATCH 03/16] add kotlin spring boot reactive samples --- bin/kotlin-springboot-petstore-all.sh | 4 + ...lin-springboot-petstore-server-reactive.sh | 35 ++++ .../kotlin-springboot-petstore-all.sh | 4 + ...lin-springboot-petstore-server-reactive.sh | 35 ++++ .../.openapi-generator-ignore | 23 +++ .../.openapi-generator/VERSION | 1 + .../kotlin-springboot-reactive/README.md | 21 ++ .../build.gradle.kts | 46 +++++ .../kotlin-springboot-reactive/pom.xml | 109 ++++++++++ .../settings.gradle | 1 + .../kotlin/org/openapitools/Application.kt | 14 ++ .../kotlin/org/openapitools/api/Exceptions.kt | 29 +++ .../kotlin/org/openapitools/api/PetApi.kt | 186 ++++++++++++++++++ .../org/openapitools/api/PetApiService.kt | 23 +++ .../org/openapitools/api/PetApiServiceImpl.kt | 41 ++++ .../kotlin/org/openapitools/api/StoreApi.kt | 109 ++++++++++ .../org/openapitools/api/StoreApiService.kt | 14 ++ .../openapitools/api/StoreApiServiceImpl.kt | 24 +++ .../kotlin/org/openapitools/api/UserApi.kt | 172 ++++++++++++++++ .../org/openapitools/api/UserApiService.kt | 22 +++ .../openapitools/api/UserApiServiceImpl.kt | 40 ++++ .../kotlin/org/openapitools/model/Category.kt | 29 +++ .../org/openapitools/model/InlineObject.kt | 29 +++ .../org/openapitools/model/InlineObject1.kt | 29 +++ .../openapitools/model/ModelApiResponse.kt | 33 ++++ .../kotlin/org/openapitools/model/Order.kt | 60 ++++++ .../main/kotlin/org/openapitools/model/Pet.kt | 64 ++++++ .../main/kotlin/org/openapitools/model/Tag.kt | 29 +++ .../kotlin/org/openapitools/model/User.kt | 53 +++++ .../src/main/resources/application.yaml | 10 + .../.openapi-generator-ignore | 23 +++ .../.openapi-generator/VERSION | 1 + .../kotlin-springboot-reactive/README.md | 21 ++ .../build.gradle.kts | 46 +++++ .../kotlin-springboot-reactive/pom.xml | 109 ++++++++++ .../settings.gradle | 1 + .../kotlin/org/openapitools/Application.kt | 14 ++ .../kotlin/org/openapitools/api/Exceptions.kt | 29 +++ .../kotlin/org/openapitools/api/PetApi.kt | 185 +++++++++++++++++ .../org/openapitools/api/PetApiService.kt | 23 +++ .../org/openapitools/api/PetApiServiceImpl.kt | 41 ++++ .../kotlin/org/openapitools/api/StoreApi.kt | 108 ++++++++++ .../org/openapitools/api/StoreApiService.kt | 14 ++ .../openapitools/api/StoreApiServiceImpl.kt | 24 +++ .../kotlin/org/openapitools/api/UserApi.kt | 162 +++++++++++++++ .../org/openapitools/api/UserApiService.kt | 22 +++ .../openapitools/api/UserApiServiceImpl.kt | 40 ++++ .../kotlin/org/openapitools/model/Category.kt | 29 +++ .../openapitools/model/ModelApiResponse.kt | 33 ++++ .../kotlin/org/openapitools/model/Order.kt | 60 ++++++ .../main/kotlin/org/openapitools/model/Pet.kt | 64 ++++++ .../main/kotlin/org/openapitools/model/Tag.kt | 29 +++ .../kotlin/org/openapitools/model/User.kt | 53 +++++ .../src/main/resources/application.yaml | 10 + 54 files changed, 2430 insertions(+) create mode 100755 bin/kotlin-springboot-petstore-all.sh create mode 100755 bin/kotlin-springboot-petstore-server-reactive.sh create mode 100755 bin/openapi3/kotlin-springboot-petstore-all.sh create mode 100755 bin/openapi3/kotlin-springboot-petstore-server-reactive.sh create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/.openapi-generator-ignore create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/README.md create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/pom.xml create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/settings.gradle create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/Application.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/Exceptions.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiService.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/InlineObject.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/InlineObject1.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt create mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/resources/application.yaml create mode 100644 samples/server/petstore/kotlin-springboot-reactive/.openapi-generator-ignore create mode 100644 samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION create mode 100644 samples/server/petstore/kotlin-springboot-reactive/README.md create mode 100644 samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts create mode 100644 samples/server/petstore/kotlin-springboot-reactive/pom.xml create mode 100644 samples/server/petstore/kotlin-springboot-reactive/settings.gradle create mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/Application.kt create mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/Exceptions.kt create mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt create mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt create mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt create mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt create mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiService.kt create mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt create mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt create mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt create mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt create mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt create mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt create mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt create mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt create mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt create mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt create mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/resources/application.yaml diff --git a/bin/kotlin-springboot-petstore-all.sh b/bin/kotlin-springboot-petstore-all.sh new file mode 100755 index 000000000000..b0ba7a6e825d --- /dev/null +++ b/bin/kotlin-springboot-petstore-all.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +./bin/kotlin-springboot-petstore-server.sh +./bin/kotlin-springboot-petstore-server-reactive.sh \ No newline at end of file diff --git a/bin/kotlin-springboot-petstore-server-reactive.sh b/bin/kotlin-springboot-petstore-server-reactive.sh new file mode 100755 index 000000000000..f5e72350b622 --- /dev/null +++ b/bin/kotlin-springboot-petstore-server-reactive.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +while [ -h "$SCRIPT" ] ; do + ls=$(ls -ld "$SCRIPT") + link=$(expr "$ls" : '.*-> \(.*\)$') + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=$(dirname "$SCRIPT")/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=$(dirname "$SCRIPT")/.. + APP_DIR=$(cd "${APP_DIR}"; pwd) +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="$@ generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-spring -g kotlin-spring -o samples/server/petstore/kotlin-springboot-reactive --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true,reactive=true" + +echo "Cleaning previously generated files if any from samples/server/petstore/kotlin-springboot-reactive" +rm -rf samples/server/petstore/kotlin-springboot-reactive + +echo "Generating Kotling Spring Boot reactive server..." +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/kotlin-springboot-petstore-all.sh b/bin/openapi3/kotlin-springboot-petstore-all.sh new file mode 100755 index 000000000000..7aa4f697bbd3 --- /dev/null +++ b/bin/openapi3/kotlin-springboot-petstore-all.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +./bin/openapi3/kotlin-springboot-petstore-server.sh +./bin/openapi3/kotlin-springboot-petstore-server-reactive.sh diff --git a/bin/openapi3/kotlin-springboot-petstore-server-reactive.sh b/bin/openapi3/kotlin-springboot-petstore-server-reactive.sh new file mode 100755 index 000000000000..8c0d80c4e525 --- /dev/null +++ b/bin/openapi3/kotlin-springboot-petstore-server-reactive.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +while [ -h "$SCRIPT" ] ; do + ls=$(ls -ld "$SCRIPT") + link=$(expr "$ls" : '.*-> \(.*\)$') + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=$(dirname "$SCRIPT")/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=$(dirname "$SCRIPT")/.. + APP_DIR=$(cd "${APP_DIR}"; pwd) +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-spring -g kotlin-spring -o samples/server/openapi3/petstore/kotlin-springboot-reactive --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true,reactive=true" + +echo "Cleaning previously generated files if any from samples/server/openapi3/petstore/kotlin-springboot-reactive" +rm -rf samples/server/openapi3/petstore/kotlin-springboot-reactive + +echo "Generating Kotling Spring Boot server..." +java $JAVA_OPTS -jar $executable $ags diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/.openapi-generator-ignore b/samples/server/openapi3/petstore/kotlin-springboot-reactive/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION b/samples/server/openapi3/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION new file mode 100644 index 000000000000..06b5019af3f4 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/README.md b/samples/server/openapi3/petstore/kotlin-springboot-reactive/README.md new file mode 100644 index 000000000000..b6865a081135 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/README.md @@ -0,0 +1,21 @@ +# openAPIPetstore + +This Kotlin based [Spring Boot](https://spring.io/projects/spring-boot) application has been generated using the [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator). + +## Getting Started + +This document assumes you have either maven or gradle available, either via the wrapper or otherwise. This does not come with a gradle / maven wrapper checked in. + +By default a [`pom.xml`](pom.xml) file will be generated. If you specified `gradleBuildFile=true` when generating this project, a `build.gradle.kts` will also be generated. Note this uses [Gradle Kotlin DSL](https://github.com/gradle/kotlin-dsl). + +To build the project using maven, run: +```bash +mvn package && java -jar target/openapi-spring-1.0.0.jar +``` + +To build the project using gradle, run: +```bash +gradle build && java -jar build/libs/openapi-spring-1.0.0.jar +``` + +If all builds successfully, the server should run on [http://localhost:8080/](http://localhost:8080/) diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts b/samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts new file mode 100644 index 000000000000..1024b4b12bd9 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts @@ -0,0 +1,46 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +buildscript { + repositories { + jcenter() + mavenCentral() + } + dependencies { + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE") + } +} + +group = "org.openapitools" +version = "1.0.0" + +repositories { + jcenter() + mavenCentral() +} + +tasks.withType { + kotlinOptions.jvmTarget = "1.8" +} + +plugins { + val kotlinVersion = "1.2.60" + id("org.jetbrains.kotlin.jvm") version kotlinVersion + id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion + id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion + id("org.springframework.boot") version "2.2.0.M3" + id("io.spring.dependency-management") version "1.0.5.RELEASE" +} + +dependencies { + compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8") + compile("org.jetbrains.kotlin:kotlin-reflect") + compile("org.springframework.boot:spring-boot-starter-webflux") + compile("io.swagger:swagger-annotations:1.5.21") + compile("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml") + compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml") + compile("com.fasterxml.jackson.module:jackson-module-kotlin") + + testCompile("org.springframework.boot:spring-boot-starter-test") { + exclude(module = "junit") + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/pom.xml b/samples/server/openapi3/petstore/kotlin-springboot-reactive/pom.xml new file mode 100644 index 000000000000..b3b4d628007b --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/pom.xml @@ -0,0 +1,109 @@ + + 4.0.0 + org.openapitools + openapi-spring + jar + openapi-spring + 1.0.0 + + 1.2.60 + + + org.springframework.boot + spring-boot-starter-parent + 2.2.0.M3 + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/test/kotlin + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + spring + + 1.8 + + + + compile + compile + + compile + + + + test-compile + test-compile + + test-compile + + + + + + org.jetbrains.kotlin + kotlin-maven-allopen + ${kotlin.version} + + + + + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-reflect + ${kotlin.version} + + + org.springframework.boot + spring-boot-starter-webflux + + + io.swagger + swagger-annotations + 1.5.21 + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + com.fasterxml.jackson.module + jackson-module-kotlin + + + + javax.validation + validation-api + + + diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/settings.gradle b/samples/server/openapi3/petstore/kotlin-springboot-reactive/settings.gradle new file mode 100644 index 000000000000..f0dd035311e0 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "openapi-spring" \ No newline at end of file diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/Application.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/Application.kt new file mode 100644 index 000000000000..f2ee49d476b6 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/Application.kt @@ -0,0 +1,14 @@ +package org.openapitools + +import org.springframework.boot.runApplication +import org.springframework.context.annotation.ComponentScan +import org.springframework.boot.autoconfigure.SpringBootApplication + + +@SpringBootApplication +@ComponentScan(basePackages = ["org.openapitools", "org.openapitools.api", "org.openapitools.model"]) +class Application + +fun main(args: Array) { + runApplication(*args) +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/Exceptions.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/Exceptions.kt new file mode 100644 index 000000000000..4d8400902aa9 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/Exceptions.kt @@ -0,0 +1,29 @@ +package org.openapitools.api + +import org.springframework.http.HttpStatus +import org.springframework.web.bind.annotation.ControllerAdvice +import org.springframework.web.bind.annotation.ExceptionHandler +import javax.servlet.http.HttpServletResponse +import javax.validation.ConstraintViolationException + +// TODO Extend ApiException for custom exception handling, e.g. the below NotFound exception +sealed class ApiException(msg: String, val code: Int) : Exception(msg) + +class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code) + + +@ControllerAdvice +class DefaultExceptionHandler { + + @ExceptionHandler(value = [ApiException::class]) + fun onApiException(ex: ApiException, response: HttpServletResponse): Unit = + response.sendError(ex.code, ex.message) + + @ExceptionHandler(value = [NotImplementedError::class]) + fun onNotImplemented(ex: NotImplementedError, response: HttpServletResponse): Unit = + response.sendError(HttpStatus.NOT_IMPLEMENTED.value()) + + @ExceptionHandler(value = [ConstraintViolationException::class]) + fun onConstraintViolation(ex: ConstraintViolationException, response: HttpServletResponse): Unit = + response.sendError(HttpStatus.BAD_REQUEST.value(), ex.constraintViolations.joinToString(", ") { it.message }) +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt new file mode 100644 index 000000000000..29de43b1a020 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -0,0 +1,186 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import io.swagger.annotations.ApiResponse +import io.swagger.annotations.ApiResponses +import io.swagger.annotations.Authorization +import io.swagger.annotations.AuthorizationScope +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity + +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.RequestHeader +import org.springframework.web.bind.annotation.RequestMethod +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController +import org.springframework.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.Valid +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size + +import kotlinx.coroutines.flow.Flow; +import kotlin.collections.List +import kotlin.collections.Map + +@RestController +@Validated +@Api(value = "Pet", description = "The Pet API") +@RequestMapping("\${api.base-path:/v2}") +class PetApiController(@Autowired(required = true) val service: PetApiService) { + + @ApiOperation( + value = "Add a new pet to the store", + nickname = "addPet", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 405, message = "Invalid input")]) + @RequestMapping( + value = ["/pet"], + consumes = ["application/json", "application/xml"], + method = [RequestMethod.POST]) + suspend fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet +): ResponseEntity { + return ResponseEntity(service.addPet(pet), HttpStatus.OK) + } + + @ApiOperation( + value = "Deletes a pet", + nickname = "deletePet", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid pet value")]) + @RequestMapping( + value = ["/pet/{petId}"], + method = [RequestMethod.DELETE]) + suspend fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: Long +,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: String? +): ResponseEntity { + return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.OK) + } + + @ApiOperation( + value = "Finds Pets by status", + nickname = "findPetsByStatus", + notes = "Multiple status values can be provided with comma separated strings", + response = Pet::class, + responseContainer = "List", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid status value")]) + @RequestMapping( + value = ["/pet/findByStatus"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + 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: List +): ResponseEntity> { + return ResponseEntity(service.findPetsByStatus(status), HttpStatus.OK) + } + + @ApiOperation( + value = "Finds Pets by tags", + nickname = "findPetsByTags", + notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + response = Pet::class, + responseContainer = "List", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid tag value")]) + @RequestMapping( + value = ["/pet/findByTags"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: List +,@ApiParam(value = "Maximum number of items to return") @Valid @RequestParam(value = "maxCount", required = false) maxCount: Int? +): ResponseEntity> { + return ResponseEntity(service.findPetsByTags(tags, maxCount), HttpStatus.OK) + } + + @ApiOperation( + value = "Find pet by ID", + nickname = "getPetById", + notes = "Returns a single pet", + response = Pet::class, + authorizations = [Authorization(value = "api_key")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found")]) + @RequestMapping( + value = ["/pet/{petId}"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + suspend fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: Long +): ResponseEntity { + return ResponseEntity(service.getPetById(petId), HttpStatus.OK) + } + + @ApiOperation( + value = "Update an existing pet", + nickname = "updatePet", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found"),ApiResponse(code = 405, message = "Validation exception")]) + @RequestMapping( + value = ["/pet"], + consumes = ["application/json", "application/xml"], + method = [RequestMethod.PUT]) + suspend fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet +): ResponseEntity { + return ResponseEntity(service.updatePet(pet), HttpStatus.OK) + } + + @ApiOperation( + value = "Updates a pet in the store with form data", + nickname = "updatePetWithForm", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 405, message = "Invalid input")]) + @RequestMapping( + value = ["/pet/{petId}"], + consumes = ["application/x-www-form-urlencoded"], + method = [RequestMethod.POST]) + suspend fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: Long +,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: String? +,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: String? +): ResponseEntity { + return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.OK) + } + + @ApiOperation( + value = "uploads an image", + nickname = "uploadFile", + notes = "", + response = ModelApiResponse::class, + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse::class)]) + @RequestMapping( + value = ["/pet/{petId}/uploadImage"], + produces = ["application/json"], + consumes = ["multipart/form-data"], + method = [RequestMethod.POST]) + suspend fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: Long +,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: String? +,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource? +): ResponseEntity { + return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.OK) + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt new file mode 100644 index 000000000000..2bd53b2a56d2 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -0,0 +1,23 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import kotlinx.coroutines.flow.Flow; +interface PetApiService { + + suspend fun addPet(pet: Pet): Unit + + suspend fun deletePet(petId: Long, apiKey: String?): Unit + + fun findPetsByStatus(status: List): Flow + + fun findPetsByTags(tags: List, maxCount: Int?): Flow + + suspend fun getPetById(petId: Long): Pet + + suspend fun updatePet(pet: Pet): Unit + + suspend fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit + + suspend fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt new file mode 100644 index 000000000000..009f039d8600 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt @@ -0,0 +1,41 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import kotlinx.coroutines.flow.Flow; +import org.springframework.stereotype.Service +@Service +class PetApiServiceImpl : PetApiService { + + override suspend fun addPet(pet: Pet): Unit { + TODO("Implement me") + } + + override suspend fun deletePet(petId: Long, apiKey: String?): Unit { + TODO("Implement me") + } + + override fun findPetsByStatus(status: List): Flow { + TODO("Implement me") + } + + override fun findPetsByTags(tags: List, maxCount: Int?): Flow { + TODO("Implement me") + } + + override suspend fun getPetById(petId: Long): Pet { + TODO("Implement me") + } + + override suspend fun updatePet(pet: Pet): Unit { + TODO("Implement me") + } + + override suspend fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit { + TODO("Implement me") + } + + override suspend fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse { + TODO("Implement me") + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt new file mode 100644 index 000000000000..2ee42a772334 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -0,0 +1,109 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import io.swagger.annotations.ApiResponse +import io.swagger.annotations.ApiResponses +import io.swagger.annotations.Authorization +import io.swagger.annotations.AuthorizationScope +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity + +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.RequestHeader +import org.springframework.web.bind.annotation.RequestMethod +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController +import org.springframework.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.Valid +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size + +import kotlinx.coroutines.flow.Flow; +import kotlin.collections.List +import kotlin.collections.Map + +@RestController +@Validated +@Api(value = "Store", description = "The Store API") +@RequestMapping("\${api.base-path:/v2}") +class StoreApiController(@Autowired(required = true) val service: StoreApiService) { + + @ApiOperation( + value = "Delete purchase order by ID", + nickname = "deleteOrder", + notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors") + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")]) + @RequestMapping( + value = ["/store/order/{orderId}"], + method = [RequestMethod.DELETE]) + suspend fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: String +): ResponseEntity { + return ResponseEntity(service.deleteOrder(orderId), HttpStatus.OK) + } + + @ApiOperation( + value = "Returns pet inventories by status", + nickname = "getInventory", + notes = "Returns a map of status codes to quantities", + response = Int::class, + responseContainer = "Map", + authorizations = [Authorization(value = "api_key")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Map::class, responseContainer = "Map")]) + @RequestMapping( + value = ["/store/inventory"], + produces = ["application/json"], + method = [RequestMethod.GET]) + suspend fun getInventory(): ResponseEntity> { + return ResponseEntity(service.getInventory(), HttpStatus.OK) + } + + @ApiOperation( + value = "Find purchase order by ID", + nickname = "getOrderById", + notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", + response = Order::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")]) + @RequestMapping( + value = ["/store/order/{orderId}"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + suspend fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: Long +): ResponseEntity { + return ResponseEntity(service.getOrderById(orderId), HttpStatus.OK) + } + + @ApiOperation( + value = "Place an order for a pet", + nickname = "placeOrder", + notes = "", + response = Order::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid Order")]) + @RequestMapping( + value = ["/store/order"], + produces = ["application/xml", "application/json"], + consumes = ["application/json"], + method = [RequestMethod.POST]) + suspend fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody order: Order +): ResponseEntity { + return ResponseEntity(service.placeOrder(order), HttpStatus.OK) + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiService.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiService.kt new file mode 100644 index 000000000000..84dc28370548 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiService.kt @@ -0,0 +1,14 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import kotlinx.coroutines.flow.Flow; +interface StoreApiService { + + suspend fun deleteOrder(orderId: String): Unit + + suspend fun getInventory(): Map + + suspend fun getOrderById(orderId: Long): Order + + suspend fun placeOrder(order: Order): Order +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt new file mode 100644 index 000000000000..f29e7e08c2e5 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt @@ -0,0 +1,24 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import kotlinx.coroutines.flow.Flow; +import org.springframework.stereotype.Service +@Service +class StoreApiServiceImpl : StoreApiService { + + override suspend fun deleteOrder(orderId: String): Unit { + TODO("Implement me") + } + + override suspend fun getInventory(): Map { + TODO("Implement me") + } + + override suspend fun getOrderById(orderId: Long): Order { + TODO("Implement me") + } + + override suspend fun placeOrder(order: Order): Order { + TODO("Implement me") + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt new file mode 100644 index 000000000000..e52f8176f82b --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -0,0 +1,172 @@ +package org.openapitools.api + +import org.openapitools.model.User +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import io.swagger.annotations.ApiResponse +import io.swagger.annotations.ApiResponses +import io.swagger.annotations.Authorization +import io.swagger.annotations.AuthorizationScope +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity + +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.RequestHeader +import org.springframework.web.bind.annotation.RequestMethod +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController +import org.springframework.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.Valid +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size + +import kotlinx.coroutines.flow.Flow; +import kotlin.collections.List +import kotlin.collections.Map + +@RestController +@Validated +@Api(value = "User", description = "The User API") +@RequestMapping("\${api.base-path:/v2}") +class UserApiController(@Autowired(required = true) val service: UserApiService) { + + @ApiOperation( + value = "Create user", + nickname = "createUser", + notes = "This can only be done by the logged in user.", + authorizations = [Authorization(value = "auth_cookie")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation")]) + @RequestMapping( + value = ["/user"], + consumes = ["application/json"], + method = [RequestMethod.POST]) + suspend fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody user: User +): ResponseEntity { + return ResponseEntity(service.createUser(user), HttpStatus.OK) + } + + @ApiOperation( + value = "Creates list of users with given input array", + nickname = "createUsersWithArrayInput", + notes = "", + authorizations = [Authorization(value = "auth_cookie")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation")]) + @RequestMapping( + value = ["/user/createWithArray"], + consumes = ["application/json"], + method = [RequestMethod.POST]) + suspend fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: Flow +): ResponseEntity { + return ResponseEntity(service.createUsersWithArrayInput(user), HttpStatus.OK) + } + + @ApiOperation( + value = "Creates list of users with given input array", + nickname = "createUsersWithListInput", + notes = "", + authorizations = [Authorization(value = "auth_cookie")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation")]) + @RequestMapping( + value = ["/user/createWithList"], + consumes = ["application/json"], + method = [RequestMethod.POST]) + suspend fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: Flow +): ResponseEntity { + return ResponseEntity(service.createUsersWithListInput(user), HttpStatus.OK) + } + + @ApiOperation( + value = "Delete user", + nickname = "deleteUser", + notes = "This can only be done by the logged in user.", + authorizations = [Authorization(value = "auth_cookie")]) + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) + @RequestMapping( + value = ["/user/{username}"], + method = [RequestMethod.DELETE]) + suspend fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: String +): ResponseEntity { + return ResponseEntity(service.deleteUser(username), HttpStatus.OK) + } + + @ApiOperation( + value = "Get user by user name", + nickname = "getUserByName", + notes = "", + response = User::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = User::class),ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) + @RequestMapping( + value = ["/user/{username}"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + suspend fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: String +): ResponseEntity { + return ResponseEntity(service.getUserByName(username), HttpStatus.OK) + } + + @ApiOperation( + value = "Logs user into the system", + nickname = "loginUser", + notes = "", + response = String::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")]) + @RequestMapping( + value = ["/user/login"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + suspend fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: String +,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: String +): ResponseEntity { + return ResponseEntity(service.loginUser(username, password), HttpStatus.OK) + } + + @ApiOperation( + value = "Logs out current logged in user session", + nickname = "logoutUser", + notes = "", + authorizations = [Authorization(value = "auth_cookie")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation")]) + @RequestMapping( + value = ["/user/logout"], + method = [RequestMethod.GET]) + suspend fun logoutUser(): ResponseEntity { + return ResponseEntity(service.logoutUser(), HttpStatus.OK) + } + + @ApiOperation( + value = "Updated user", + nickname = "updateUser", + notes = "This can only be done by the logged in user.", + authorizations = [Authorization(value = "auth_cookie")]) + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid user supplied"),ApiResponse(code = 404, message = "User not found")]) + @RequestMapping( + value = ["/user/{username}"], + consumes = ["application/json"], + method = [RequestMethod.PUT]) + suspend fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: String +,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody user: User +): ResponseEntity { + return ResponseEntity(service.updateUser(username, user), HttpStatus.OK) + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt new file mode 100644 index 000000000000..85e1c39aa730 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt @@ -0,0 +1,22 @@ +package org.openapitools.api + +import org.openapitools.model.User +import kotlinx.coroutines.flow.Flow; +interface UserApiService { + + suspend fun createUser(user: User): Unit + + suspend fun createUsersWithArrayInput(user: List): Unit + + suspend fun createUsersWithListInput(user: List): Unit + + suspend fun deleteUser(username: String): Unit + + suspend fun getUserByName(username: String): User + + suspend fun loginUser(username: String, password: String): String + + suspend fun logoutUser(): Unit + + suspend fun updateUser(username: String, user: User): Unit +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt new file mode 100644 index 000000000000..1ba904684b88 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt @@ -0,0 +1,40 @@ +package org.openapitools.api + +import org.openapitools.model.User +import kotlinx.coroutines.flow.Flow; +import org.springframework.stereotype.Service +@Service +class UserApiServiceImpl : UserApiService { + + override suspend fun createUser(user: User): Unit { + TODO("Implement me") + } + + override suspend fun createUsersWithArrayInput(user: List): Unit { + TODO("Implement me") + } + + override suspend fun createUsersWithListInput(user: List): Unit { + TODO("Implement me") + } + + override suspend fun deleteUser(username: String): Unit { + TODO("Implement me") + } + + override suspend fun getUserByName(username: String): User { + TODO("Implement me") + } + + override suspend fun loginUser(username: String, password: String): String { + TODO("Implement me") + } + + override suspend fun logoutUser(): Unit { + TODO("Implement me") + } + + override suspend fun updateUser(username: String, user: User): Unit { + TODO("Implement me") + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt new file mode 100644 index 000000000000..e042a7f997c3 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt @@ -0,0 +1,29 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * A category for a pet + * @param id + * @param name + */ +data class Category ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: Long? = null, +@get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") + @ApiModelProperty(example = "null", value = "") + @JsonProperty("name") val name: String? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/InlineObject.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/InlineObject.kt new file mode 100644 index 000000000000..e998bc995ce4 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/InlineObject.kt @@ -0,0 +1,29 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * + * @param name Updated name of the pet + * @param status Updated status of the pet + */ +data class InlineObject ( + + @ApiModelProperty(example = "null", value = "Updated name of the pet") + @JsonProperty("name") val name: String? = null, + + @ApiModelProperty(example = "null", value = "Updated status of the pet") + @JsonProperty("status") val status: String? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/InlineObject1.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/InlineObject1.kt new file mode 100644 index 000000000000..d29578fd0c09 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/InlineObject1.kt @@ -0,0 +1,29 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ +data class InlineObject1 ( + + @ApiModelProperty(example = "null", value = "Additional data to pass to server") + @JsonProperty("additionalMetadata") val additionalMetadata: String? = null, + + @ApiModelProperty(example = "null", value = "file to upload") + @JsonProperty("file") val file: org.springframework.core.io.Resource? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt new file mode 100644 index 000000000000..2f844a9c3565 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -0,0 +1,33 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * Describes the result of uploading an image resource + * @param code + * @param type + * @param message + */ +data class ModelApiResponse ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("code") val code: Int? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("type") val type: String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("message") val message: String? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt new file mode 100644 index 000000000000..e20d850491fa --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt @@ -0,0 +1,60 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonValue +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * An order for a pets from the pet store + * @param id + * @param petId + * @param quantity + * @param shipDate + * @param status Order Status + * @param complete + */ +data class Order ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("petId") val petId: Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("quantity") val quantity: Int? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + + @ApiModelProperty(example = "null", value = "Order Status") + @JsonProperty("status") val status: Order.Status? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("complete") val complete: Boolean? = null +) { + + /** + * Order Status + * Values: placed,approved,delivered + */ + enum class Status(val value: String) { + + @JsonProperty("placed") placed("placed"), + + @JsonProperty("approved") approved("approved"), + + @JsonProperty("delivered") delivered("delivered"); + + } + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt new file mode 100644 index 000000000000..9e054ac22f73 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt @@ -0,0 +1,64 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonValue +import org.openapitools.model.Category +import org.openapitools.model.Tag +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * A pet for sale in the pet store + * @param id + * @param category + * @param name + * @param photoUrls + * @param tags + * @param status pet status in the store + */ +data class Pet ( + + @get:NotNull + @ApiModelProperty(example = "doggie", required = true, value = "") + @JsonProperty("name") val name: String, + + @get:NotNull + @ApiModelProperty(example = "null", required = true, value = "") + @JsonProperty("photoUrls") val photoUrls: List, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("category") val category: Category? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("tags") val tags: List? = null, + + @ApiModelProperty(example = "null", value = "pet status in the store") + @JsonProperty("status") val status: Pet.Status? = null +) { + + /** + * pet status in the store + * Values: available,pending,sold + */ + enum class Status(val value: String) { + + @JsonProperty("available") available("available"), + + @JsonProperty("pending") pending("pending"), + + @JsonProperty("sold") sold("sold"); + + } + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt new file mode 100644 index 000000000000..40ef1b9a86b7 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt @@ -0,0 +1,29 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * A tag for a pet + * @param id + * @param name + */ +data class Tag ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("name") val name: String? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt new file mode 100644 index 000000000000..95fe12aa467b --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt @@ -0,0 +1,53 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * A User who is purchasing from the pet store + * @param id + * @param username + * @param firstName + * @param lastName + * @param email + * @param password + * @param phone + * @param userStatus User Status + */ +data class User ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("username") val username: String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("firstName") val firstName: String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("lastName") val lastName: String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("email") val email: String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("password") val password: String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("phone") val phone: String? = null, + + @ApiModelProperty(example = "null", value = "User Status") + @JsonProperty("userStatus") val userStatus: Int? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/resources/application.yaml b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/resources/application.yaml new file mode 100644 index 000000000000..8e2ebcde976d --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/resources/application.yaml @@ -0,0 +1,10 @@ +spring: + application: + name: openAPIPetstore + + jackson: + serialization: + WRITE_DATES_AS_TIMESTAMPS: false + +server: + port: 8080 diff --git a/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator-ignore b/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION b/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION new file mode 100644 index 000000000000..06b5019af3f4 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/kotlin-springboot-reactive/README.md b/samples/server/petstore/kotlin-springboot-reactive/README.md new file mode 100644 index 000000000000..b6865a081135 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/README.md @@ -0,0 +1,21 @@ +# openAPIPetstore + +This Kotlin based [Spring Boot](https://spring.io/projects/spring-boot) application has been generated using the [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator). + +## Getting Started + +This document assumes you have either maven or gradle available, either via the wrapper or otherwise. This does not come with a gradle / maven wrapper checked in. + +By default a [`pom.xml`](pom.xml) file will be generated. If you specified `gradleBuildFile=true` when generating this project, a `build.gradle.kts` will also be generated. Note this uses [Gradle Kotlin DSL](https://github.com/gradle/kotlin-dsl). + +To build the project using maven, run: +```bash +mvn package && java -jar target/openapi-spring-1.0.0.jar +``` + +To build the project using gradle, run: +```bash +gradle build && java -jar build/libs/openapi-spring-1.0.0.jar +``` + +If all builds successfully, the server should run on [http://localhost:8080/](http://localhost:8080/) diff --git a/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts b/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts new file mode 100644 index 000000000000..1024b4b12bd9 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts @@ -0,0 +1,46 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +buildscript { + repositories { + jcenter() + mavenCentral() + } + dependencies { + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE") + } +} + +group = "org.openapitools" +version = "1.0.0" + +repositories { + jcenter() + mavenCentral() +} + +tasks.withType { + kotlinOptions.jvmTarget = "1.8" +} + +plugins { + val kotlinVersion = "1.2.60" + id("org.jetbrains.kotlin.jvm") version kotlinVersion + id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion + id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion + id("org.springframework.boot") version "2.2.0.M3" + id("io.spring.dependency-management") version "1.0.5.RELEASE" +} + +dependencies { + compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8") + compile("org.jetbrains.kotlin:kotlin-reflect") + compile("org.springframework.boot:spring-boot-starter-webflux") + compile("io.swagger:swagger-annotations:1.5.21") + compile("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml") + compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml") + compile("com.fasterxml.jackson.module:jackson-module-kotlin") + + testCompile("org.springframework.boot:spring-boot-starter-test") { + exclude(module = "junit") + } +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/pom.xml b/samples/server/petstore/kotlin-springboot-reactive/pom.xml new file mode 100644 index 000000000000..b3b4d628007b --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/pom.xml @@ -0,0 +1,109 @@ + + 4.0.0 + org.openapitools + openapi-spring + jar + openapi-spring + 1.0.0 + + 1.2.60 + + + org.springframework.boot + spring-boot-starter-parent + 2.2.0.M3 + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/test/kotlin + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + spring + + 1.8 + + + + compile + compile + + compile + + + + test-compile + test-compile + + test-compile + + + + + + org.jetbrains.kotlin + kotlin-maven-allopen + ${kotlin.version} + + + + + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-reflect + ${kotlin.version} + + + org.springframework.boot + spring-boot-starter-webflux + + + io.swagger + swagger-annotations + 1.5.21 + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + com.fasterxml.jackson.module + jackson-module-kotlin + + + + javax.validation + validation-api + + + diff --git a/samples/server/petstore/kotlin-springboot-reactive/settings.gradle b/samples/server/petstore/kotlin-springboot-reactive/settings.gradle new file mode 100644 index 000000000000..f0dd035311e0 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "openapi-spring" \ No newline at end of file diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/Application.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/Application.kt new file mode 100644 index 000000000000..f2ee49d476b6 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/Application.kt @@ -0,0 +1,14 @@ +package org.openapitools + +import org.springframework.boot.runApplication +import org.springframework.context.annotation.ComponentScan +import org.springframework.boot.autoconfigure.SpringBootApplication + + +@SpringBootApplication +@ComponentScan(basePackages = ["org.openapitools", "org.openapitools.api", "org.openapitools.model"]) +class Application + +fun main(args: Array) { + runApplication(*args) +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/Exceptions.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/Exceptions.kt new file mode 100644 index 000000000000..4d8400902aa9 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/Exceptions.kt @@ -0,0 +1,29 @@ +package org.openapitools.api + +import org.springframework.http.HttpStatus +import org.springframework.web.bind.annotation.ControllerAdvice +import org.springframework.web.bind.annotation.ExceptionHandler +import javax.servlet.http.HttpServletResponse +import javax.validation.ConstraintViolationException + +// TODO Extend ApiException for custom exception handling, e.g. the below NotFound exception +sealed class ApiException(msg: String, val code: Int) : Exception(msg) + +class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code) + + +@ControllerAdvice +class DefaultExceptionHandler { + + @ExceptionHandler(value = [ApiException::class]) + fun onApiException(ex: ApiException, response: HttpServletResponse): Unit = + response.sendError(ex.code, ex.message) + + @ExceptionHandler(value = [NotImplementedError::class]) + fun onNotImplemented(ex: NotImplementedError, response: HttpServletResponse): Unit = + response.sendError(HttpStatus.NOT_IMPLEMENTED.value()) + + @ExceptionHandler(value = [ConstraintViolationException::class]) + fun onConstraintViolation(ex: ConstraintViolationException, response: HttpServletResponse): Unit = + response.sendError(HttpStatus.BAD_REQUEST.value(), ex.constraintViolations.joinToString(", ") { it.message }) +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt new file mode 100644 index 000000000000..380c94d5acb9 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -0,0 +1,185 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import io.swagger.annotations.ApiResponse +import io.swagger.annotations.ApiResponses +import io.swagger.annotations.Authorization +import io.swagger.annotations.AuthorizationScope +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity + +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.RequestHeader +import org.springframework.web.bind.annotation.RequestMethod +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController +import org.springframework.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.Valid +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size + +import kotlinx.coroutines.flow.Flow; +import kotlin.collections.List +import kotlin.collections.Map + +@RestController +@Validated +@Api(value = "Pet", description = "The Pet API") +@RequestMapping("\${api.base-path:/v2}") +class PetApiController(@Autowired(required = true) val service: PetApiService) { + + @ApiOperation( + value = "Add a new pet to the store", + nickname = "addPet", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 405, message = "Invalid input")]) + @RequestMapping( + value = ["/pet"], + consumes = ["application/json", "application/xml"], + method = [RequestMethod.POST]) + suspend fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet +): ResponseEntity { + return ResponseEntity(service.addPet(body), HttpStatus.OK) + } + + @ApiOperation( + value = "Deletes a pet", + nickname = "deletePet", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid pet value")]) + @RequestMapping( + value = ["/pet/{petId}"], + method = [RequestMethod.DELETE]) + suspend fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: Long +,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: String? +): ResponseEntity { + return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.OK) + } + + @ApiOperation( + value = "Finds Pets by status", + nickname = "findPetsByStatus", + notes = "Multiple status values can be provided with comma separated strings", + response = Pet::class, + responseContainer = "List", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid status value")]) + @RequestMapping( + value = ["/pet/findByStatus"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + 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: List +): ResponseEntity> { + return ResponseEntity(service.findPetsByStatus(status), HttpStatus.OK) + } + + @ApiOperation( + value = "Finds Pets by tags", + nickname = "findPetsByTags", + notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + response = Pet::class, + responseContainer = "List", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid tag value")]) + @RequestMapping( + value = ["/pet/findByTags"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: List +): ResponseEntity> { + return ResponseEntity(service.findPetsByTags(tags), HttpStatus.OK) + } + + @ApiOperation( + value = "Find pet by ID", + nickname = "getPetById", + notes = "Returns a single pet", + response = Pet::class, + authorizations = [Authorization(value = "api_key")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found")]) + @RequestMapping( + value = ["/pet/{petId}"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + suspend fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: Long +): ResponseEntity { + return ResponseEntity(service.getPetById(petId), HttpStatus.OK) + } + + @ApiOperation( + value = "Update an existing pet", + nickname = "updatePet", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found"),ApiResponse(code = 405, message = "Validation exception")]) + @RequestMapping( + value = ["/pet"], + consumes = ["application/json", "application/xml"], + method = [RequestMethod.PUT]) + suspend fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet +): ResponseEntity { + return ResponseEntity(service.updatePet(body), HttpStatus.OK) + } + + @ApiOperation( + value = "Updates a pet in the store with form data", + nickname = "updatePetWithForm", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 405, message = "Invalid input")]) + @RequestMapping( + value = ["/pet/{petId}"], + consumes = ["application/x-www-form-urlencoded"], + method = [RequestMethod.POST]) + suspend fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: Long +,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: String? +,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: String? +): ResponseEntity { + return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.OK) + } + + @ApiOperation( + value = "uploads an image", + nickname = "uploadFile", + notes = "", + response = ModelApiResponse::class, + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse::class)]) + @RequestMapping( + value = ["/pet/{petId}/uploadImage"], + produces = ["application/json"], + consumes = ["multipart/form-data"], + method = [RequestMethod.POST]) + suspend fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: Long +,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: String? +,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource? +): ResponseEntity { + return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.OK) + } +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt new file mode 100644 index 000000000000..613d30d3b1f0 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -0,0 +1,23 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import kotlinx.coroutines.flow.Flow; +interface PetApiService { + + suspend fun addPet(body: Pet): Unit + + suspend fun deletePet(petId: Long, apiKey: String?): Unit + + fun findPetsByStatus(status: List): Flow + + fun findPetsByTags(tags: List): Flow + + suspend fun getPetById(petId: Long): Pet + + suspend fun updatePet(body: Pet): Unit + + suspend fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit + + suspend fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt new file mode 100644 index 000000000000..56dee71b00c4 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt @@ -0,0 +1,41 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import kotlinx.coroutines.flow.Flow; +import org.springframework.stereotype.Service +@Service +class PetApiServiceImpl : PetApiService { + + override suspend fun addPet(body: Pet): Unit { + TODO("Implement me") + } + + override suspend fun deletePet(petId: Long, apiKey: String?): Unit { + TODO("Implement me") + } + + override fun findPetsByStatus(status: List): Flow { + TODO("Implement me") + } + + override fun findPetsByTags(tags: List): Flow { + TODO("Implement me") + } + + override suspend fun getPetById(petId: Long): Pet { + TODO("Implement me") + } + + override suspend fun updatePet(body: Pet): Unit { + TODO("Implement me") + } + + override suspend fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit { + TODO("Implement me") + } + + override suspend fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse { + TODO("Implement me") + } +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt new file mode 100644 index 000000000000..50840e057202 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -0,0 +1,108 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import io.swagger.annotations.ApiResponse +import io.swagger.annotations.ApiResponses +import io.swagger.annotations.Authorization +import io.swagger.annotations.AuthorizationScope +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity + +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.RequestHeader +import org.springframework.web.bind.annotation.RequestMethod +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController +import org.springframework.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.Valid +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size + +import kotlinx.coroutines.flow.Flow; +import kotlin.collections.List +import kotlin.collections.Map + +@RestController +@Validated +@Api(value = "Store", description = "The Store API") +@RequestMapping("\${api.base-path:/v2}") +class StoreApiController(@Autowired(required = true) val service: StoreApiService) { + + @ApiOperation( + value = "Delete purchase order by ID", + nickname = "deleteOrder", + notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors") + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")]) + @RequestMapping( + value = ["/store/order/{orderId}"], + method = [RequestMethod.DELETE]) + suspend fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: String +): ResponseEntity { + return ResponseEntity(service.deleteOrder(orderId), HttpStatus.OK) + } + + @ApiOperation( + value = "Returns pet inventories by status", + nickname = "getInventory", + notes = "Returns a map of status codes to quantities", + response = Int::class, + responseContainer = "Map", + authorizations = [Authorization(value = "api_key")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Map::class, responseContainer = "Map")]) + @RequestMapping( + value = ["/store/inventory"], + produces = ["application/json"], + method = [RequestMethod.GET]) + suspend fun getInventory(): ResponseEntity> { + return ResponseEntity(service.getInventory(), HttpStatus.OK) + } + + @ApiOperation( + value = "Find purchase order by ID", + nickname = "getOrderById", + notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", + response = Order::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")]) + @RequestMapping( + value = ["/store/order/{orderId}"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + suspend fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: Long +): ResponseEntity { + return ResponseEntity(service.getOrderById(orderId), HttpStatus.OK) + } + + @ApiOperation( + value = "Place an order for a pet", + nickname = "placeOrder", + notes = "", + response = Order::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid Order")]) + @RequestMapping( + value = ["/store/order"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.POST]) + suspend fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody body: Order +): ResponseEntity { + return ResponseEntity(service.placeOrder(body), HttpStatus.OK) + } +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiService.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiService.kt new file mode 100644 index 000000000000..8c9ab08812f9 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiService.kt @@ -0,0 +1,14 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import kotlinx.coroutines.flow.Flow; +interface StoreApiService { + + suspend fun deleteOrder(orderId: String): Unit + + suspend fun getInventory(): Map + + suspend fun getOrderById(orderId: Long): Order + + suspend fun placeOrder(body: Order): Order +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt new file mode 100644 index 000000000000..58657034b109 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt @@ -0,0 +1,24 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import kotlinx.coroutines.flow.Flow; +import org.springframework.stereotype.Service +@Service +class StoreApiServiceImpl : StoreApiService { + + override suspend fun deleteOrder(orderId: String): Unit { + TODO("Implement me") + } + + override suspend fun getInventory(): Map { + TODO("Implement me") + } + + override suspend fun getOrderById(orderId: Long): Order { + TODO("Implement me") + } + + override suspend fun placeOrder(body: Order): Order { + TODO("Implement me") + } +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt new file mode 100644 index 000000000000..f311c28ff2dd --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -0,0 +1,162 @@ +package org.openapitools.api + +import org.openapitools.model.User +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import io.swagger.annotations.ApiResponse +import io.swagger.annotations.ApiResponses +import io.swagger.annotations.Authorization +import io.swagger.annotations.AuthorizationScope +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity + +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.RequestHeader +import org.springframework.web.bind.annotation.RequestMethod +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController +import org.springframework.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.Valid +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size + +import kotlinx.coroutines.flow.Flow; +import kotlin.collections.List +import kotlin.collections.Map + +@RestController +@Validated +@Api(value = "User", description = "The User API") +@RequestMapping("\${api.base-path:/v2}") +class UserApiController(@Autowired(required = true) val service: UserApiService) { + + @ApiOperation( + value = "Create user", + nickname = "createUser", + notes = "This can only be done by the logged in user.") + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation")]) + @RequestMapping( + value = ["/user"], + method = [RequestMethod.POST]) + suspend fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody body: User +): ResponseEntity { + return ResponseEntity(service.createUser(body), HttpStatus.OK) + } + + @ApiOperation( + value = "Creates list of users with given input array", + nickname = "createUsersWithArrayInput", + notes = "") + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation")]) + @RequestMapping( + value = ["/user/createWithArray"], + method = [RequestMethod.POST]) + suspend fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: Flow +): ResponseEntity { + return ResponseEntity(service.createUsersWithArrayInput(body), HttpStatus.OK) + } + + @ApiOperation( + value = "Creates list of users with given input array", + nickname = "createUsersWithListInput", + notes = "") + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation")]) + @RequestMapping( + value = ["/user/createWithList"], + method = [RequestMethod.POST]) + suspend fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: Flow +): ResponseEntity { + return ResponseEntity(service.createUsersWithListInput(body), HttpStatus.OK) + } + + @ApiOperation( + value = "Delete user", + nickname = "deleteUser", + notes = "This can only be done by the logged in user.") + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) + @RequestMapping( + value = ["/user/{username}"], + method = [RequestMethod.DELETE]) + suspend fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: String +): ResponseEntity { + return ResponseEntity(service.deleteUser(username), HttpStatus.OK) + } + + @ApiOperation( + value = "Get user by user name", + nickname = "getUserByName", + notes = "", + response = User::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = User::class),ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) + @RequestMapping( + value = ["/user/{username}"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + suspend fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: String +): ResponseEntity { + return ResponseEntity(service.getUserByName(username), HttpStatus.OK) + } + + @ApiOperation( + value = "Logs user into the system", + nickname = "loginUser", + notes = "", + response = String::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")]) + @RequestMapping( + value = ["/user/login"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + suspend fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: String +,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: String +): ResponseEntity { + return ResponseEntity(service.loginUser(username, password), HttpStatus.OK) + } + + @ApiOperation( + value = "Logs out current logged in user session", + nickname = "logoutUser", + notes = "") + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation")]) + @RequestMapping( + value = ["/user/logout"], + method = [RequestMethod.GET]) + suspend fun logoutUser(): ResponseEntity { + return ResponseEntity(service.logoutUser(), HttpStatus.OK) + } + + @ApiOperation( + value = "Updated user", + nickname = "updateUser", + notes = "This can only be done by the logged in user.") + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid user supplied"),ApiResponse(code = 404, message = "User not found")]) + @RequestMapping( + value = ["/user/{username}"], + method = [RequestMethod.PUT]) + suspend fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: String +,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody body: User +): ResponseEntity { + return ResponseEntity(service.updateUser(username, body), HttpStatus.OK) + } +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt new file mode 100644 index 000000000000..81e085b449ef --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt @@ -0,0 +1,22 @@ +package org.openapitools.api + +import org.openapitools.model.User +import kotlinx.coroutines.flow.Flow; +interface UserApiService { + + suspend fun createUser(body: User): Unit + + suspend fun createUsersWithArrayInput(body: List): Unit + + suspend fun createUsersWithListInput(body: List): Unit + + suspend fun deleteUser(username: String): Unit + + suspend fun getUserByName(username: String): User + + suspend fun loginUser(username: String, password: String): String + + suspend fun logoutUser(): Unit + + suspend fun updateUser(username: String, body: User): Unit +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt new file mode 100644 index 000000000000..684088bfa02d --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt @@ -0,0 +1,40 @@ +package org.openapitools.api + +import org.openapitools.model.User +import kotlinx.coroutines.flow.Flow; +import org.springframework.stereotype.Service +@Service +class UserApiServiceImpl : UserApiService { + + override suspend fun createUser(body: User): Unit { + TODO("Implement me") + } + + override suspend fun createUsersWithArrayInput(body: List): Unit { + TODO("Implement me") + } + + override suspend fun createUsersWithListInput(body: List): Unit { + TODO("Implement me") + } + + override suspend fun deleteUser(username: String): Unit { + TODO("Implement me") + } + + override suspend fun getUserByName(username: String): User { + TODO("Implement me") + } + + override suspend fun loginUser(username: String, password: String): String { + TODO("Implement me") + } + + override suspend fun logoutUser(): Unit { + TODO("Implement me") + } + + override suspend fun updateUser(username: String, body: User): Unit { + TODO("Implement me") + } +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt new file mode 100644 index 000000000000..1a1dbf7223c4 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt @@ -0,0 +1,29 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * A category for a pet + * @param id + * @param name + */ +data class Category ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("name") val name: String? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt new file mode 100644 index 000000000000..2f844a9c3565 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -0,0 +1,33 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * Describes the result of uploading an image resource + * @param code + * @param type + * @param message + */ +data class ModelApiResponse ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("code") val code: Int? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("type") val type: String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("message") val message: String? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt new file mode 100644 index 000000000000..e20d850491fa --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt @@ -0,0 +1,60 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonValue +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * An order for a pets from the pet store + * @param id + * @param petId + * @param quantity + * @param shipDate + * @param status Order Status + * @param complete + */ +data class Order ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("petId") val petId: Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("quantity") val quantity: Int? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + + @ApiModelProperty(example = "null", value = "Order Status") + @JsonProperty("status") val status: Order.Status? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("complete") val complete: Boolean? = null +) { + + /** + * Order Status + * Values: placed,approved,delivered + */ + enum class Status(val value: String) { + + @JsonProperty("placed") placed("placed"), + + @JsonProperty("approved") approved("approved"), + + @JsonProperty("delivered") delivered("delivered"); + + } + +} + diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt new file mode 100644 index 000000000000..9e054ac22f73 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt @@ -0,0 +1,64 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonValue +import org.openapitools.model.Category +import org.openapitools.model.Tag +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * A pet for sale in the pet store + * @param id + * @param category + * @param name + * @param photoUrls + * @param tags + * @param status pet status in the store + */ +data class Pet ( + + @get:NotNull + @ApiModelProperty(example = "doggie", required = true, value = "") + @JsonProperty("name") val name: String, + + @get:NotNull + @ApiModelProperty(example = "null", required = true, value = "") + @JsonProperty("photoUrls") val photoUrls: List, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("category") val category: Category? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("tags") val tags: List? = null, + + @ApiModelProperty(example = "null", value = "pet status in the store") + @JsonProperty("status") val status: Pet.Status? = null +) { + + /** + * pet status in the store + * Values: available,pending,sold + */ + enum class Status(val value: String) { + + @JsonProperty("available") available("available"), + + @JsonProperty("pending") pending("pending"), + + @JsonProperty("sold") sold("sold"); + + } + +} + diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt new file mode 100644 index 000000000000..40ef1b9a86b7 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt @@ -0,0 +1,29 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * A tag for a pet + * @param id + * @param name + */ +data class Tag ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("name") val name: String? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt new file mode 100644 index 000000000000..95fe12aa467b --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt @@ -0,0 +1,53 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * A User who is purchasing from the pet store + * @param id + * @param username + * @param firstName + * @param lastName + * @param email + * @param password + * @param phone + * @param userStatus User Status + */ +data class User ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("username") val username: String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("firstName") val firstName: String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("lastName") val lastName: String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("email") val email: String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("password") val password: String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("phone") val phone: String? = null, + + @ApiModelProperty(example = "null", value = "User Status") + @JsonProperty("userStatus") val userStatus: Int? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/resources/application.yaml b/samples/server/petstore/kotlin-springboot-reactive/src/main/resources/application.yaml new file mode 100644 index 000000000000..8e2ebcde976d --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/resources/application.yaml @@ -0,0 +1,10 @@ +spring: + application: + name: openAPIPetstore + + jackson: + serialization: + WRITE_DATES_AS_TIMESTAMPS: false + +server: + port: 8080 From 3987358945979834f66315e63b27dc954096f770 Mon Sep 17 00:00:00 2001 From: Sylvain Moindron Date: Sun, 19 May 2019 10:53:15 +0200 Subject: [PATCH 04/16] bug : fix spring version and import for coroutines --- .../libraries/spring-boot/buildGradleKts.mustache | 11 ++++++++++- .../libraries/spring-boot/pom.mustache | 14 ++++++++++++++ .../libraries/spring-boot/settingsGradle.mustache | 14 ++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache index 2e8bd00c224f..2c7cae0f4892 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE") + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3") } } @@ -32,6 +32,7 @@ plugins { } dependencies { + val kotlinxCoroutinesVersion="1.2.0" compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compile("org.jetbrains.kotlin:kotlin-reflect") {{^reactive}} @@ -39,6 +40,8 @@ dependencies { {{/reactive}} {{#reactive}} compile("org.springframework.boot:spring-boot-starter-webflux") + compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion") + compile("org.jetbrains.kotlinx:skotlinx-coroutines-reactor$kotlinxCoroutinesVersion") {{/reactive}} {{#swaggerAnnotations}} compile("io.swagger:swagger-annotations:1.5.21") @@ -51,3 +54,9 @@ dependencies { exclude(module = "junit") } } + +repositories { + mavenCentral() + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } +} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache index 55987522d990..c6824e559cc5 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache @@ -7,6 +7,7 @@ {{artifactVersion}} 1.3.30 + 1.2.0 org.springframework.boot @@ -84,6 +85,19 @@ spring-boot-starter-webflux {{/reactive}} +{{#reactive}} + + org.jetbrains.kotlinx + kotlinx-coroutines-core + ${kotlinx-coroutines.version} + + + org.jetbrains.kotlinx + kotlinx-coroutines-reactor + ${kotlinx-coroutines.version} + +{{/reactive}} + {{#swaggerAnnotations}} io.swagger diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/settingsGradle.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/settingsGradle.mustache index b8fd6c4c41f9..290868e27933 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/settingsGradle.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/settingsGradle.mustache @@ -1 +1,15 @@ +pluginManagement { + repositories { + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } + gradlePluginPortal() + } + resolutionStrategy { + eachPlugin { + if (requested.id.id == "org.springframework.boot") { + useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}") + } + } + } +} rootProject.name = "{{artifactId}}" \ No newline at end of file From a2b20110c2fe0df4cec047217258ae6ca3678a6b Mon Sep 17 00:00:00 2001 From: Sylvain Moindron Date: Sun, 19 May 2019 10:54:19 +0200 Subject: [PATCH 05/16] remove exception handler for reactive (webflux doesn't support it) --- docs/generators/kotlin-spring.md | 2 +- .../codegen/languages/KotlinSpringServerCodegen.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/generators/kotlin-spring.md b/docs/generators/kotlin-spring.md index 29a98d53d3c6..bd646d625387 100644 --- a/docs/generators/kotlin-spring.md +++ b/docs/generators/kotlin-spring.md @@ -20,7 +20,7 @@ sidebar_label: kotlin-spring |serverPort|configuration the port in which the sever is to run on| |8080| |modelPackage|model package for generated code| |org.openapitools.model| |apiPackage|api package for generated code| |org.openapitools.api| -|exceptionHandler|generate default global exception handlers| |true| +|exceptionHandler|generate default global exception handlers (not compatible with reactive. enabling reactive will disable exceptionHandler )| |true| |gradleBuildFile|generate a gradle build file using the Kotlin DSL| |true| |swaggerAnnotations|generate swagger annotations to go alongside controllers and models| |false| |serviceInterface|generate service interfaces to go alongside controllers. In most cases this option would be used to update an existing project, so not to override implementations. Useful to help facilitate the generation gap pattern| |false| 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 c57b38ceeca1..0c8b20528c8e 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 @@ -344,8 +344,11 @@ public void processOpts() { if (additionalProperties.containsKey(REACTIVE) && library.equals(SPRING_BOOT)) { this.setReactive(convertPropertyToBoolean(REACTIVE)); + // spring webflux doesn't support @ControllerAdvice + this.setExceptionHandler(false); } writePropertyBack(REACTIVE, reactive); + writePropertyBack(EXCEPTION_HANDLER, exceptionHandler); modelTemplateFiles.put("model.mustache", ".kt"); apiTemplateFiles.put("api.mustache", ".kt"); From bf768beaebe0cc6836a18da9bbe2251ee19f5f33 Mon Sep 17 00:00:00 2001 From: Sylvain Moindron Date: Sun, 19 May 2019 10:54:32 +0200 Subject: [PATCH 06/16] regenerate samples --- .../build.gradle.kts | 13 +++++++-- .../kotlin-springboot-reactive/pom.xml | 14 ++++++++- .../settings.gradle | 14 +++++++++ .../kotlin/org/openapitools/api/Exceptions.kt | 29 ------------------- .../kotlin-springboot/build.gradle.kts | 11 +++++-- .../petstore/kotlin-springboot/pom.xml | 4 ++- .../kotlin-springboot/settings.gradle | 14 +++++++++ .../build.gradle.kts | 13 +++++++-- .../kotlin-springboot-reactive/pom.xml | 14 ++++++++- .../settings.gradle | 14 +++++++++ .../kotlin/org/openapitools/api/Exceptions.kt | 29 ------------------- .../kotlin-springboot/build.gradle.kts | 11 +++++-- .../server/petstore/kotlin-springboot/pom.xml | 4 ++- .../kotlin-springboot/settings.gradle | 14 +++++++++ 14 files changed, 128 insertions(+), 70 deletions(-) delete mode 100644 samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/Exceptions.kt delete mode 100644 samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/Exceptions.kt diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts b/samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts index 1024b4b12bd9..3e7aa66972e9 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE") + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3") } } @@ -23,7 +23,7 @@ tasks.withType { } plugins { - val kotlinVersion = "1.2.60" + val kotlinVersion = "1.3.30" id("org.jetbrains.kotlin.jvm") version kotlinVersion id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion @@ -32,9 +32,12 @@ plugins { } dependencies { + val kotlinxCoroutinesVersion="1.2.0" compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compile("org.jetbrains.kotlin:kotlin-reflect") compile("org.springframework.boot:spring-boot-starter-webflux") + compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion") + compile("org.jetbrains.kotlinx:skotlinx-coroutines-reactor$kotlinxCoroutinesVersion") compile("io.swagger:swagger-annotations:1.5.21") compile("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml") compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml") @@ -44,3 +47,9 @@ dependencies { exclude(module = "junit") } } + +repositories { + mavenCentral() + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/pom.xml b/samples/server/openapi3/petstore/kotlin-springboot-reactive/pom.xml index b3b4d628007b..ebe5fd1e7da2 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot-reactive/pom.xml +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/pom.xml @@ -6,7 +6,8 @@ openapi-spring 1.0.0 - 1.2.60 + 1.3.30 + 1.2.0 org.springframework.boot @@ -79,6 +80,17 @@ org.springframework.boot spring-boot-starter-webflux + + org.jetbrains.kotlinx + kotlinx-coroutines-core + ${kotlinx-coroutines.version} + + + org.jetbrains.kotlinx + kotlinx-coroutines-reactor + ${kotlinx-coroutines.version} + + io.swagger swagger-annotations diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/settings.gradle b/samples/server/openapi3/petstore/kotlin-springboot-reactive/settings.gradle index f0dd035311e0..e9bd5d32d7c2 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot-reactive/settings.gradle +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/settings.gradle @@ -1 +1,15 @@ +pluginManagement { + repositories { + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } + gradlePluginPortal() + } + resolutionStrategy { + eachPlugin { + if (requested.id.id == "org.springframework.boot") { + useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}") + } + } + } +} rootProject.name = "openapi-spring" \ No newline at end of file diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/Exceptions.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/Exceptions.kt deleted file mode 100644 index 4d8400902aa9..000000000000 --- a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/Exceptions.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.api - -import org.springframework.http.HttpStatus -import org.springframework.web.bind.annotation.ControllerAdvice -import org.springframework.web.bind.annotation.ExceptionHandler -import javax.servlet.http.HttpServletResponse -import javax.validation.ConstraintViolationException - -// TODO Extend ApiException for custom exception handling, e.g. the below NotFound exception -sealed class ApiException(msg: String, val code: Int) : Exception(msg) - -class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code) - - -@ControllerAdvice -class DefaultExceptionHandler { - - @ExceptionHandler(value = [ApiException::class]) - fun onApiException(ex: ApiException, response: HttpServletResponse): Unit = - response.sendError(ex.code, ex.message) - - @ExceptionHandler(value = [NotImplementedError::class]) - fun onNotImplemented(ex: NotImplementedError, response: HttpServletResponse): Unit = - response.sendError(HttpStatus.NOT_IMPLEMENTED.value()) - - @ExceptionHandler(value = [ConstraintViolationException::class]) - fun onConstraintViolation(ex: ConstraintViolationException, response: HttpServletResponse): Unit = - response.sendError(HttpStatus.BAD_REQUEST.value(), ex.constraintViolations.joinToString(", ") { it.message }) -} diff --git a/samples/server/openapi3/petstore/kotlin-springboot/build.gradle.kts b/samples/server/openapi3/petstore/kotlin-springboot/build.gradle.kts index 028d241de8d5..0192dfa91623 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/build.gradle.kts +++ b/samples/server/openapi3/petstore/kotlin-springboot/build.gradle.kts @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE") + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3") } } @@ -23,7 +23,7 @@ tasks.withType { } plugins { - val kotlinVersion = "1.2.60" + val kotlinVersion = "1.3.30" id("org.jetbrains.kotlin.jvm") version kotlinVersion id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion @@ -32,6 +32,7 @@ plugins { } dependencies { + val kotlinxCoroutinesVersion="1.2.0" compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compile("org.jetbrains.kotlin:kotlin-reflect") compile("org.springframework.boot:spring-boot-starter-web") @@ -44,3 +45,9 @@ dependencies { exclude(module = "junit") } } + +repositories { + mavenCentral() + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot/pom.xml b/samples/server/openapi3/petstore/kotlin-springboot/pom.xml index f2a955aa900d..4b35da2290c6 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/pom.xml +++ b/samples/server/openapi3/petstore/kotlin-springboot/pom.xml @@ -6,7 +6,8 @@ openapi-spring 1.0.0 - 1.2.60 + 1.3.30 + 1.2.0 org.springframework.boot @@ -79,6 +80,7 @@ org.springframework.boot spring-boot-starter-web + io.swagger swagger-annotations diff --git a/samples/server/openapi3/petstore/kotlin-springboot/settings.gradle b/samples/server/openapi3/petstore/kotlin-springboot/settings.gradle index f0dd035311e0..e9bd5d32d7c2 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/settings.gradle +++ b/samples/server/openapi3/petstore/kotlin-springboot/settings.gradle @@ -1 +1,15 @@ +pluginManagement { + repositories { + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } + gradlePluginPortal() + } + resolutionStrategy { + eachPlugin { + if (requested.id.id == "org.springframework.boot") { + useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}") + } + } + } +} rootProject.name = "openapi-spring" \ No newline at end of file diff --git a/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts b/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts index 1024b4b12bd9..3e7aa66972e9 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts +++ b/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE") + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3") } } @@ -23,7 +23,7 @@ tasks.withType { } plugins { - val kotlinVersion = "1.2.60" + val kotlinVersion = "1.3.30" id("org.jetbrains.kotlin.jvm") version kotlinVersion id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion @@ -32,9 +32,12 @@ plugins { } dependencies { + val kotlinxCoroutinesVersion="1.2.0" compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compile("org.jetbrains.kotlin:kotlin-reflect") compile("org.springframework.boot:spring-boot-starter-webflux") + compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion") + compile("org.jetbrains.kotlinx:skotlinx-coroutines-reactor$kotlinxCoroutinesVersion") compile("io.swagger:swagger-annotations:1.5.21") compile("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml") compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml") @@ -44,3 +47,9 @@ dependencies { exclude(module = "junit") } } + +repositories { + mavenCentral() + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/pom.xml b/samples/server/petstore/kotlin-springboot-reactive/pom.xml index b3b4d628007b..ebe5fd1e7da2 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/pom.xml +++ b/samples/server/petstore/kotlin-springboot-reactive/pom.xml @@ -6,7 +6,8 @@ openapi-spring 1.0.0 - 1.2.60 + 1.3.30 + 1.2.0 org.springframework.boot @@ -79,6 +80,17 @@ org.springframework.boot spring-boot-starter-webflux + + org.jetbrains.kotlinx + kotlinx-coroutines-core + ${kotlinx-coroutines.version} + + + org.jetbrains.kotlinx + kotlinx-coroutines-reactor + ${kotlinx-coroutines.version} + + io.swagger swagger-annotations diff --git a/samples/server/petstore/kotlin-springboot-reactive/settings.gradle b/samples/server/petstore/kotlin-springboot-reactive/settings.gradle index f0dd035311e0..e9bd5d32d7c2 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/settings.gradle +++ b/samples/server/petstore/kotlin-springboot-reactive/settings.gradle @@ -1 +1,15 @@ +pluginManagement { + repositories { + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } + gradlePluginPortal() + } + resolutionStrategy { + eachPlugin { + if (requested.id.id == "org.springframework.boot") { + useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}") + } + } + } +} rootProject.name = "openapi-spring" \ No newline at end of file diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/Exceptions.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/Exceptions.kt deleted file mode 100644 index 4d8400902aa9..000000000000 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/Exceptions.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.api - -import org.springframework.http.HttpStatus -import org.springframework.web.bind.annotation.ControllerAdvice -import org.springframework.web.bind.annotation.ExceptionHandler -import javax.servlet.http.HttpServletResponse -import javax.validation.ConstraintViolationException - -// TODO Extend ApiException for custom exception handling, e.g. the below NotFound exception -sealed class ApiException(msg: String, val code: Int) : Exception(msg) - -class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code) - - -@ControllerAdvice -class DefaultExceptionHandler { - - @ExceptionHandler(value = [ApiException::class]) - fun onApiException(ex: ApiException, response: HttpServletResponse): Unit = - response.sendError(ex.code, ex.message) - - @ExceptionHandler(value = [NotImplementedError::class]) - fun onNotImplemented(ex: NotImplementedError, response: HttpServletResponse): Unit = - response.sendError(HttpStatus.NOT_IMPLEMENTED.value()) - - @ExceptionHandler(value = [ConstraintViolationException::class]) - fun onConstraintViolation(ex: ConstraintViolationException, response: HttpServletResponse): Unit = - response.sendError(HttpStatus.BAD_REQUEST.value(), ex.constraintViolations.joinToString(", ") { it.message }) -} diff --git a/samples/server/petstore/kotlin-springboot/build.gradle.kts b/samples/server/petstore/kotlin-springboot/build.gradle.kts index 028d241de8d5..0192dfa91623 100644 --- a/samples/server/petstore/kotlin-springboot/build.gradle.kts +++ b/samples/server/petstore/kotlin-springboot/build.gradle.kts @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE") + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3") } } @@ -23,7 +23,7 @@ tasks.withType { } plugins { - val kotlinVersion = "1.2.60" + val kotlinVersion = "1.3.30" id("org.jetbrains.kotlin.jvm") version kotlinVersion id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion @@ -32,6 +32,7 @@ plugins { } dependencies { + val kotlinxCoroutinesVersion="1.2.0" compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compile("org.jetbrains.kotlin:kotlin-reflect") compile("org.springframework.boot:spring-boot-starter-web") @@ -44,3 +45,9 @@ dependencies { exclude(module = "junit") } } + +repositories { + mavenCentral() + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } +} diff --git a/samples/server/petstore/kotlin-springboot/pom.xml b/samples/server/petstore/kotlin-springboot/pom.xml index f2a955aa900d..4b35da2290c6 100644 --- a/samples/server/petstore/kotlin-springboot/pom.xml +++ b/samples/server/petstore/kotlin-springboot/pom.xml @@ -6,7 +6,8 @@ openapi-spring 1.0.0 - 1.2.60 + 1.3.30 + 1.2.0 org.springframework.boot @@ -79,6 +80,7 @@ org.springframework.boot spring-boot-starter-web + io.swagger swagger-annotations diff --git a/samples/server/petstore/kotlin-springboot/settings.gradle b/samples/server/petstore/kotlin-springboot/settings.gradle index f0dd035311e0..e9bd5d32d7c2 100644 --- a/samples/server/petstore/kotlin-springboot/settings.gradle +++ b/samples/server/petstore/kotlin-springboot/settings.gradle @@ -1 +1,15 @@ +pluginManagement { + repositories { + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } + gradlePluginPortal() + } + resolutionStrategy { + eachPlugin { + if (requested.id.id == "org.springframework.boot") { + useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}") + } + } + } +} rootProject.name = "openapi-spring" \ No newline at end of file From 3ced764e5917b7e1d17ab10b8d1d18282dfa7139 Mon Sep 17 00:00:00 2001 From: Sylvain Moindron Date: Sun, 19 May 2019 17:44:10 +0200 Subject: [PATCH 07/16] fix typo in gradle dependency --- .../kotlin-spring/libraries/spring-boot/buildGradleKts.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache index 2c7cae0f4892..8ea683794dd2 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache @@ -41,7 +41,7 @@ dependencies { {{#reactive}} compile("org.springframework.boot:spring-boot-starter-webflux") compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion") - compile("org.jetbrains.kotlinx:skotlinx-coroutines-reactor$kotlinxCoroutinesVersion") + compile("org.jetbrains.kotlinx:skotlinx-coroutines-reactor:$kotlinxCoroutinesVersion") {{/reactive}} {{#swaggerAnnotations}} compile("io.swagger:swagger-annotations:1.5.21") From 9ea7970fe35039f8c244ad5e26c3e3bd3ee83f32 Mon Sep 17 00:00:00 2001 From: Sylvain Moindron Date: Sun, 19 May 2019 17:56:52 +0200 Subject: [PATCH 08/16] add spring milestone repository to maven pom --- .../libraries/spring-boot/pom.mustache | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache index c6824e559cc5..d5efef76e57c 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache @@ -129,4 +129,34 @@ {{/useBeanValidation}} + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + From 8f648135d7fee4af1284f6722d02a0f10c5a650b Mon Sep 17 00:00:00 2001 From: Sylvain Moindron Date: Sun, 19 May 2019 17:58:52 +0200 Subject: [PATCH 09/16] regenerate samples --- .../build.gradle.kts | 2 +- .../kotlin-springboot-reactive/pom.xml | 30 +++++++++++++++++++ .../petstore/kotlin-springboot/pom.xml | 30 +++++++++++++++++++ .../build.gradle.kts | 2 +- .../kotlin-springboot-reactive/pom.xml | 30 +++++++++++++++++++ .../server/petstore/kotlin-springboot/pom.xml | 30 +++++++++++++++++++ 6 files changed, 122 insertions(+), 2 deletions(-) diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts b/samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts index 3e7aa66972e9..394413e58ec0 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts @@ -37,7 +37,7 @@ dependencies { compile("org.jetbrains.kotlin:kotlin-reflect") compile("org.springframework.boot:spring-boot-starter-webflux") compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion") - compile("org.jetbrains.kotlinx:skotlinx-coroutines-reactor$kotlinxCoroutinesVersion") + compile("org.jetbrains.kotlinx:skotlinx-coroutines-reactor:$kotlinxCoroutinesVersion") compile("io.swagger:swagger-annotations:1.5.21") compile("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml") compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml") diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/pom.xml b/samples/server/openapi3/petstore/kotlin-springboot-reactive/pom.xml index ebe5fd1e7da2..1932017d4bfb 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot-reactive/pom.xml +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/pom.xml @@ -118,4 +118,34 @@ validation-api + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + diff --git a/samples/server/openapi3/petstore/kotlin-springboot/pom.xml b/samples/server/openapi3/petstore/kotlin-springboot/pom.xml index 4b35da2290c6..45c650bae0fe 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/pom.xml +++ b/samples/server/openapi3/petstore/kotlin-springboot/pom.xml @@ -108,4 +108,34 @@ validation-api + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + diff --git a/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts b/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts index 3e7aa66972e9..394413e58ec0 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts +++ b/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts @@ -37,7 +37,7 @@ dependencies { compile("org.jetbrains.kotlin:kotlin-reflect") compile("org.springframework.boot:spring-boot-starter-webflux") compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion") - compile("org.jetbrains.kotlinx:skotlinx-coroutines-reactor$kotlinxCoroutinesVersion") + compile("org.jetbrains.kotlinx:skotlinx-coroutines-reactor:$kotlinxCoroutinesVersion") compile("io.swagger:swagger-annotations:1.5.21") compile("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml") compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml") diff --git a/samples/server/petstore/kotlin-springboot-reactive/pom.xml b/samples/server/petstore/kotlin-springboot-reactive/pom.xml index ebe5fd1e7da2..1932017d4bfb 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/pom.xml +++ b/samples/server/petstore/kotlin-springboot-reactive/pom.xml @@ -118,4 +118,34 @@ validation-api + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + diff --git a/samples/server/petstore/kotlin-springboot/pom.xml b/samples/server/petstore/kotlin-springboot/pom.xml index 4b35da2290c6..45c650bae0fe 100644 --- a/samples/server/petstore/kotlin-springboot/pom.xml +++ b/samples/server/petstore/kotlin-springboot/pom.xml @@ -108,4 +108,34 @@ validation-api + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + From fae1524958f9abb06d715eb35043a13b0ae5d265 Mon Sep 17 00:00:00 2001 From: Sylvain Moindron Date: Sun, 19 May 2019 18:00:09 +0200 Subject: [PATCH 10/16] fix type in gradle import --- .../kotlin-spring/libraries/spring-boot/buildGradleKts.mustache | 2 +- .../petstore/kotlin-springboot-reactive/build.gradle.kts | 2 +- .../server/petstore/kotlin-springboot-reactive/build.gradle.kts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache index 8ea683794dd2..0bfe4dbc93e3 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache @@ -41,7 +41,7 @@ dependencies { {{#reactive}} compile("org.springframework.boot:spring-boot-starter-webflux") compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion") - compile("org.jetbrains.kotlinx:skotlinx-coroutines-reactor:$kotlinxCoroutinesVersion") + compile("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$kotlinxCoroutinesVersion") {{/reactive}} {{#swaggerAnnotations}} compile("io.swagger:swagger-annotations:1.5.21") diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts b/samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts index 394413e58ec0..f62d3f33c8d1 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts @@ -37,7 +37,7 @@ dependencies { compile("org.jetbrains.kotlin:kotlin-reflect") compile("org.springframework.boot:spring-boot-starter-webflux") compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion") - compile("org.jetbrains.kotlinx:skotlinx-coroutines-reactor:$kotlinxCoroutinesVersion") + compile("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$kotlinxCoroutinesVersion") compile("io.swagger:swagger-annotations:1.5.21") compile("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml") compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml") diff --git a/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts b/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts index 394413e58ec0..f62d3f33c8d1 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts +++ b/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts @@ -37,7 +37,7 @@ dependencies { compile("org.jetbrains.kotlin:kotlin-reflect") compile("org.springframework.boot:spring-boot-starter-webflux") compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion") - compile("org.jetbrains.kotlinx:skotlinx-coroutines-reactor:$kotlinxCoroutinesVersion") + compile("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$kotlinxCoroutinesVersion") compile("io.swagger:swagger-annotations:1.5.21") compile("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml") compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml") From 9849fdccc1433325f9827e4c60dd31569c2f112b Mon Sep 17 00:00:00 2001 From: Sylvain Moindron Date: Mon, 20 May 2019 19:43:54 +0200 Subject: [PATCH 11/16] add reactive type for list in Api and ApiImpl methodes for mathching body responsive parameter --- .../src/main/resources/kotlin-spring/service.mustache | 2 +- .../src/main/resources/kotlin-spring/serviceImpl.mustache | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/service.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/service.mustache index 62056e62a712..e9abca8eba29 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/service.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/service.mustache @@ -9,7 +9,7 @@ import kotlinx.coroutines.flow.Flow; interface {{classname}}Service { {{#operation}} - {{#reactive}}{{^isListContainer}}suspend {{/isListContainer}}{{/reactive}}fun {{operationId}}({{#allParams}}{{paramName}}: {{>optionalDataType}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): {{>returnTypes}} + {{#reactive}}{{^isListContainer}}suspend {{/isListContainer}}{{/reactive}}fun {{operationId}}({{#allParams}}{{paramName}}: {{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isListContainer}}{{>optionalDataType}}{{/isListContainer}}{{#isListContainer}}Flow<{{{baseType}}}>{{/isListContainer}}{{/reactive}}{{/isBodyParam}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): {{>returnTypes}} {{/operation}} } {{/operations}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/serviceImpl.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/serviceImpl.mustache index 1aeddbdba034..b110e81378f5 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/serviceImpl.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/serviceImpl.mustache @@ -11,7 +11,7 @@ import org.springframework.stereotype.Service class {{classname}}ServiceImpl : {{classname}}Service { {{#operation}} - override {{#reactive}}{{^isListContainer}}suspend {{/isListContainer}}{{/reactive}}fun {{operationId}}({{#allParams}}{{paramName}}: {{>optionalDataType}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): {{>returnTypes}} { + override {{#reactive}}{{^isListContainer}}suspend {{/isListContainer}}{{/reactive}}fun {{operationId}}({{#allParams}}{{paramName}}: {{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isListContainer}}{{>optionalDataType}}{{/isListContainer}}{{#isListContainer}}Flow<{{{baseType}}}>{{/isListContainer}}{{/reactive}}{{/isBodyParam}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): {{>returnTypes}} { TODO("Implement me") } {{/operation}} From e4f2ff39e9386ccecfc9bd3d7d29196cb94f6b7a Mon Sep 17 00:00:00 2001 From: Sylvain Moindron Date: Mon, 20 May 2019 20:29:05 +0200 Subject: [PATCH 12/16] fix baseType for ArraySchema --- .../src/main/java/org/openapitools/codegen/DefaultCodegen.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index e24ac5194912..761a9b47af5e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -4698,7 +4698,7 @@ public CodegenParameter fromRequestBody(RequestBody body, Set imports, S codegenParameter.items = codegenProperty.items; codegenParameter.mostInnerItems = codegenProperty.mostInnerItems; codegenParameter.dataType = getTypeDeclaration(arraySchema); - codegenParameter.baseType = getSchemaType(arraySchema); + codegenParameter.baseType = getSchemaType(inner); codegenParameter.isContainer = Boolean.TRUE; codegenParameter.isListContainer = Boolean.TRUE; From 6977ad9bb3b9ee6ff577d0c1d988c690ba8e872f Mon Sep 17 00:00:00 2001 From: Sylvain Moindron Date: Mon, 20 May 2019 20:31:12 +0200 Subject: [PATCH 13/16] regenerate samples --- .../src/main/kotlin/org/openapitools/api/UserApi.kt | 4 ++-- .../src/main/kotlin/org/openapitools/api/UserApiService.kt | 4 ++-- .../main/kotlin/org/openapitools/api/UserApiServiceImpl.kt | 4 ++-- .../src/main/kotlin/org/openapitools/api/UserApi.kt | 4 ++-- .../src/main/kotlin/org/openapitools/api/UserApiService.kt | 4 ++-- .../main/kotlin/org/openapitools/api/UserApiServiceImpl.kt | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt index e52f8176f82b..1aed45eebdda 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -70,7 +70,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/createWithArray"], consumes = ["application/json"], method = [RequestMethod.POST]) - suspend fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: Flow + suspend fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: Flow ): ResponseEntity { return ResponseEntity(service.createUsersWithArrayInput(user), HttpStatus.OK) } @@ -86,7 +86,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/createWithList"], consumes = ["application/json"], method = [RequestMethod.POST]) - suspend fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: Flow + suspend fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: Flow ): ResponseEntity { return ResponseEntity(service.createUsersWithListInput(user), HttpStatus.OK) } diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt index 85e1c39aa730..999ae4f4074e 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt @@ -6,9 +6,9 @@ interface UserApiService { suspend fun createUser(user: User): Unit - suspend fun createUsersWithArrayInput(user: List): Unit + suspend fun createUsersWithArrayInput(user: Flow): Unit - suspend fun createUsersWithListInput(user: List): Unit + suspend fun createUsersWithListInput(user: Flow): Unit suspend fun deleteUser(username: String): Unit diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt index 1ba904684b88..8872d309e4db 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt @@ -10,11 +10,11 @@ class UserApiServiceImpl : UserApiService { TODO("Implement me") } - override suspend fun createUsersWithArrayInput(user: List): Unit { + override suspend fun createUsersWithArrayInput(user: Flow): Unit { TODO("Implement me") } - override suspend fun createUsersWithListInput(user: List): Unit { + override suspend fun createUsersWithListInput(user: Flow): Unit { TODO("Implement me") } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt index f311c28ff2dd..841b48df912e 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -66,7 +66,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @RequestMapping( value = ["/user/createWithArray"], method = [RequestMethod.POST]) - suspend fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: Flow + suspend fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: Flow ): ResponseEntity { return ResponseEntity(service.createUsersWithArrayInput(body), HttpStatus.OK) } @@ -80,7 +80,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @RequestMapping( value = ["/user/createWithList"], method = [RequestMethod.POST]) - suspend fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: Flow + suspend fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: Flow ): ResponseEntity { return ResponseEntity(service.createUsersWithListInput(body), HttpStatus.OK) } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt index 81e085b449ef..219580e9f06d 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt @@ -6,9 +6,9 @@ interface UserApiService { suspend fun createUser(body: User): Unit - suspend fun createUsersWithArrayInput(body: List): Unit + suspend fun createUsersWithArrayInput(body: Flow): Unit - suspend fun createUsersWithListInput(body: List): Unit + suspend fun createUsersWithListInput(body: Flow): Unit suspend fun deleteUser(username: String): Unit diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt index 684088bfa02d..d26e1a675eea 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt @@ -10,11 +10,11 @@ class UserApiServiceImpl : UserApiService { TODO("Implement me") } - override suspend fun createUsersWithArrayInput(body: List): Unit { + override suspend fun createUsersWithArrayInput(body: Flow): Unit { TODO("Implement me") } - override suspend fun createUsersWithListInput(body: List): Unit { + override suspend fun createUsersWithListInput(body: Flow): Unit { TODO("Implement me") } From cf8a19fc0b2c3f8a2fc4bbf50e219cebce65d3b2 Mon Sep 17 00:00:00 2001 From: Sylvain Moindron Date: Mon, 20 May 2019 23:02:55 +0200 Subject: [PATCH 14/16] correcting unit test --- .../codegen/java/JavaClientCodegenTest.java | 4 ++-- .../org/openapitools/codegen/java/JavaModelTest.java | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java index 68c556e5b090..1a3634effc4d 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java @@ -53,7 +53,7 @@ public void arraysInRequestBody() throws Exception { CodegenParameter codegenParameter1 = codegen.fromRequestBody(body1, new HashSet(), null); Assert.assertEquals(codegenParameter1.description, "A list of ids"); Assert.assertEquals(codegenParameter1.dataType, "List"); - Assert.assertEquals(codegenParameter1.baseType, "List"); + Assert.assertEquals(codegenParameter1.baseType, "String"); RequestBody body2 = new RequestBody(); body2.setDescription("A list of list of values"); @@ -73,7 +73,7 @@ public void arraysInRequestBody() throws Exception { CodegenParameter codegenParameter3 = codegen.fromRequestBody(body3, new HashSet(), null); Assert.assertEquals(codegenParameter3.description, "A list of points"); Assert.assertEquals(codegenParameter3.dataType, "List"); - Assert.assertEquals(codegenParameter3.baseType, "List"); + Assert.assertEquals(codegenParameter3.baseType, "Point"); } @Test diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java index 339fc73c11bb..1f16ac4a759f 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java @@ -1104,7 +1104,7 @@ public void arraySchemaTestInRequestBody() { .items(new Schema<>().$ref("#/components/schemas/Pet")); Operation operation = new Operation() .requestBody(new RequestBody() - .content(new Content().addMediaType("application/json", + .content(new Content().addMediaType("application/json", new MediaType().schema(testSchema)))) .responses( new ApiResponses().addApiResponse("204", new ApiResponse() @@ -1116,7 +1116,7 @@ public void arraySchemaTestInRequestBody() { Assert.assertEquals(co.bodyParams.size(), 1); CodegenParameter cp1 = co.bodyParams.get(0); - Assert.assertEquals(cp1.baseType, "List"); + Assert.assertEquals(cp1.baseType, "Pet"); Assert.assertEquals(cp1.dataType, "List"); Assert.assertTrue(cp1.isContainer); Assert.assertTrue(cp1.isListContainer); @@ -1138,7 +1138,7 @@ public void arraySchemaTestInOperationResponse() { Operation operation = new Operation().responses( new ApiResponses().addApiResponse("200", new ApiResponse() .description("Ok response") - .content(new Content().addMediaType("application/json", + .content(new Content().addMediaType("application/json", new MediaType().schema(testSchema))))); OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("Pet", new ObjectSchema().addProperties("name", new StringSchema())); final DefaultCodegen codegen = new JavaClientCodegen(); @@ -1184,7 +1184,7 @@ public void arrayOfArraySchemaTestInRequestBody() { .items(new Schema<>().$ref("#/components/schemas/Pet"))); Operation operation = new Operation() .requestBody(new RequestBody() - .content(new Content().addMediaType("application/json", + .content(new Content().addMediaType("application/json", new MediaType().schema(testSchema)))) .responses( new ApiResponses().addApiResponse("204", new ApiResponse() @@ -1222,7 +1222,7 @@ public void arrayOfArraySchemaTestInOperationResponse() { Operation operation = new Operation().responses( new ApiResponses().addApiResponse("200", new ApiResponse() .description("Ok response") - .content(new Content().addMediaType("application/json", + .content(new Content().addMediaType("application/json", new MediaType().schema(testSchema))))); OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("Pet", new ObjectSchema().addProperties("name", new StringSchema())); final DefaultCodegen codegen = new JavaClientCodegen(); From 8ebdcb5ad57ff467321379254dc72f8f1b49bdf7 Mon Sep 17 00:00:00 2001 From: Sylvain Moindron Date: Tue, 21 May 2019 08:32:48 +0200 Subject: [PATCH 15/16] updating documentation --- docs/generators/kotlin-spring.md | 2 +- .../codegen/languages/KotlinSpringServerCodegen.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/generators/kotlin-spring.md b/docs/generators/kotlin-spring.md index bd646d625387..0c4898f80156 100644 --- a/docs/generators/kotlin-spring.md +++ b/docs/generators/kotlin-spring.md @@ -26,5 +26,5 @@ sidebar_label: kotlin-spring |serviceInterface|generate service interfaces to go alongside controllers. In most cases this option would be used to update an existing project, so not to override implementations. Useful to help facilitate the generation gap pattern| |false| |serviceImplementation|generate stub service implementations that extends service interfaces. If this is set to true service interfaces will also be generated| |false| |useBeanValidation|Use BeanValidation API annotations to validate data types| |true| -|reactive| use coroutines for reactive behavior| |false| +|reactive|use coroutines for reactive behavior| |false| |library|library template (sub-template)|
**spring-boot**
Spring-boot Server application.
|spring-boot| 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 0c8b20528c8e..aa3d3fc64553 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 @@ -142,7 +142,7 @@ public KotlinSpringServerCodegen() { addOption(SERVER_PORT, "configuration the port in which the sever is to run on", serverPort); addOption(CodegenConstants.MODEL_PACKAGE, "model package for generated code", modelPackage); addOption(CodegenConstants.API_PACKAGE, "api package for generated code", apiPackage); - addSwitch(EXCEPTION_HANDLER, "generate default global exception handlers", exceptionHandler); + addSwitch(EXCEPTION_HANDLER, "generate default global exception handlers (not compatible with reactive. enabling reactive will disable exceptionHandler )", exceptionHandler); addSwitch(GRADLE_BUILD_FILE, "generate a gradle build file using the Kotlin DSL", gradleBuildFile); addSwitch(SWAGGER_ANNOTATIONS, "generate swagger annotations to go alongside controllers and models", swaggerAnnotations); addSwitch(SERVICE_INTERFACE, "generate service interfaces to go alongside controllers. In most " + @@ -151,7 +151,7 @@ public KotlinSpringServerCodegen() { addSwitch(SERVICE_IMPLEMENTATION, "generate stub service implementations that extends service " + "interfaces. If this is set to true service interfaces will also be generated", serviceImplementation); addSwitch(USE_BEANVALIDATION, "Use BeanValidation API annotations to validate data types", useBeanValidation); - addSwitch(REACTIVE, "use coroutines for reactive behavior (webflux only)", reactive); + addSwitch(REACTIVE, "use coroutines for reactive behavior", reactive); supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application."); setLibrary(SPRING_BOOT); From 1ac98812d1becda5a393dbaf241001e49d7a5d9d Mon Sep 17 00:00:00 2001 From: Sylvain Moindron Date: Wed, 22 May 2019 08:48:10 +0200 Subject: [PATCH 16/16] running bin/utils/ensure-up-to-date --- samples/client/petstore/R/docs/UserApi.md | 4 ++-- .../petstore/csharp-netcore/OpenAPIClient/docs/UserApi.md | 4 ++-- .../client/petstore/csharp/OpenAPIClient/docs/UserApi.md | 4 ++-- samples/client/petstore/go/go-petstore/docs/UserApi.md | 4 ++-- .../petstore/java/google-api-client/docs/UserApi.md | 4 ++-- samples/client/petstore/java/jersey1/docs/UserApi.md | 4 ++-- .../client/petstore/java/jersey2-java6/docs/UserApi.md | 4 ++-- .../client/petstore/java/jersey2-java8/docs/UserApi.md | 4 ++-- samples/client/petstore/java/jersey2/docs/UserApi.md | 4 ++-- .../java/okhttp-gson-parcelableModel/docs/UserApi.md | 4 ++-- samples/client/petstore/java/okhttp-gson/docs/UserApi.md | 4 ++-- samples/client/petstore/java/rest-assured/docs/UserApi.md | 4 ++-- samples/client/petstore/java/resteasy/docs/UserApi.md | 4 ++-- .../petstore/java/resttemplate-withXml/docs/UserApi.md | 4 ++-- samples/client/petstore/java/resttemplate/docs/UserApi.md | 4 ++-- .../client/petstore/java/retrofit2-play24/docs/UserApi.md | 4 ++-- .../client/petstore/java/retrofit2-play25/docs/UserApi.md | 4 ++-- .../client/petstore/java/retrofit2-play26/docs/UserApi.md | 4 ++-- samples/client/petstore/java/retrofit2/docs/UserApi.md | 4 ++-- samples/client/petstore/java/retrofit2rx/docs/UserApi.md | 4 ++-- samples/client/petstore/java/retrofit2rx2/docs/UserApi.md | 4 ++-- samples/client/petstore/java/vertx/docs/UserApi.md | 4 ++-- samples/client/petstore/java/webclient/docs/UserApi.md | 4 ++-- samples/client/petstore/javascript-es6/docs/UserApi.md | 4 ++-- samples/client/petstore/javascript-es6/src/api/UserApi.js | 4 ++-- .../petstore/javascript-promise-es6/docs/UserApi.md | 4 ++-- .../petstore/javascript-promise-es6/src/api/UserApi.js | 8 ++++---- .../client/petstore/javascript-promise/docs/UserApi.md | 4 ++-- .../client/petstore/javascript-promise/src/api/UserApi.js | 8 ++++---- samples/client/petstore/javascript/docs/UserApi.md | 4 ++-- samples/client/petstore/javascript/src/api/UserApi.js | 4 ++-- samples/client/petstore/kotlin-string/docs/UserApi.md | 4 ++-- samples/client/petstore/kotlin-threetenbp/docs/UserApi.md | 4 ++-- samples/client/petstore/kotlin/docs/UserApi.md | 4 ++-- .../petstore/php/OpenAPIClient-php/docs/Api/UserApi.md | 8 ++++---- samples/client/petstore/python-asyncio/docs/UserApi.md | 8 ++++---- samples/client/petstore/python-tornado/docs/UserApi.md | 8 ++++---- samples/client/petstore/python/docs/UserApi.md | 8 ++++---- samples/client/petstore/ruby/docs/UserApi.md | 8 ++++---- .../petstore/php/OpenAPIClient-php/docs/Api/UserApi.md | 8 ++++---- samples/openapi3/client/petstore/python/docs/UserApi.md | 8 ++++---- samples/openapi3/client/petstore/ruby/docs/UserApi.md | 8 ++++---- .../jaxrs-spec-interface/src/main/openapi/openapi.yaml | 2 -- .../petstore/jaxrs-spec/src/main/openapi/openapi.yaml | 2 -- .../Resources/docs/Api/UserApiInterface.md | 4 ++-- .../rust-server/output/openapi-v3/docs/default_api.md | 4 ++-- .../docs/user_api.md | 4 ++-- .../src/main/java/org/openapitools/api/UserApi.java | 4 ++-- .../main/java/org/openapitools/api/UserApiDelegate.java | 4 ++-- .../springboot-reactive/src/main/resources/openapi.yaml | 2 -- 50 files changed, 114 insertions(+), 120 deletions(-) diff --git a/samples/client/petstore/R/docs/UserApi.md b/samples/client/petstore/R/docs/UserApi.md index 342a3b3b40d5..6b0b6bbef47e 100644 --- a/samples/client/petstore/R/docs/UserApi.md +++ b/samples/client/petstore/R/docs/UserApi.md @@ -73,7 +73,7 @@ api.instance$CreateUsersWithArrayInput(var.body) Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](array.md)| List of user object | + **body** | [**User**](User.md)| List of user object | ### Return type @@ -110,7 +110,7 @@ api.instance$CreateUsersWithListInput(var.body) Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](array.md)| List of user object | + **body** | [**User**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/UserApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/UserApi.md index 9a535e16a82a..aedbf750cfcb 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/UserApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/UserApi.md @@ -115,7 +115,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -173,7 +173,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/UserApi.md b/samples/client/petstore/csharp/OpenAPIClient/docs/UserApi.md index b9f592bdd710..0fb118d829c6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/UserApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/UserApi.md @@ -124,7 +124,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -188,7 +188,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/go/go-petstore/docs/UserApi.md b/samples/client/petstore/go/go-petstore/docs/UserApi.md index ea19e0e716f1..3201e1771dc8 100644 --- a/samples/client/petstore/go/go-petstore/docs/UserApi.md +++ b/samples/client/petstore/go/go-petstore/docs/UserApi.md @@ -59,7 +59,7 @@ Creates list of users with given input array Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**body** | [**[]User**](array.md)| List of user object | +**body** | [**[]User**](User.md)| List of user object | ### Return type @@ -90,7 +90,7 @@ Creates list of users with given input array Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**body** | [**[]User**](array.md)| List of user object | +**body** | [**[]User**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/google-api-client/docs/UserApi.md b/samples/client/petstore/java/google-api-client/docs/UserApi.md index 9133d79c33c2..3baa2c50ea9f 100644 --- a/samples/client/petstore/java/google-api-client/docs/UserApi.md +++ b/samples/client/petstore/java/google-api-client/docs/UserApi.md @@ -91,7 +91,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/jersey1/docs/UserApi.md b/samples/client/petstore/java/jersey1/docs/UserApi.md index 9133d79c33c2..3baa2c50ea9f 100644 --- a/samples/client/petstore/java/jersey1/docs/UserApi.md +++ b/samples/client/petstore/java/jersey1/docs/UserApi.md @@ -91,7 +91,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/jersey2-java6/docs/UserApi.md b/samples/client/petstore/java/jersey2-java6/docs/UserApi.md index 9133d79c33c2..3baa2c50ea9f 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/UserApi.md +++ b/samples/client/petstore/java/jersey2-java6/docs/UserApi.md @@ -91,7 +91,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/jersey2-java8/docs/UserApi.md b/samples/client/petstore/java/jersey2-java8/docs/UserApi.md index 9133d79c33c2..3baa2c50ea9f 100644 --- a/samples/client/petstore/java/jersey2-java8/docs/UserApi.md +++ b/samples/client/petstore/java/jersey2-java8/docs/UserApi.md @@ -91,7 +91,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/jersey2/docs/UserApi.md b/samples/client/petstore/java/jersey2/docs/UserApi.md index 9133d79c33c2..3baa2c50ea9f 100644 --- a/samples/client/petstore/java/jersey2/docs/UserApi.md +++ b/samples/client/petstore/java/jersey2/docs/UserApi.md @@ -91,7 +91,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/UserApi.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/UserApi.md index 5969abd518df..52c4485bf832 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/UserApi.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/UserApi.md @@ -85,7 +85,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -127,7 +127,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/okhttp-gson/docs/UserApi.md b/samples/client/petstore/java/okhttp-gson/docs/UserApi.md index 5969abd518df..52c4485bf832 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/UserApi.md +++ b/samples/client/petstore/java/okhttp-gson/docs/UserApi.md @@ -85,7 +85,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -127,7 +127,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/rest-assured/docs/UserApi.md b/samples/client/petstore/java/rest-assured/docs/UserApi.md index 5b581cb9275a..5f5a5dbd3627 100644 --- a/samples/client/petstore/java/rest-assured/docs/UserApi.md +++ b/samples/client/petstore/java/rest-assured/docs/UserApi.md @@ -81,7 +81,7 @@ api.createUsersWithArrayInput() Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -121,7 +121,7 @@ api.createUsersWithListInput() Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/resteasy/docs/UserApi.md b/samples/client/petstore/java/resteasy/docs/UserApi.md index 9133d79c33c2..3baa2c50ea9f 100644 --- a/samples/client/petstore/java/resteasy/docs/UserApi.md +++ b/samples/client/petstore/java/resteasy/docs/UserApi.md @@ -91,7 +91,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/UserApi.md b/samples/client/petstore/java/resttemplate-withXml/docs/UserApi.md index 9133d79c33c2..3baa2c50ea9f 100644 --- a/samples/client/petstore/java/resttemplate-withXml/docs/UserApi.md +++ b/samples/client/petstore/java/resttemplate-withXml/docs/UserApi.md @@ -91,7 +91,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/resttemplate/docs/UserApi.md b/samples/client/petstore/java/resttemplate/docs/UserApi.md index 9133d79c33c2..3baa2c50ea9f 100644 --- a/samples/client/petstore/java/resttemplate/docs/UserApi.md +++ b/samples/client/petstore/java/resttemplate/docs/UserApi.md @@ -91,7 +91,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/retrofit2-play24/docs/UserApi.md b/samples/client/petstore/java/retrofit2-play24/docs/UserApi.md index 9ffe8a7c3902..31354a3cf104 100644 --- a/samples/client/petstore/java/retrofit2-play24/docs/UserApi.md +++ b/samples/client/petstore/java/retrofit2-play24/docs/UserApi.md @@ -91,7 +91,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/retrofit2-play25/docs/UserApi.md b/samples/client/petstore/java/retrofit2-play25/docs/UserApi.md index 9ffe8a7c3902..31354a3cf104 100644 --- a/samples/client/petstore/java/retrofit2-play25/docs/UserApi.md +++ b/samples/client/petstore/java/retrofit2-play25/docs/UserApi.md @@ -91,7 +91,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/retrofit2-play26/docs/UserApi.md b/samples/client/petstore/java/retrofit2-play26/docs/UserApi.md index 9ffe8a7c3902..31354a3cf104 100644 --- a/samples/client/petstore/java/retrofit2-play26/docs/UserApi.md +++ b/samples/client/petstore/java/retrofit2-play26/docs/UserApi.md @@ -91,7 +91,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/retrofit2/docs/UserApi.md b/samples/client/petstore/java/retrofit2/docs/UserApi.md index 9ffe8a7c3902..31354a3cf104 100644 --- a/samples/client/petstore/java/retrofit2/docs/UserApi.md +++ b/samples/client/petstore/java/retrofit2/docs/UserApi.md @@ -91,7 +91,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/retrofit2rx/docs/UserApi.md b/samples/client/petstore/java/retrofit2rx/docs/UserApi.md index 9ffe8a7c3902..31354a3cf104 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/UserApi.md +++ b/samples/client/petstore/java/retrofit2rx/docs/UserApi.md @@ -91,7 +91,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/retrofit2rx2/docs/UserApi.md b/samples/client/petstore/java/retrofit2rx2/docs/UserApi.md index 9ffe8a7c3902..31354a3cf104 100644 --- a/samples/client/petstore/java/retrofit2rx2/docs/UserApi.md +++ b/samples/client/petstore/java/retrofit2rx2/docs/UserApi.md @@ -91,7 +91,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/vertx/docs/UserApi.md b/samples/client/petstore/java/vertx/docs/UserApi.md index 9133d79c33c2..3baa2c50ea9f 100644 --- a/samples/client/petstore/java/vertx/docs/UserApi.md +++ b/samples/client/petstore/java/vertx/docs/UserApi.md @@ -91,7 +91,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/webclient/docs/UserApi.md b/samples/client/petstore/java/webclient/docs/UserApi.md index 9133d79c33c2..3baa2c50ea9f 100644 --- a/samples/client/petstore/java/webclient/docs/UserApi.md +++ b/samples/client/petstore/java/webclient/docs/UserApi.md @@ -91,7 +91,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/javascript-es6/docs/UserApi.md b/samples/client/petstore/javascript-es6/docs/UserApi.md index 11b1a96e510c..121ddbda6657 100644 --- a/samples/client/petstore/javascript-es6/docs/UserApi.md +++ b/samples/client/petstore/javascript-es6/docs/UserApi.md @@ -87,7 +87,7 @@ apiInstance.createUsersWithArrayInput(body, (error, data, response) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](Array.md)| List of user object | + **body** | [**[User]**](User.md)| List of user object | ### Return type @@ -130,7 +130,7 @@ apiInstance.createUsersWithListInput(body, (error, data, response) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](Array.md)| List of user object | + **body** | [**[User]**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/javascript-es6/src/api/UserApi.js b/samples/client/petstore/javascript-es6/src/api/UserApi.js index 9c6c64ff776c..aba7b237e692 100644 --- a/samples/client/petstore/javascript-es6/src/api/UserApi.js +++ b/samples/client/petstore/javascript-es6/src/api/UserApi.js @@ -85,7 +85,7 @@ export default class UserApi { /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @param {module:api/UserApi~createUsersWithArrayInputCallback} callback The callback function, accepting three arguments: error, data, response */ createUsersWithArrayInput(body, callback) { @@ -125,7 +125,7 @@ export default class UserApi { /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @param {module:api/UserApi~createUsersWithListInputCallback} callback The callback function, accepting three arguments: error, data, response */ createUsersWithListInput(body, callback) { diff --git a/samples/client/petstore/javascript-promise-es6/docs/UserApi.md b/samples/client/petstore/javascript-promise-es6/docs/UserApi.md index 4b3539b38f35..47af6eedad62 100644 --- a/samples/client/petstore/javascript-promise-es6/docs/UserApi.md +++ b/samples/client/petstore/javascript-promise-es6/docs/UserApi.md @@ -85,7 +85,7 @@ apiInstance.createUsersWithArrayInput(body).then(() => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](Array.md)| List of user object | + **body** | [**[User]**](User.md)| List of user object | ### Return type @@ -127,7 +127,7 @@ apiInstance.createUsersWithListInput(body).then(() => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](Array.md)| List of user object | + **body** | [**[User]**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/javascript-promise-es6/src/api/UserApi.js b/samples/client/petstore/javascript-promise-es6/src/api/UserApi.js index 5e3cde6ee0fd..4921080e9472 100644 --- a/samples/client/petstore/javascript-promise-es6/src/api/UserApi.js +++ b/samples/client/petstore/javascript-promise-es6/src/api/UserApi.js @@ -84,7 +84,7 @@ export default class UserApi { /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ createUsersWithArrayInputWithHttpInfo(body) { @@ -116,7 +116,7 @@ export default class UserApi { /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ createUsersWithArrayInput(body) { @@ -129,7 +129,7 @@ export default class UserApi { /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ createUsersWithListInputWithHttpInfo(body) { @@ -161,7 +161,7 @@ export default class UserApi { /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ createUsersWithListInput(body) { diff --git a/samples/client/petstore/javascript-promise/docs/UserApi.md b/samples/client/petstore/javascript-promise/docs/UserApi.md index f46f57e59879..aedc1280eab8 100644 --- a/samples/client/petstore/javascript-promise/docs/UserApi.md +++ b/samples/client/petstore/javascript-promise/docs/UserApi.md @@ -87,7 +87,7 @@ apiInstance.createUsersWithArrayInput(body).then(function() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](Array.md)| List of user object | + **body** | [**[User]**](User.md)| List of user object | ### Return type @@ -130,7 +130,7 @@ apiInstance.createUsersWithListInput(body).then(function() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](Array.md)| List of user object | + **body** | [**[User]**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/javascript-promise/src/api/UserApi.js b/samples/client/petstore/javascript-promise/src/api/UserApi.js index 98a574783fde..9ff734798b28 100644 --- a/samples/client/petstore/javascript-promise/src/api/UserApi.js +++ b/samples/client/petstore/javascript-promise/src/api/UserApi.js @@ -99,7 +99,7 @@ /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ this.createUsersWithArrayInputWithHttpInfo = function(body) { @@ -133,7 +133,7 @@ /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ this.createUsersWithArrayInput = function(body) { @@ -146,7 +146,7 @@ /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ this.createUsersWithListInputWithHttpInfo = function(body) { @@ -180,7 +180,7 @@ /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ this.createUsersWithListInput = function(body) { diff --git a/samples/client/petstore/javascript/docs/UserApi.md b/samples/client/petstore/javascript/docs/UserApi.md index 55bc1a7aae97..d405c1b6d206 100644 --- a/samples/client/petstore/javascript/docs/UserApi.md +++ b/samples/client/petstore/javascript/docs/UserApi.md @@ -91,7 +91,7 @@ apiInstance.createUsersWithArrayInput(body, callback); Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](Array.md)| List of user object | + **body** | [**[User]**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ apiInstance.createUsersWithListInput(body, callback); Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](Array.md)| List of user object | + **body** | [**[User]**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/javascript/src/api/UserApi.js b/samples/client/petstore/javascript/src/api/UserApi.js index e9b23cec8a68..9e8e4b76b4ae 100644 --- a/samples/client/petstore/javascript/src/api/UserApi.js +++ b/samples/client/petstore/javascript/src/api/UserApi.js @@ -100,7 +100,7 @@ /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @param {module:api/UserApi~createUsersWithArrayInputCallback} callback The callback function, accepting three arguments: error, data, response */ this.createUsersWithArrayInput = function(body, callback) { @@ -142,7 +142,7 @@ /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @param {module:api/UserApi~createUsersWithListInputCallback} callback The callback function, accepting three arguments: error, data, response */ this.createUsersWithListInput = function(body, callback) { diff --git a/samples/client/petstore/kotlin-string/docs/UserApi.md b/samples/client/petstore/kotlin-string/docs/UserApi.md index 9c6055a91460..0f55f06bc629 100644 --- a/samples/client/petstore/kotlin-string/docs/UserApi.md +++ b/samples/client/petstore/kotlin-string/docs/UserApi.md @@ -89,7 +89,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**kotlin.Array<User>**](kotlin.Array.md)| List of user object | + **body** | [**kotlin.Array<User>**](User.md)| List of user object | ### Return type @@ -133,7 +133,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**kotlin.Array<User>**](kotlin.Array.md)| List of user object | + **body** | [**kotlin.Array<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/kotlin-threetenbp/docs/UserApi.md b/samples/client/petstore/kotlin-threetenbp/docs/UserApi.md index 9c6055a91460..0f55f06bc629 100644 --- a/samples/client/petstore/kotlin-threetenbp/docs/UserApi.md +++ b/samples/client/petstore/kotlin-threetenbp/docs/UserApi.md @@ -89,7 +89,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**kotlin.Array<User>**](kotlin.Array.md)| List of user object | + **body** | [**kotlin.Array<User>**](User.md)| List of user object | ### Return type @@ -133,7 +133,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**kotlin.Array<User>**](kotlin.Array.md)| List of user object | + **body** | [**kotlin.Array<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/kotlin/docs/UserApi.md b/samples/client/petstore/kotlin/docs/UserApi.md index 9c6055a91460..0f55f06bc629 100644 --- a/samples/client/petstore/kotlin/docs/UserApi.md +++ b/samples/client/petstore/kotlin/docs/UserApi.md @@ -89,7 +89,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**kotlin.Array<User>**](kotlin.Array.md)| List of user object | + **body** | [**kotlin.Array<User>**](User.md)| List of user object | ### Return type @@ -133,7 +133,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**kotlin.Array<User>**](kotlin.Array.md)| List of user object | + **body** | [**kotlin.Array<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/UserApi.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/UserApi.md index 375bf0ce9f95..7cb382f9c179 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/UserApi.md +++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/UserApi.md @@ -88,7 +88,7 @@ $apiInstance = new OpenAPI\Client\Api\UserApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$body = array(new \OpenAPI\Client\Model\array()); // \OpenAPI\Client\Model\User[] | List of user object +$body = array(new \OpenAPI\Client\Model\User()); // \OpenAPI\Client\Model\User[] | List of user object try { $apiInstance->createUsersWithArrayInput($body); @@ -103,7 +103,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\OpenAPI\Client\Model\User[]**](../Model/array.md)| List of user object | + **body** | [**\OpenAPI\Client\Model\User[]**](../Model/User.md)| List of user object | ### Return type @@ -141,7 +141,7 @@ $apiInstance = new OpenAPI\Client\Api\UserApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$body = array(new \OpenAPI\Client\Model\array()); // \OpenAPI\Client\Model\User[] | List of user object +$body = array(new \OpenAPI\Client\Model\User()); // \OpenAPI\Client\Model\User[] | List of user object try { $apiInstance->createUsersWithListInput($body); @@ -156,7 +156,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\OpenAPI\Client\Model\User[]**](../Model/array.md)| List of user object | + **body** | [**\OpenAPI\Client\Model\User[]**](../Model/User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/python-asyncio/docs/UserApi.md b/samples/client/petstore/python-asyncio/docs/UserApi.md index 907dc9ec365b..1c5c220640fb 100644 --- a/samples/client/petstore/python-asyncio/docs/UserApi.md +++ b/samples/client/petstore/python-asyncio/docs/UserApi.md @@ -78,7 +78,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -body = None # list[User] | List of user object +body = [petstore_api.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -91,7 +91,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**list[User]**](list.md)| List of user object | + **body** | [**list[User]**](User.md)| List of user object | ### Return type @@ -124,7 +124,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -body = None # list[User] | List of user object +body = [petstore_api.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -137,7 +137,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**list[User]**](list.md)| List of user object | + **body** | [**list[User]**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/python-tornado/docs/UserApi.md b/samples/client/petstore/python-tornado/docs/UserApi.md index 907dc9ec365b..1c5c220640fb 100644 --- a/samples/client/petstore/python-tornado/docs/UserApi.md +++ b/samples/client/petstore/python-tornado/docs/UserApi.md @@ -78,7 +78,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -body = None # list[User] | List of user object +body = [petstore_api.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -91,7 +91,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**list[User]**](list.md)| List of user object | + **body** | [**list[User]**](User.md)| List of user object | ### Return type @@ -124,7 +124,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -body = None # list[User] | List of user object +body = [petstore_api.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -137,7 +137,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**list[User]**](list.md)| List of user object | + **body** | [**list[User]**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/python/docs/UserApi.md b/samples/client/petstore/python/docs/UserApi.md index 907dc9ec365b..1c5c220640fb 100644 --- a/samples/client/petstore/python/docs/UserApi.md +++ b/samples/client/petstore/python/docs/UserApi.md @@ -78,7 +78,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -body = None # list[User] | List of user object +body = [petstore_api.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -91,7 +91,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**list[User]**](list.md)| List of user object | + **body** | [**list[User]**](User.md)| List of user object | ### Return type @@ -124,7 +124,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -body = None # list[User] | List of user object +body = [petstore_api.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -137,7 +137,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**list[User]**](list.md)| List of user object | + **body** | [**list[User]**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/ruby/docs/UserApi.md b/samples/client/petstore/ruby/docs/UserApi.md index 1fa8d487e97c..49a57ef58496 100644 --- a/samples/client/petstore/ruby/docs/UserApi.md +++ b/samples/client/petstore/ruby/docs/UserApi.md @@ -74,7 +74,7 @@ Creates list of users with given input array require 'petstore' api_instance = Petstore::UserApi.new -body = nil # Array | List of user object +body = [Petstore::User.new] # Array | List of user object begin #Creates list of users with given input array @@ -89,7 +89,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Array<User>**](Array.md)| List of user object | + **body** | [**Array<User>**](User.md)| List of user object | ### Return type @@ -118,7 +118,7 @@ Creates list of users with given input array require 'petstore' api_instance = Petstore::UserApi.new -body = nil # Array | List of user object +body = [Petstore::User.new] # Array | List of user object begin #Creates list of users with given input array @@ -133,7 +133,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Array<User>**](Array.md)| List of user object | + **body** | [**Array<User>**](User.md)| List of user object | ### Return type diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/UserApi.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/UserApi.md index 74b4b6122eef..0784a1645181 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/UserApi.md +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/UserApi.md @@ -88,7 +88,7 @@ $apiInstance = new OpenAPI\Client\Api\UserApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$user = array(new \OpenAPI\Client\Model\array()); // \OpenAPI\Client\Model\User[] | List of user object +$user = array(new \OpenAPI\Client\Model\User()); // \OpenAPI\Client\Model\User[] | List of user object try { $apiInstance->createUsersWithArrayInput($user); @@ -103,7 +103,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**\OpenAPI\Client\Model\User[]**](../Model/array.md)| List of user object | + **user** | [**\OpenAPI\Client\Model\User[]**](../Model/User.md)| List of user object | ### Return type @@ -141,7 +141,7 @@ $apiInstance = new OpenAPI\Client\Api\UserApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$user = array(new \OpenAPI\Client\Model\array()); // \OpenAPI\Client\Model\User[] | List of user object +$user = array(new \OpenAPI\Client\Model\User()); // \OpenAPI\Client\Model\User[] | List of user object try { $apiInstance->createUsersWithListInput($user); @@ -156,7 +156,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**\OpenAPI\Client\Model\User[]**](../Model/array.md)| List of user object | + **user** | [**\OpenAPI\Client\Model\User[]**](../Model/User.md)| List of user object | ### Return type diff --git a/samples/openapi3/client/petstore/python/docs/UserApi.md b/samples/openapi3/client/petstore/python/docs/UserApi.md index 3741dc40bc6a..7e6c62efa3ef 100644 --- a/samples/openapi3/client/petstore/python/docs/UserApi.md +++ b/samples/openapi3/client/petstore/python/docs/UserApi.md @@ -78,7 +78,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -user = None # list[User] | List of user object +user = [petstore_api.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -91,7 +91,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**list[User]**](list.md)| List of user object | + **user** | [**list[User]**](User.md)| List of user object | ### Return type @@ -124,7 +124,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -user = None # list[User] | List of user object +user = [petstore_api.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -137,7 +137,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**list[User]**](list.md)| List of user object | + **user** | [**list[User]**](User.md)| List of user object | ### Return type diff --git a/samples/openapi3/client/petstore/ruby/docs/UserApi.md b/samples/openapi3/client/petstore/ruby/docs/UserApi.md index e3e55065528f..631a65ef1f19 100644 --- a/samples/openapi3/client/petstore/ruby/docs/UserApi.md +++ b/samples/openapi3/client/petstore/ruby/docs/UserApi.md @@ -74,7 +74,7 @@ Creates list of users with given input array require 'petstore' api_instance = Petstore::UserApi.new -user = nil # Array | List of user object +user = [Petstore::User.new] # Array | List of user object begin #Creates list of users with given input array @@ -89,7 +89,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**Array<User>**](Array.md)| List of user object | + **user** | [**Array<User>**](User.md)| List of user object | ### Return type @@ -118,7 +118,7 @@ Creates list of users with given input array require 'petstore' api_instance = Petstore::UserApi.new -user = nil # Array | List of user object +user = [Petstore::User.new] # Array | List of user object begin #Creates list of users with given input array @@ -133,7 +133,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**Array<User>**](Array.md)| List of user object | + **user** | [**Array<User>**](User.md)| List of user object | ### Return type diff --git a/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml b/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml index 8cf0da5c9539..67ecc530a56d 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml +++ b/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml @@ -1736,8 +1736,6 @@ components: type: object type: object List: - example: - 123-list: 123-list properties: 123-list: type: string diff --git a/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml b/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml index 8cf0da5c9539..67ecc530a56d 100644 --- a/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml +++ b/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml @@ -1736,8 +1736,6 @@ components: type: object type: object List: - example: - 123-list: 123-list properties: 123-list: type: string diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Resources/docs/Api/UserApiInterface.md b/samples/server/petstore/php-symfony/SymfonyBundle-php/Resources/docs/Api/UserApiInterface.md index b0b43a35b5df..571e9dcbf291 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Resources/docs/Api/UserApiInterface.md +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Resources/docs/Api/UserApiInterface.md @@ -115,7 +115,7 @@ class UserApi implements UserApiInterface Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**OpenAPI\Server\Model\User**](../Model/array.md)| List of user object | + **body** | [**OpenAPI\Server\Model\User**](../Model/User.md)| List of user object | ### Return type @@ -167,7 +167,7 @@ class UserApi implements UserApiInterface Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**OpenAPI\Server\Model\User**](../Model/array.md)| List of user object | + **body** | [**OpenAPI\Server\Model\User**](../Model/User.md)| List of user object | ### Return type diff --git a/samples/server/petstore/rust-server/output/openapi-v3/docs/default_api.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/default_api.md index 0ec3e5c9f1fb..b8652374c9d0 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/docs/default_api.md +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/default_api.md @@ -116,7 +116,7 @@ Optional parameters are passed through a map[string]interface{}. Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **string** | [**array**](array.md)| | + **string** | [**string**](string.md)| | ### Return type @@ -148,7 +148,7 @@ Optional parameters are passed through a map[string]interface{}. Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **string** | [**array**](array.md)| | + **string** | [**string**](string.md)| | ### Return type diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/user_api.md b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/user_api.md index 9698e5b23d91..908faa761755 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/user_api.md +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/user_api.md @@ -49,7 +49,7 @@ Creates list of users with given input array Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**array**](array.md)| List of user object | + **body** | [**User**](User.md)| List of user object | ### Return type @@ -74,7 +74,7 @@ Creates list of users with given input array Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**array**](array.md)| List of user object | + **body** | [**User**](User.md)| List of user object | ### Return type diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApi.java index 7cbf4a06b4ea..01be1c01e6d8 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApi.java @@ -50,7 +50,7 @@ default Mono> createUser(@ApiParam(value = "Created user ob @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/user/createWithArray", method = RequestMethod.POST) - default Mono> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody Flux body, ServerWebExchange exchange) { + default Mono> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody Flux body, ServerWebExchange exchange) { return getDelegate().createUsersWithArrayInput(body, exchange); } @@ -60,7 +60,7 @@ default Mono> createUsersWithArrayInput(@ApiParam(value = " @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/user/createWithList", method = RequestMethod.POST) - default Mono> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody Flux body, ServerWebExchange exchange) { + default Mono> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody Flux body, ServerWebExchange exchange) { return getDelegate().createUsersWithListInput(body, exchange); } diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiDelegate.java index a56614beabdb..156ba16a7693 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiDelegate.java @@ -41,7 +41,7 @@ default Mono> createUser(Mono body, /** * @see UserApi#createUsersWithArrayInput */ - default Mono> createUsersWithArrayInput(Flux body, + default Mono> createUsersWithArrayInput(Flux body, ServerWebExchange exchange) { Mono result = Mono.empty(); exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); @@ -52,7 +52,7 @@ default Mono> createUsersWithArrayInput(Flux body, /** * @see UserApi#createUsersWithListInput */ - default Mono> createUsersWithListInput(Flux body, + default Mono> createUsersWithListInput(Flux body, ServerWebExchange exchange) { Mono result = Mono.empty(); exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); diff --git a/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml index 8cf0da5c9539..67ecc530a56d 100644 --- a/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml @@ -1736,8 +1736,6 @@ components: type: object type: object List: - example: - 123-list: 123-list properties: 123-list: type: string