diff --git a/.github/workflows/samples-kotlin-server-jdk17.yaml b/.github/workflows/samples-kotlin-server-jdk17.yaml
index 22d45ef94c88..999e2f4d817b 100644
--- a/.github/workflows/samples-kotlin-server-jdk17.yaml
+++ b/.github/workflows/samples-kotlin-server-jdk17.yaml
@@ -36,6 +36,7 @@ jobs:
# server
- samples/server/petstore/kotlin-server-required-and-nullable-properties
- samples/server/petstore/kotlin-springboot-3
+ - samples/server/petstore/kotlin-springboot-3-no-response-entity
- samples/server/petstore/kotlin-springboot-additionalproperties
- samples/server/petstore/kotlin-springboot-delegate-nodefaults
- samples/server/petstore/kotlin-springboot-request-cookie
diff --git a/.github/workflows/samples-kotlin-server.yaml b/.github/workflows/samples-kotlin-server.yaml
index 5b6f3f0a0884..0ab8e5389059 100644
--- a/.github/workflows/samples-kotlin-server.yaml
+++ b/.github/workflows/samples-kotlin-server.yaml
@@ -29,6 +29,8 @@ jobs:
sample:
# server
- samples/server/petstore/kotlin-springboot
+ - samples/server/petstore/kotlin-springboot-no-response-entity
+ - samples/server/petstore/kotlin-springboot-no-response-entity-delegate
- samples/server/petstore/kotlin-springboot-multipart-request-model
- samples/server/petstore/kotlin-springboot-bigdecimal-default
- samples/server/petstore/kotlin-springboot-delegate
diff --git a/bin/configs/kotlin-spring-boot-3-no-response-entity.yaml b/bin/configs/kotlin-spring-boot-3-no-response-entity.yaml
new file mode 100644
index 000000000000..661548dcd783
--- /dev/null
+++ b/bin/configs/kotlin-spring-boot-3-no-response-entity.yaml
@@ -0,0 +1,14 @@
+generatorName: kotlin-spring
+outputDir: samples/server/petstore/kotlin-springboot-3-no-response-entity
+library: spring-boot
+inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
+templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
+additionalProperties:
+ documentationProvider: none
+ annotationLibrary: none
+ useSwaggerUI: "false"
+ serviceImplementation: "true"
+ serializableModel: "true"
+ beanValidations: "true"
+ useSpringBoot3: "true"
+ requestMappingMode: api_interface
diff --git a/bin/configs/kotlin-spring-boot-no-response-entity-delegate.yaml b/bin/configs/kotlin-spring-boot-no-response-entity-delegate.yaml
new file mode 100644
index 000000000000..00c2a32823f8
--- /dev/null
+++ b/bin/configs/kotlin-spring-boot-no-response-entity-delegate.yaml
@@ -0,0 +1,15 @@
+generatorName: kotlin-spring
+outputDir: samples/server/petstore/kotlin-springboot-no-response-entity-delegate
+library: spring-boot
+inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
+templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
+additionalProperties:
+ documentationProvider: none
+ annotationLibrary: none
+ useSwaggerUI: "false"
+ serviceImplementation: "true"
+ serializableModel: "true"
+ beanValidations: "true"
+ useResponseEntity: "false"
+ delegatePattern: true
+ requestMappingMode: controller
diff --git a/bin/configs/kotlin-spring-boot-no-response-entity.yaml b/bin/configs/kotlin-spring-boot-no-response-entity.yaml
new file mode 100644
index 000000000000..d4d1daa263d5
--- /dev/null
+++ b/bin/configs/kotlin-spring-boot-no-response-entity.yaml
@@ -0,0 +1,14 @@
+generatorName: kotlin-spring
+outputDir: samples/server/petstore/kotlin-springboot-no-response-entity
+library: spring-boot
+inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
+templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
+additionalProperties:
+ documentationProvider: none
+ annotationLibrary: none
+ useSwaggerUI: "false"
+ serviceImplementation: "true"
+ serializableModel: "true"
+ beanValidations: "true"
+ useResponseEntity: "false"
+ requestMappingMode: controller
diff --git a/bin/configs/kotlin-spring-declarative-interface-reactive-coroutines.yaml b/bin/configs/kotlin-spring-declarative-interface-reactive-coroutines.yaml
index e2ad5943459f..f5375f8f0fb7 100644
--- a/bin/configs/kotlin-spring-declarative-interface-reactive-coroutines.yaml
+++ b/bin/configs/kotlin-spring-declarative-interface-reactive-coroutines.yaml
@@ -11,6 +11,6 @@ additionalProperties:
beanValidations: "true"
interfaceOnly: true
reactive: true
- declarativeInterfaceWrapResponses: false
+ useResponseEntity: false
useFlowForArrayReturnType: false
declarativeInterfaceReactiveMode: "coroutines"
diff --git a/bin/configs/kotlin-spring-declarative-interface-reactive-reactor-wrapped.yaml b/bin/configs/kotlin-spring-declarative-interface-reactive-reactor-wrapped.yaml
index 99ea39a3c8a6..0826f5059e33 100644
--- a/bin/configs/kotlin-spring-declarative-interface-reactive-reactor-wrapped.yaml
+++ b/bin/configs/kotlin-spring-declarative-interface-reactive-reactor-wrapped.yaml
@@ -11,6 +11,6 @@ additionalProperties:
beanValidations: "true"
interfaceOnly: true
reactive: true
- declarativeInterfaceWrapResponses: true
+ useResponseEntity: true
useFlowForArrayReturnType: false
declarativeInterfaceReactiveMode: "reactor"
diff --git a/bin/configs/kotlin-spring-declarative-interface-wrapped.yaml b/bin/configs/kotlin-spring-declarative-interface-wrapped.yaml
index 978584977ae2..ce0d79f6e97b 100644
--- a/bin/configs/kotlin-spring-declarative-interface-wrapped.yaml
+++ b/bin/configs/kotlin-spring-declarative-interface-wrapped.yaml
@@ -11,5 +11,5 @@ additionalProperties:
beanValidations: "true"
interfaceOnly: true
reactive: false
- declarativeInterfaceWrapResponses: true
+ useResponseEntity: true
useFlowForArrayReturnType: false
diff --git a/bin/configs/kotlin-spring-declarative-interface.yaml b/bin/configs/kotlin-spring-declarative-interface.yaml
index 436e59186636..da5c9c0a8854 100644
--- a/bin/configs/kotlin-spring-declarative-interface.yaml
+++ b/bin/configs/kotlin-spring-declarative-interface.yaml
@@ -11,5 +11,5 @@ additionalProperties:
beanValidations: "true"
interfaceOnly: true
reactive: false
- declarativeInterfaceWrapResponses: true
+ useResponseEntity: true
useFlowForArrayReturnType: false
diff --git a/docs/generators/kotlin-spring.md b/docs/generators/kotlin-spring.md
index f9334caaccca..9dfba5d3e6c8 100644
--- a/docs/generators/kotlin-spring.md
+++ b/docs/generators/kotlin-spring.md
@@ -28,7 +28,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|beanQualifiers|Whether to add fully-qualifier class names as bean qualifiers in @Component and @RestController annotations. May be used to prevent bean names clash if multiple generated libraries (contexts) added to single project.| |false|
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|declarativeInterfaceReactiveMode|What type of reactive style to use in Spring Http declarative interface|
- **coroutines**
- Use kotlin-idiomatic 'suspend' functions
- **reactor**
- Use reactor return wrappers 'Mono' and 'Flux'
|coroutines|
-|declarativeInterfaceWrapResponses|Whether (when false) to return actual type (e.g. List<Fruit>) and handle non 2xx responses via exceptions or (when true) return entire ResponseEntity (e.g. ResponseEntity<List<Fruit>>)| |false|
|delegatePattern|Whether to generate the server files using the delegate pattern| |false|
|documentationProvider|Select the OpenAPI documentation provider.|- **none**
- Do not publish an OpenAPI specification.
- **source**
- Publish the original input OpenAPI specification.
- **springfox**
- Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using SpringFox 2.x. Deprecated (for removal); use springdoc instead.
- **springdoc**
- Generate an OpenAPI 3 specification using SpringDoc.
|springdoc|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original|
@@ -56,6 +55,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|useBeanValidation|Use BeanValidation API annotations to validate data types| |true|
|useFeignClientUrl|Whether to generate Feign client with url parameter.| |true|
|useFlowForArrayReturnType|Whether to use Flow for array/collection return types when reactive is enabled. If false, will use List instead.| |true|
+|useResponseEntity|Whether (when false) to return actual type (e.g. List<Fruit>) and handle non-happy path responses via exceptions flow or (when true) return entire ResponseEntity (e.g. ResponseEntity<List<Fruit>>). If disabled, method are annotated using a @ResponseStatus annotation, which has the status of the first response declared in the Api definition| |true|
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false|
|useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true|
|useTags|Whether to use tags for creating interface and controller class names| |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 448561f250ac..62404681c5cb 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
@@ -33,6 +33,7 @@
import org.openapitools.codegen.model.ModelsMap;
import org.openapitools.codegen.model.OperationMap;
import org.openapitools.codegen.model.OperationsMap;
+import org.openapitools.codegen.templating.mustache.SpringHttpStatusLambda;
import org.openapitools.codegen.utils.ModelUtils;
import org.openapitools.codegen.utils.URLPathUtils;
import org.slf4j.Logger;
@@ -85,7 +86,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
public static final String DELEGATE_PATTERN = "delegatePattern";
public static final String USE_TAGS = "useTags";
public static final String BEAN_QUALIFIERS = "beanQualifiers";
- public static final String DECLARATIVE_INTERFACE_WRAP_RESPONSES = "declarativeInterfaceWrapResponses";
+ public static final String USE_RESPONSE_ENTITY = "useResponseEntity";
public static final String DECLARATIVE_INTERFACE_REACTIVE_MODE = "declarativeInterfaceReactiveMode";
public static final String USE_SPRING_BOOT3 = "useSpringBoot3";
@@ -109,6 +110,7 @@ public enum DeclarativeInterfaceReactiveMode {
}
}
+
public enum RequestMappingMode {
api_interface("Generate the @RequestMapping annotation on the generated Api Interface."),
controller("Generate the @RequestMapping annotation on the generated Api Controller Implementation."),
@@ -155,7 +157,7 @@ public String getDescription() {
@Setter protected boolean useTags = false;
@Setter private boolean beanQualifiers = false;
@Setter private DeclarativeInterfaceReactiveMode declarativeInterfaceReactiveMode = DeclarativeInterfaceReactiveMode.coroutines;
- @Setter private boolean declarativeInterfaceWrapResponses = false;
+ @Setter private boolean useResponseEntity = true;
@Getter @Setter
protected boolean useSpringBoot3 = false;
@@ -242,9 +244,9 @@ public KotlinSpringServerCodegen() {
addSwitch(USE_SPRING_BOOT3, "Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.", useSpringBoot3);
addSwitch(USE_FLOW_FOR_ARRAY_RETURN_TYPE, "Whether to use Flow for array/collection return types when reactive is enabled. If false, will use List instead.", useFlowForArrayReturnType);
addSwitch(INCLUDE_HTTP_REQUEST_CONTEXT, "Whether to include HttpServletRequest (blocking) or ServerWebExchange (reactive) as additional parameter in generated methods.", includeHttpRequestContext);
- addSwitch(DECLARATIVE_INTERFACE_WRAP_RESPONSES,
- "Whether (when false) to return actual type (e.g. List) and handle non 2xx responses via exceptions or (when true) return entire ResponseEntity (e.g. ResponseEntity>)",
- declarativeInterfaceWrapResponses);
+ addSwitch(USE_RESPONSE_ENTITY,
+ "Whether (when false) to return actual type (e.g. List) and handle non-happy path responses via exceptions flow or (when true) return entire ResponseEntity (e.g. ResponseEntity>). If disabled, method are annotated using a @ResponseStatus annotation, which has the status of the first response declared in the Api definition",
+ useResponseEntity);
supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application.");
supportedLibraries.put(SPRING_CLOUD_LIBRARY,
"Spring-Cloud-Feign client with Spring-Boot auto-configured settings.");
@@ -468,6 +470,12 @@ public void processOpts() {
additionalProperties.put(CodegenConstants.LIBRARY, library);
}
+ if(additionalProperties.containsKey(USE_RESPONSE_ENTITY)) {
+ this.setUseResponseEntity(Boolean.parseBoolean(additionalProperties.get(USE_RESPONSE_ENTITY).toString()));
+ }
+ writePropertyBack(USE_RESPONSE_ENTITY, useResponseEntity);
+ additionalProperties.put("springHttpStatus", new SpringHttpStatusLambda());
+
// Set basePackage from invokerPackage
if (!additionalProperties.containsKey(BASE_PACKAGE)
&& additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) {
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 5a371f6309c6..a6ba00354e39 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache
@@ -20,7 +20,9 @@ import io.swagger.annotations.AuthorizationScope
{{/swagger1AnnotationLibrary}}
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
+{{#useResponseEntity}}
import org.springframework.http.ResponseEntity
+{{/useResponseEntity}}
import org.springframework.web.bind.annotation.*
{{#useBeanValidation}}
@@ -28,6 +30,9 @@ import org.springframework.validation.annotation.Validated
{{/useBeanValidation}}
import org.springframework.web.context.request.NativeWebRequest
import org.springframework.beans.factory.annotation.Autowired
+{{#useRequestMappingOnController}}
+import {{#apiPackage}}{{.}}.{{/apiPackage}}{{classname}}Controller.Companion.BASE_PATH
+{{/useRequestMappingOnController}}
{{#useBeanValidation}}
import {{javaxPackage}}.validation.Valid
@@ -56,15 +61,18 @@ import kotlin.collections.Map
{{/swagger1AnnotationLibrary}}
{{#useRequestMappingOnController}}
{{=<% %>=}}
-@RequestMapping("\${api.base-path:<%contextPath%>}")
+@RequestMapping("\${api.<%title%>.base-path:api.base-path:$BASE_PATH}")
<%={{ }}=%>
{{/useRequestMappingOnController}}
{{#operations}}
class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) val service: {{classname}}Service{{/serviceInterface}}) {
-{{#operation}}
- {{#swagger2AnnotationLibrary}}
- @Operation(
+{{#operation}}
+{{^useResponseEntity}}
+ @ResponseStatus({{#springHttpStatus}}{{#responses.0}}{{{code}}}{{/responses.0}}{{/springHttpStatus}}){{!
+}}{{/useResponseEntity}}{{!
+}}{{#swagger2AnnotationLibrary}}{{!
+}} @Operation(
summary = "{{{summary}}}",
operationId = "{{{operationId}}}",
description = """{{{unescapedNotes}}}""",
@@ -83,15 +91,28 @@ class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) v
value = [{{#responses}}ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{#baseType}}, response = {{{.}}}::class{{/baseType}}{{#containerType}}, responseContainer = "{{{.}}}"{{/containerType}}){{^-last}},{{/-last}}{{/responses}}]){{/swagger1AnnotationLibrary}}
@RequestMapping(
method = [RequestMethod.{{httpMethod}}],
- value = ["{{#lambdaEscapeInNormalString}}{{{path}}}{{/lambdaEscapeInNormalString}}"]{{#singleContentTypes}}{{#hasProduces}},
+ value = [PATH_{{#lambda.uppercase}}{{#lambda.snakecase}}{{{operationId}}}{{/lambda.snakecase}}{{/lambda.uppercase}} /* "{{#lambdaEscapeInNormalString}}{{{path}}}{{/lambdaEscapeInNormalString}}" */]{{#singleContentTypes}}{{#hasProduces}},
produces = [{{#vendorExtensions.x-accepts}}"{{{.}}}"{{^-last}}, {{/-last}}{{/vendorExtensions.x-accepts}}]{{/hasProduces}}{{#hasConsumes}},
consumes = "{{{vendorExtensions.x-content-type}}}"{{/hasConsumes}}{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}},
produces = [{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}]{{/hasProduces}}{{#hasConsumes}},
consumes = [{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}]{{/hasConsumes}}{{/singleContentTypes}}
)
- {{#reactive}}{{^isArray}}suspend {{/isArray}}{{#isArray}}{{^useFlowForArrayReturnType}}suspend {{/useFlowForArrayReturnType}}{{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>cookieParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}{{#includeHttpRequestContext}}{{#hasParams}}, {{/hasParams}}{{#swagger1AnnotationLibrary}}@ApiParam(hidden = true) {{/swagger1AnnotationLibrary}}{{#swagger2AnnotationLibrary}}@Parameter(hidden = true) {{/swagger2AnnotationLibrary}}{{#reactive}}exchange: org.springframework.web.server.ServerWebExchange{{/reactive}}{{^reactive}}request: {{javaxPackage}}.servlet.http.HttpServletRequest{{/reactive}}{{/includeHttpRequestContext}}): ResponseEntity<{{>returnTypes}}> {
+ {{#reactive}}{{^isArray}}suspend {{/isArray}}{{#isArray}}{{^useFlowForArrayReturnType}}suspend {{/useFlowForArrayReturnType}}{{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}
+ {{>queryParams}}{{>pathParams}}{{>headerParams}}{{>cookieParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}{{#includeHttpRequestContext}}{{#hasParams}},
+ {{/hasParams}}{{#swagger1AnnotationLibrary}}@ApiParam(hidden = true) {{/swagger1AnnotationLibrary}}{{#swagger2AnnotationLibrary}}@Parameter(hidden = true) {{/swagger2AnnotationLibrary}}{{#reactive}}exchange: org.springframework.web.server.ServerWebExchange{{/reactive}}{{^reactive}}request: {{javaxPackage}}.servlet.http.HttpServletRequest{{/reactive}}{{/includeHttpRequestContext}}{{#hasParams}}
+ {{/hasParams}}): {{#useResponseEntity}}ResponseEntity<{{/useResponseEntity}}{{>returnTypes}}{{#useResponseEntity}}>{{/useResponseEntity}} {
return {{>returnValue}}
}
+
{{/operation}}
+ companion object {
+ //for your own safety never directly reuse these path definitions in tests
+ {{#useRequestMappingOnController}}
+ const val BASE_PATH: String = "{{=<% %>=}}<%contextPath%><%={{ }}=%>"
+ {{/useRequestMappingOnController}}
+ {{#operation}}
+ const val PATH_{{#lambda.uppercase}}{{#lambda.snakecase}}{{{operationId}}}{{/lambda.snakecase}}{{/lambda.uppercase}}: String = "{{{path}}}"
+ {{/operation}}
+ }
}
{{/operations}}
diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/apiDelegate.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/apiDelegate.mustache
index 403f55f33c67..5ae576a08bec 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-spring/apiDelegate.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-spring/apiDelegate.mustache
@@ -4,7 +4,9 @@ package {{package}}
{{/imports}}
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
+{{#useResponseEntity}}
import org.springframework.http.ResponseEntity
+{{/useResponseEntity}}
import org.springframework.web.context.request.NativeWebRequest
{{#appendRequestToHandler}}
import org.springframework.http.server.reactive.ServerHttpRequest
@@ -14,9 +16,6 @@ import kotlinx.coroutines.flow.Flow
{{/reactive}}
import java.util.Optional
-{{#async}}
-import java.util.concurrent.CompletableFuture
-{{/async}}
{{#operations}}
/**
@@ -35,7 +34,7 @@ interface {{classname}}Delegate {
*/
{{#reactive}}{{^isArray}}suspend {{/isArray}}{{#isArray}}{{^useFlowForArrayReturnType}}suspend {{/useFlowForArrayReturnType}}{{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}{{>optionalDataType}}{{/isArray}}{{#isArray}}{{#isBodyParam}}Flow<{{{baseType}}}>{{/isBodyParam}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{/isArray}}{{/reactive}}{{^-last}},
{{/-last}}{{/allParams}}{{#includeHttpRequestContext}}{{#hasParams}},
- {{/hasParams}}{{#reactive}}exchange: org.springframework.web.server.ServerWebExchange{{/reactive}}{{^reactive}}request: {{javaxPackage}}.servlet.http.HttpServletRequest{{/reactive}}{{/includeHttpRequestContext}}): {{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}}{{^skipDefaultDelegateInterface}} {
+ {{/hasParams}}{{#reactive}}exchange: org.springframework.web.server.ServerWebExchange{{/reactive}}{{^reactive}}request: {{javaxPackage}}.servlet.http.HttpServletRequest{{/reactive}}{{/includeHttpRequestContext}}): {{#useResponseEntity}}ResponseEntity<{{/useResponseEntity}}{{>returnTypes}}{{#useResponseEntity}}>{{/useResponseEntity}}{{^skipDefaultDelegateInterface}} {
{{>methodBody}}{{! prevent indent}}
}{{/skipDefaultDelegateInterface}}
diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache
index 386a41479b5b..6c60640cfa2d 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache
@@ -25,7 +25,9 @@ import io.swagger.annotations.AuthorizationScope
{{/swagger1AnnotationLibrary}}
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
+{{#useResponseEntity}}
import org.springframework.http.ResponseEntity
+{{/useResponseEntity}}
import org.springframework.web.bind.annotation.*
{{#useBeanValidation}}
@@ -33,6 +35,9 @@ import org.springframework.validation.annotation.Validated
{{/useBeanValidation}}
import org.springframework.web.context.request.NativeWebRequest
import org.springframework.beans.factory.annotation.Autowired
+{{#useRequestMappingOnInterface}}
+import {{#apiPackage}}{{.}}.{{/apiPackage}}{{classname}}.Companion.BASE_PATH
+{{/useRequestMappingOnInterface}}
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.DecimalMax
@@ -63,7 +68,7 @@ import kotlin.collections.Map
{{/swagger1AnnotationLibrary}}
{{#useRequestMappingOnInterface}}
{{=<% %>=}}
-@RequestMapping("\${api.base-path:<%contextPath%>}")
+@RequestMapping("\${api.<%title%>.base-path:api.base-path:$BASE_PATH}")
<%={{ }}=%>
{{/useRequestMappingOnInterface}}
{{#operations}}
@@ -72,10 +77,13 @@ interface {{classname}} {
fun getDelegate(): {{classname}}Delegate{{^skipDefaultDelegateInterface}} = object: {{classname}}Delegate {}{{/skipDefaultDelegateInterface}}
{{/isDelegate}}
-{{#operation}}
- {{#swagger2AnnotationLibrary}}
- @Operation(
+{{#operation}}
+{{^useResponseEntity}}
+ @ResponseStatus({{#springHttpStatus}}{{#responses.0}}{{{code}}}{{/responses.0}}{{/springHttpStatus}}){{!
+}}{{/useResponseEntity}}{{!
+}}{{#swagger2AnnotationLibrary}}{{!
+}} @Operation(
tags = [{{#tags}}"{{{name}}}",{{/tags}}],
summary = "{{{summary}}}",
operationId = "{{{operationId}}}",
@@ -91,18 +99,23 @@ interface {{classname}} {
notes = "{{{notes}}}"{{#returnBaseType}},
response = {{{.}}}::class{{/returnBaseType}}{{#returnContainer}},
responseContainer = "{{{.}}}"{{/returnContainer}}{{#hasAuthMethods}},
- authorizations = [{{#authMethods}}Authorization(value = "{{name}}"{{#isOAuth}}, scopes = [{{#scopes}}AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{^-last}}, {{/-last}}{{/scopes}}]{{/isOAuth}}){{^-last}}, {{/-last}}{{/authMethods}}]{{/hasAuthMethods}})
+ authorizations = [{{#authMethods}}Authorization(value = "{{name}}"{{#isOAuth}}, scopes = [{{#scopes}}AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{^-last}}, {{/-last}}{{/scopes}}]{{/isOAuth}}){{^-last}}, {{/-last}}{{/authMethods}}]{{/hasAuthMethods}}
+ )
@ApiResponses(
- value = [{{#responses}}ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{#baseType}}, response = {{{.}}}::class{{/baseType}}{{#containerType}}, responseContainer = "{{{.}}}"{{/containerType}}){{^-last}}, {{/-last}}{{/responses}}]){{/swagger1AnnotationLibrary}}
+ value = [{{#responses}}ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{#baseType}}, response = {{{.}}}::class{{/baseType}}{{#containerType}}, responseContainer = "{{{.}}}"{{/containerType}}){{^-last}}, {{/-last}}{{/responses}}]
+ ){{/swagger1AnnotationLibrary}}
@RequestMapping(
- method = [RequestMethod.{{httpMethod}}],
- value = ["{{#lambdaEscapeInNormalString}}{{{path}}}{{/lambdaEscapeInNormalString}}"]{{#singleContentTypes}}{{#hasProduces}},
- produces = [{{#vendorExtensions.x-accepts}}"{{{.}}}"{{^-last}}, {{/-last}}{{/vendorExtensions.x-accepts}}]{{/hasProduces}}{{#hasConsumes}},
- consumes = "{{{vendorExtensions.x-content-type}}}"{{/hasConsumes}}{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}},
- produces = [{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}]{{/hasProduces}}{{#hasConsumes}},
- consumes = [{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}]{{/hasConsumes}}{{/singleContentTypes}}
+ method = [RequestMethod.{{httpMethod}}],
+ value = [PATH_{{#lambda.uppercase}}{{#lambda.snakecase}}{{{operationId}}}{{/lambda.snakecase}}{{/lambda.uppercase}} /* "{{#lambdaEscapeInNormalString}}{{{path}}}{{/lambdaEscapeInNormalString}}" */]{{#singleContentTypes}}{{#hasProduces}},
+ produces = [{{#vendorExtensions.x-accepts}}"{{{.}}}"{{^-last}}, {{/-last}}{{/vendorExtensions.x-accepts}}]{{/hasProduces}}{{#hasConsumes}},
+ consumes = "{{{vendorExtensions.x-content-type}}}"{{/hasConsumes}}{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}},
+ produces = [{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}]{{/hasProduces}}{{#hasConsumes}},
+ consumes = [{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}]{{/hasConsumes}}{{/singleContentTypes}}
)
- {{#reactive}}{{^isArray}}suspend {{/isArray}}{{#isArray}}{{^useFlowForArrayReturnType}}suspend {{/useFlowForArrayReturnType}}{{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>cookieParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}{{#includeHttpRequestContext}}{{#hasParams}}, {{/hasParams}}{{#swagger1AnnotationLibrary}}@ApiParam(hidden = true) {{/swagger1AnnotationLibrary}}{{#swagger2AnnotationLibrary}}@Parameter(hidden = true) {{/swagger2AnnotationLibrary}}{{#reactive}}exchange: org.springframework.web.server.ServerWebExchange{{/reactive}}{{^reactive}}request: {{javaxPackage}}.servlet.http.HttpServletRequest{{/reactive}}{{/includeHttpRequestContext}}): ResponseEntity<{{>returnTypes}}>{{^skipDefaultApiInterface}} {
+ {{#reactive}}{{^isArray}}suspend {{/isArray}}{{#isArray}}{{^useFlowForArrayReturnType}}suspend {{/useFlowForArrayReturnType}}{{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}
+ {{>queryParams}}{{>pathParams}}{{>headerParams}}{{>cookieParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}{{#includeHttpRequestContext}}{{#hasParams}},
+ {{/hasParams}}{{#swagger1AnnotationLibrary}}@ApiParam(hidden = true) {{/swagger1AnnotationLibrary}}{{#swagger2AnnotationLibrary}}@Parameter(hidden = true) {{/swagger2AnnotationLibrary}}{{#reactive}}exchange: org.springframework.web.server.ServerWebExchange{{/reactive}}{{^reactive}}request: {{javaxPackage}}.servlet.http.HttpServletRequest{{/reactive}}{{/includeHttpRequestContext}}{{#hasParams}}
+ {{/hasParams}}): {{#useResponseEntity}}ResponseEntity<{{/useResponseEntity}}{{>returnTypes}}{{#useResponseEntity}}>{{/useResponseEntity}}{{^skipDefaultApiInterface}} {
{{^isDelegate}}
return {{>returnValue}}
{{/isDelegate}}
@@ -110,6 +123,16 @@ interface {{classname}} {
return getDelegate().{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}{{#includeHttpRequestContext}}{{#hasParams}}, {{/hasParams}}{{#reactive}}exchange{{/reactive}}{{^reactive}}request{{/reactive}}{{/includeHttpRequestContext}})
{{/isDelegate}}
}{{/skipDefaultApiInterface}}
+
{{/operation}}
+ companion object {
+ //for your own safety never directly reuse these path definitions in tests
+ {{#useRequestMappingOnInterface}}
+ const val BASE_PATH: String = "{{=<% %>=}}<%contextPath%><%={{ }}=%>"
+ {{/useRequestMappingOnInterface}}
+ {{#operation}}
+ const val PATH_{{#lambda.uppercase}}{{#lambda.snakecase}}{{{operationId}}}{{/lambda.snakecase}}{{/lambda.uppercase}}: String = "{{{path}}}"
+ {{/operation}}
+ }
}
{{/operations}}
diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/api_test.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/api_test.mustache
index 32b1134d7e46..eda2afcd0c18 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-spring/api_test.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-spring/api_test.mustache
@@ -7,7 +7,12 @@ import org.junit.jupiter.api.Test
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.test.runBlockingTest
{{/reactive}}
+{{^useResponseEntity}}
+import org.springframework.http.HttpStatus
+{{/useResponseEntity}}
+{{#useResponseEntity}}
import org.springframework.http.ResponseEntity
+{{/useResponseEntity}}
class {{classname}}Test {
@@ -30,7 +35,7 @@ class {{classname}}Test {
val {{{paramName}}}: {{>optionalDataType}} = TODO()
{{/allParams}}
{{#includeHttpRequestContext}}val {{#reactive}}exchange: org.springframework.web.server.ServerWebExchange{{/reactive}}{{^reactive}}request: {{javaxPackage}}.servlet.http.HttpServletRequest{{/reactive}} = TODO(){{/includeHttpRequestContext}}
- val response: ResponseEntity<{{>returnTypes}}> = api.{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}{{#includeHttpRequestContext}}{{#hasParams}}, {{/hasParams}}{{#reactive}}exchange{{/reactive}}{{^reactive}}request{{/reactive}}{{/includeHttpRequestContext}})
+ val response: {{#useResponseEntity}}ResponseEntity<{{/useResponseEntity}}{{>returnTypes}}{{#useResponseEntity}}>{{/useResponseEntity}} = api.{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}{{#includeHttpRequestContext}}{{#hasParams}}, {{/hasParams}}{{#reactive}}exchange{{/reactive}}{{^reactive}}request{{/reactive}}{{/includeHttpRequestContext}})
// TODO: test validations
}
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 4ca6b20ca93d..b4f03475cd0b 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}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}"{{#required}}, required = true{{/required}}{{^isContainer}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = ["{{{allowableValues}}}"], defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = ["{{{allowableValues}}}"]){{/defaultValue}}{{/allowableValues}}{{/isContainer}}){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{^isContainer}}{{#allowableValues}}, allowableValues = "{{{.}}}"{{/allowableValues}}{{/isContainer}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{/swagger1AnnotationLibrary}}{{#useBeanValidation}} @Valid{{>beanValidationBodyParams}}{{/useBeanValidation}} @RequestBody{{^required}}(required = false){{/required}} {{{paramName}}}: {{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}{{>optionalDataType}}{{/isArray}}{{#isArray}}Flow<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}}
\ No newline at end of file
+{{#isBodyParam}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}"{{#required}}, required = true{{/required}}{{^isContainer}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = ["{{{allowableValues}}}"], defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = ["{{{allowableValues}}}"]){{/defaultValue}}{{/allowableValues}}{{/isContainer}}) {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{^isContainer}}{{#allowableValues}}, allowableValues = "{{{.}}}"{{/allowableValues}}{{/isContainer}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}) {{/swagger1AnnotationLibrary}}{{#useBeanValidation}}@Valid{{>beanValidationBodyParams}}{{/useBeanValidation}} @RequestBody{{^required}}(required = false){{/required}} {{{paramName}}}: {{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}{{>optionalDataType}}{{/isArray}}{{#isArray}}Flow<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/formParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/formParams.mustache
index c6eb0799686a..456af893718f 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-spring/formParams.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-spring/formParams.mustache
@@ -1 +1 @@
-{{#isFormParam}}{{^isFile}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/isContainer}}{{/defaultValue}}{{/allowableValues}}){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{/swagger1AnnotationLibrary}} {{#useBeanValidation}}@Valid{{/useBeanValidation}} {{#isModel}}@RequestPart{{/isModel}}{{^isModel}}@RequestParam{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{{paramName}}}: {{>optionalDataType}} {{/isFile}}{{#isFile}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}"){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "file detail"){{/swagger1AnnotationLibrary}} {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart("{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{{paramName}}}: {{>optionalDataType}}{{/isFile}}{{/isFormParam}}
\ No newline at end of file
+{{#isFormParam}}{{^isFile}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/isContainer}}{{/defaultValue}}{{/allowableValues}}) {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}) {{/swagger1AnnotationLibrary}}{{#useBeanValidation}}@Valid {{/useBeanValidation}}{{#isModel}}@RequestPart{{/isModel}}{{^isModel}}@RequestParam{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{{paramName}}}: {{>optionalDataType}}{{/isFile}}{{#isFile}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}") {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "file detail") {{/swagger1AnnotationLibrary}}{{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart("{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{{paramName}}}: {{>optionalDataType}}{{/isFile}}{{/isFormParam}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/headerParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/headerParams.mustache
index a6fa7386e360..0c2678f1bf67 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-spring/headerParams.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-spring/headerParams.mustache
@@ -1 +1 @@
-{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationCore}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}", `in` = ParameterIn.HEADER{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/isContainer}}{{/defaultValue}}{{/allowableValues}}){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{/swagger1AnnotationLibrary}} @RequestHeader(value = "{{baseName}}", required = {{#required}}true{{/required}}{{^required}}false{{/required}}{{#defaultValue}}, defaultValue = {{^isString}}"{{{.}}}"{{/isString}}{{#isString}}{{#isEnum}}"{{{.}}}"{{/isEnum}}{{^isEnum}}{{{.}}}{{/isEnum}}{{/isString}}{{/defaultValue}}) {{{paramName}}}: {{>optionalDataType}}{{/isHeaderParam}}
\ No newline at end of file
+{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationCore}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}", `in` = ParameterIn.HEADER{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/isContainer}}{{/defaultValue}}{{/allowableValues}}) {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}) {{/swagger1AnnotationLibrary}}@RequestHeader(value = "{{baseName}}", required = {{#required}}true{{/required}}{{^required}}false{{/required}}{{#defaultValue}}, defaultValue = {{^isString}}"{{{.}}}"{{/isString}}{{#isString}}{{#isEnum}}"{{{.}}}"{{/isEnum}}{{^isEnum}}{{{.}}}{{/isEnum}}{{/isString}}{{/defaultValue}}) {{{paramName}}}: {{>optionalDataType}}{{/isHeaderParam}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/apiInterface.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/apiInterface.mustache
index 6f724779ff6c..9e554bb4c54a 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/apiInterface.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/apiInterface.mustache
@@ -29,7 +29,12 @@ import io.swagger.annotations.AuthorizationScope
import org.springframework.web.service.annotation.*
import org.springframework.web.bind.annotation.*
+{{^useResponseEntity}}
+import org.springframework.http.HttpStatus
+{{/useResponseEntity}}
+{{#useResponseEntity}}
import org.springframework.http.ResponseEntity
+{{/useResponseEntity}}
{{#useBeanValidation}}
import org.springframework.validation.annotation.Validated
@@ -46,7 +51,7 @@ import kotlin.collections.List
import kotlin.collections.Map
{{#useRequestMappingOnInterface}}@HttpExchange(
-"{{=<% %>=}}\${api.base-path:$BASE_PATH}<%={{ }}=%>"
+"{{=<% %>=}}\${api.<%title%>.base-path:api.base-path:$BASE_PATH}<%={{ }}=%>"
){{/useRequestMappingOnInterface}}
{{#useBeanValidation}}
@Validated
@@ -54,10 +59,11 @@ import kotlin.collections.Map
{{#operations}}
interface {{classname}} {
-{{#operation}}
- {{#httpMethod}}
- @HttpExchange(
- url = PATH_{{#lambda.uppercase}}{{#lambda.snakecase}}{{{operationId}}}{{/lambda.snakecase}}{{/lambda.uppercase}},
+{{#operation}}{{!
+}}{{^useResponseEntity}} @ResponseStatus({{#springHttpStatus}}{{#responses.0}}{{{code}}}{{/responses.0}}{{/springHttpStatus}})
+{{/useResponseEntity}}{{!
+}}{{#httpMethod}} @HttpExchange(
+ url = PATH_{{#lambda.uppercase}}{{#lambda.snakecase}}{{{operationId}}}{{/lambda.snakecase}}{{/lambda.uppercase}} /* "{{#lambdaEscapeInNormalString}}{{{path}}}{{/lambdaEscapeInNormalString}}" */,
method = "{{httpMethod}}"
)
{{/httpMethod}}{{!
diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/httpInterfaceBodyParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/httpInterfaceBodyParams.mustache
index c6383a787c4a..e884046f7d6d 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/httpInterfaceBodyParams.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/httpInterfaceBodyParams.mustache
@@ -1 +1 @@
-{{#isBodyParam}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}"{{#required}}, required = true{{/required}}{{^isContainer}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = ["{{{allowableValues}}}"], defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = ["{{{allowableValues}}}"]){{/defaultValue}}{{/allowableValues}}{{/isContainer}}){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{^isContainer}}{{#allowableValues}}, allowableValues = "{{{.}}}"{{/allowableValues}}{{/isContainer}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{/swagger1AnnotationLibrary}}{{#useBeanValidation}} @Valid{{>beanValidationBodyParams}}{{/useBeanValidation}} @RequestBody{{^required}}(required = false){{/required}} {{{paramName}}}: {{>optionalDataType}}{{/isBodyParam}}
\ No newline at end of file
+{{#isBodyParam}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}"{{#required}}, required = true{{/required}}{{^isContainer}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = ["{{{allowableValues}}}"], defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = ["{{{allowableValues}}}"]){{/defaultValue}}{{/allowableValues}}{{/isContainer}}) {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{^isContainer}}{{#allowableValues}}, allowableValues = "{{{.}}}"{{/allowableValues}}{{/isContainer}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}) {{/swagger1AnnotationLibrary}}{{#useBeanValidation}}@Valid{{>beanValidationBodyParams}}{{/useBeanValidation}} @RequestBody{{^required}}(required = false){{/required}} {{{paramName}}}: {{>optionalDataType}}{{/isBodyParam}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/httpInterfaceReturnTypes.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/httpInterfaceReturnTypes.mustache
index 86f9cea77382..9ea0fdf05f16 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/httpInterfaceReturnTypes.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/httpInterfaceReturnTypes.mustache
@@ -1,47 +1,47 @@
{{! handle reactive map and array}}
{{#reactive}}
{{#isMap}}
-{{#reactiveModeReactor}}Mono<{{/reactiveModeReactor}}{{#declarativeInterfaceWrapResponses}}ResponseEntity<{{/declarativeInterfaceWrapResponses}}Map{{#declarativeInterfaceWrapResponses}}>{{/declarativeInterfaceWrapResponses}}{{#reactiveModeReactor}}>{{/reactiveModeReactor}}
+{{#reactiveModeReactor}}Mono<{{/reactiveModeReactor}}{{#useResponseEntity}}ResponseEntity<{{/useResponseEntity}}Map{{#useResponseEntity}}>{{/useResponseEntity}}{{#reactiveModeReactor}}>{{/reactiveModeReactor}}
{{/isMap}}
{{#isArray}}
{{! array handle reactive - reactor with/without ResponseEntity wrapper}}
{{#reactiveModeReactor}}
-{{#declarativeInterfaceWrapResponses}}Mono{{#declarativeInterfaceWrapResponses}}>>{{/declarativeInterfaceWrapResponses}}
+{{#useResponseEntity}}Mono{{#useResponseEntity}}>>{{/useResponseEntity}}
{{/reactiveModeReactor}}
{{! array handle reactive - coroutines with/without ResponseEntity wrapper}}
{{#reactiveModeCoroutines}}
-{{#declarativeInterfaceWrapResponses}}ResponseEntity<{{/declarativeInterfaceWrapResponses}}{{{returnContainer}}}<{{{returnType}}}>{{#declarativeInterfaceWrapResponses}}>{{/declarativeInterfaceWrapResponses}}
+{{#useResponseEntity}}ResponseEntity<{{/useResponseEntity}}{{{returnContainer}}}<{{{returnType}}}>{{#useResponseEntity}}>{{/useResponseEntity}}
{{/reactiveModeCoroutines}}
{{/isArray}}
{{! handle reactive non-container - with/without ResponseEntity wrapper}}
{{^returnContainer}}
{{#reactiveModeReactor}}
-Mono<{{#declarativeInterfaceWrapResponses}}ResponseEntity<{{/declarativeInterfaceWrapResponses}}{{{returnType}}}{{#declarativeInterfaceWrapResponses}}>{{/declarativeInterfaceWrapResponses}}>
+Mono<{{#useResponseEntity}}ResponseEntity<{{/useResponseEntity}}{{{returnType}}}{{#useResponseEntity}}>{{/useResponseEntity}}>
{{/reactiveModeReactor}}
{{#reactiveModeCoroutines}}
-{{#declarativeInterfaceWrapResponses}}
-ResponseEntity<{{/declarativeInterfaceWrapResponses}}{{{returnType}}}{{#declarativeInterfaceWrapResponses}}>
-{{/declarativeInterfaceWrapResponses}}
+{{#useResponseEntity}}
+ResponseEntity<{{/useResponseEntity}}{{{returnType}}}{{#useResponseEntity}}>
+{{/useResponseEntity}}
{{/reactiveModeCoroutines}}
{{/returnContainer}}
{{/reactive}}
{{^reactive}}
{{! handle non-reactive map and array}}
{{#isMap}}
-{{#declarativeInterfaceWrapResponses}}
-ResponseEntity<{{/declarativeInterfaceWrapResponses}}Map{{#declarativeInterfaceWrapResponses}}>
-{{/declarativeInterfaceWrapResponses}}
+{{#useResponseEntity}}
+ResponseEntity<{{/useResponseEntity}}Map{{#useResponseEntity}}>
+{{/useResponseEntity}}
{{/isMap}}
{{#isArray}}
{{! array handle non-reactive - with/without ResponseEntity wrapper}}
-{{#declarativeInterfaceWrapResponses}}
-ResponseEntity<{{/declarativeInterfaceWrapResponses}}{{{returnContainer}}}<{{{returnType}}}>{{#declarativeInterfaceWrapResponses}}>
-{{/declarativeInterfaceWrapResponses}}
+{{#useResponseEntity}}
+ResponseEntity<{{/useResponseEntity}}{{{returnContainer}}}<{{{returnType}}}>{{#useResponseEntity}}>
+{{/useResponseEntity}}
{{/isArray}}
{{! handle reactive non-container - with/without ResponseEntity wrapper}}
{{^returnContainer}}
-{{#declarativeInterfaceWrapResponses}}
-ResponseEntity<{{/declarativeInterfaceWrapResponses}}{{{returnType}}}{{#declarativeInterfaceWrapResponses}}>
-{{/declarativeInterfaceWrapResponses}}
+{{#useResponseEntity}}
+ResponseEntity<{{/useResponseEntity}}{{{returnType}}}{{#useResponseEntity}}>
+{{/useResponseEntity}}
{{/returnContainer}}
{{/reactive}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/methodBody.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/methodBody.mustache
index 30be6d64a4b4..0a6660b342a8 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-spring/methodBody.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-spring/methodBody.mustache
@@ -1,28 +1,23 @@
{{^reactive}}
{{#examples}}
{{#-first}}
- {{#async}}
-return CompletableFuture.supplyAsync(()-> {
- {{/async}}getRequest().ifPresent { request ->
-{{#async}} {{/async}} for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
+getRequest().ifPresent { request ->
+ for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) {
{{/-first}}
-{{#async}} {{/async}}{{^async}} {{/async}} if (mediaType.isCompatibleWith(MediaType.valueOf("{{{contentType}}}"))) {
-{{#async}} {{/async}}{{^async}} {{/async}} ApiUtil.setExampleResponse(request, "{{{contentType}}}", "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeInNormalString}}{{{example}}}{{/lambdaEscapeInNormalString}}{{/lambdaRemoveLineBreak}}")
-{{#async}} {{/async}}{{^async}} {{/async}} break
-{{#async}} {{/async}}{{^async}} {{/async}} }
+ if (mediaType.isCompatibleWith(MediaType.valueOf("{{{contentType}}}"))) {
+ ApiUtil.setExampleResponse(request, "{{{contentType}}}", "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeInNormalString}}{{{example}}}{{/lambdaEscapeInNormalString}}{{/lambdaRemoveLineBreak}}")
+ break
+ }
{{#-last}}
-{{#async}} {{/async}}{{^async}} {{/async}} }
-{{#async}} {{/async}} }
-{{#async}} {{/async}} return ResponseEntity({{#returnSuccessCode}}HttpStatus.valueOf({{{statusCode}}}){{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}})
- {{#async}}
- }, Runnable::run)
- {{/async}}
+ }
+ }
+ return {{#useResponseEntity}}ResponseEntity({{#returnSuccessCode}}HttpStatus.valueOf({{{statusCode}}}){{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}}){{/useResponseEntity}}{{^useResponseEntity}}TODO("Not yet implemented"){{/useResponseEntity}}
{{/-last}}
{{/examples}}
{{^examples}}
-return {{#async}}CompletableFuture.completedFuture({{/async}}ResponseEntity({{#returnSuccessCode}}HttpStatus.OK{{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}})
+return {{#useResponseEntity}}ResponseEntity({{#returnSuccessCode}}HttpStatus.OK{{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}}){{/useResponseEntity}}{{^useResponseEntity}}TODO("Not yet implemented"){{/useResponseEntity}}
{{/examples}}
{{/reactive}}
{{#reactive}}
-return ResponseEntity({{#returnSuccessCode}}HttpStatus.OK{{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}})
+return {{#useResponseEntity}}ResponseEntity({{#returnSuccessCode}}HttpStatus.OK{{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}}){{/useResponseEntity}}{{^useResponseEntity}}TODO("Not yet implemented"){{/useResponseEntity}}
{{/reactive}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/pathParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/pathParams.mustache
index 0fd5398a244f..2e28d18c78fa 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-spring/pathParams.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-spring/pathParams.mustache
@@ -1 +1 @@
-{{#isPathParam}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/isContainer}}{{/defaultValue}}{{/allowableValues}}){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{/swagger1AnnotationLibrary}} @PathVariable("{{baseName}}") {{{paramName}}}: {{>optionalDataType}}{{/isPathParam}}
\ No newline at end of file
+{{#isPathParam}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/isContainer}}{{/defaultValue}}{{/allowableValues}}) {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}) {{/swagger1AnnotationLibrary}}@PathVariable("{{baseName}}") {{{paramName}}}: {{>optionalDataType}}{{/isPathParam}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/queryParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/queryParams.mustache
index 2bf764c99633..27d7e286bb33 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-spring/queryParams.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-spring/queryParams.mustache
@@ -1 +1 @@
-{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/isContainer}}{{/defaultValue}}{{/allowableValues}}){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}){{/swagger1AnnotationLibrary}}{{#useBeanValidation}} @Valid{{/useBeanValidation}}{{^isModel}} @RequestParam(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{^isContainer}}{{#defaultValue}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}){{/isModel}}{{#isDate}} @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE){{/isDate}}{{#isDateTime}} @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME){{/isDateTime}} {{{paramName}}}: {{>optionalDataType}}{{/isQueryParam}}
\ No newline at end of file
+{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}}@Parameter(description = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}{{#defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]{{^isContainer}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/isContainer}}){{/defaultValue}}{{/allowableValues}}{{#allowableValues}}{{^defaultValue}}, schema = Schema(allowableValues = [{{#values}}"{{{.}}}"{{^-last}}, {{/-last}}{{/values}}]){{/defaultValue}}{{/allowableValues}}{{^allowableValues}}{{#defaultValue}}{{^isContainer}}, schema = Schema(defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/isContainer}}{{/defaultValue}}{{/allowableValues}}) {{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) {{/swagger1AnnotationLibrary}}{{#useBeanValidation}}@Valid{{/useBeanValidation}}{{^isModel}} @RequestParam(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{^isContainer}}{{#defaultValue}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}){{/isModel}}{{#isDate}} @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE){{/isDate}}{{#isDateTime}} @org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME){{/isDateTime}} {{{paramName}}}: {{>optionalDataType}}{{/isQueryParam}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/returnValue.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/returnValue.mustache
index 8c7c1aa4f5ce..44336bb5db69 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-spring/returnValue.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-spring/returnValue.mustache
@@ -1 +1,4 @@
-{{#serviceInterface}}ResponseEntity(service.{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}), {{#responses}}{{#-first}}HttpStatus.valueOf({{code}}){{/-first}}{{/responses}}){{/serviceInterface}}{{^serviceInterface}}ResponseEntity(HttpStatus.NOT_IMPLEMENTED){{/serviceInterface}}
\ No newline at end of file
+{{!}}{{#useResponseEntity}}{{#serviceInterface}}ResponseEntity(service.{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}), {{#responses}}{{#-first}}HttpStatus.valueOf({{code}}){{/-first}}{{/responses}}){{/serviceInterface}}{{/useResponseEntity}}{{!
+---}}{{#useResponseEntity}}{{^serviceInterface}}ResponseEntity(HttpStatus.NOT_IMPLEMENTED){{/serviceInterface}}{{/useResponseEntity}}{{!
+---}}{{^useResponseEntity}}{{#serviceInterface}}service.{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}){{/serviceInterface}}{{/useResponseEntity}}{{!
+---}}{{^useResponseEntity}}{{^serviceInterface}}TODO("Not yet implemented"){{/serviceInterface}}{{/useResponseEntity}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinReservedWordsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinReservedWordsTest.java
index 7e41bae21523..f8e65fae5bbe 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinReservedWordsTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinReservedWordsTest.java
@@ -191,7 +191,8 @@ public void reservedWordsInGeneratedServerCode() throws Exception {
File resultSourcePath = new File(output, "src/main/kotlin");
assertFileContains(Paths.get(resultSourcePath.getAbsolutePath() + baseApiPackage + "AnnotationsApiController.kt"),
- "fun annotationsPost(@Parameter(description = \"\", required = true) @Valid @RequestBody `annotation`: Annotation",
+ "fun annotationsPost("
+ + " @Parameter(description = \"\", required = true) @Valid @RequestBody `annotation`: Annotation",
"return ResponseEntity(service.annotationsPost(`annotation`), HttpStatus.valueOf(200))"
);
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 b697029a4151..43c330044b8f 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
@@ -402,13 +402,17 @@ public void testNullableMultipartFile() throws IOException {
generator.opts(input).generate();
assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/NullableMultipartfileApiController.kt"),
- "file: org.springframework.web.multipart.MultipartFile?)");
+ "file: org.springframework.web.multipart.MultipartFile?"
+ + " )");
assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/NullableMultipartfileArrayApiController.kt"),
- "files: Array?)");
+ "files: Array?"
+ + " )");
assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/NonNullableMultipartfileApiController.kt"),
- "file: org.springframework.web.multipart.MultipartFile)");
+ "file: org.springframework.web.multipart.MultipartFile"
+ + " )");
assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/NonNullableMultipartfileArrayApiController.kt"),
- "files: Array)");
+ "files: Array"
+ + " )");
}
@Test
@@ -1038,7 +1042,7 @@ public void generateHttpInterfaceReactiveWithReactorResponseEntity() throws Exce
codegen.additionalProperties().put(CodegenConstants.LIBRARY, "spring-declarative-http-interface");
codegen.additionalProperties().put(REACTIVE, true);
codegen.additionalProperties().put(DECLARATIVE_INTERFACE_REACTIVE_MODE, "reactor");
- codegen.additionalProperties().put(DECLARATIVE_INTERFACE_WRAP_RESPONSES, true);
+ codegen.additionalProperties().put(USE_RESPONSE_ENTITY, true);
codegen.additionalProperties().put(REQUEST_MAPPING_OPTION, "none");
codegen.additionalProperties().put(USE_FLOW_FOR_ARRAY_RETURN_TYPE, false);
@@ -1061,20 +1065,20 @@ public void generateHttpInterfaceReactiveWithReactorResponseEntity() throws Exce
"import reactor.core.publisher.Flux\n"
+ "import reactor.core.publisher.Mono",
" @HttpExchange(\n"
- + " url = PATH_GET_INVENTORY,\n"
+ + " url = PATH_GET_INVENTORY /* \"/store/inventory\" */,\n"
+ " method = \"GET\"\n"
+ " )\n"
+ " fun getInventory(\n"
+ " ): Mono>>",
" @HttpExchange(\n"
- + " url = PATH_DELETE_ORDER,\n"
+ + " url = PATH_DELETE_ORDER /* \"/store/order/{orderId}\" */,\n"
+ " method = \"DELETE\"\n"
+ " )\n"
+ " fun deleteOrder(\n"
+ " @Parameter(description = \"ID of the order that needs to be deleted\", required = true) @PathVariable(\"orderId\") orderId: kotlin.String\n"
+ " ): Mono>",
" @HttpExchange(\n"
- + " url = PATH_PLACE_ORDER,\n"
+ + " url = PATH_PLACE_ORDER /* \"/store/order\" */,\n"
+ " method = \"POST\"\n"
+ " )\n"
+ " fun placeOrder(\n"
@@ -1105,7 +1109,7 @@ public void generateHttpInterfaceReactiveWithCoroutinesResponseEntity() throws E
codegen.additionalProperties().put(CodegenConstants.LIBRARY, "spring-declarative-http-interface");
codegen.additionalProperties().put(REACTIVE, true);
codegen.additionalProperties().put(DECLARATIVE_INTERFACE_REACTIVE_MODE, "coroutines");
- codegen.additionalProperties().put(DECLARATIVE_INTERFACE_WRAP_RESPONSES, true);
+ codegen.additionalProperties().put(USE_RESPONSE_ENTITY, true);
codegen.additionalProperties().put(REQUEST_MAPPING_OPTION, "none");
codegen.additionalProperties().put(USE_FLOW_FOR_ARRAY_RETURN_TYPE, false);
@@ -1147,7 +1151,7 @@ public void generateHttpInterfaceReactiveWithReactor() throws Exception {
codegen.additionalProperties().put(CodegenConstants.LIBRARY, "spring-declarative-http-interface");
codegen.additionalProperties().put(REACTIVE, true);
codegen.additionalProperties().put(DECLARATIVE_INTERFACE_REACTIVE_MODE, "reactor");
- codegen.additionalProperties().put(DECLARATIVE_INTERFACE_WRAP_RESPONSES, false);
+ codegen.additionalProperties().put(USE_RESPONSE_ENTITY, false);
codegen.additionalProperties().put(REQUEST_MAPPING_OPTION, "none");
codegen.additionalProperties().put(USE_FLOW_FOR_ARRAY_RETURN_TYPE, false);
@@ -1184,7 +1188,6 @@ public void generateHttpInterfaceReactiveWithReactor() throws Exception {
);
}
-
@Test
public void generateHttpInterfaceReactiveWithCoroutines() throws Exception {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
@@ -1196,7 +1199,7 @@ public void generateHttpInterfaceReactiveWithCoroutines() throws Exception {
codegen.additionalProperties().put(CodegenConstants.LIBRARY, "spring-declarative-http-interface");
codegen.additionalProperties().put(REACTIVE, true);
codegen.additionalProperties().put(DECLARATIVE_INTERFACE_REACTIVE_MODE, "coroutines");
- codegen.additionalProperties().put(DECLARATIVE_INTERFACE_WRAP_RESPONSES, false);
+ codegen.additionalProperties().put(USE_RESPONSE_ENTITY, false);
codegen.additionalProperties().put(REQUEST_MAPPING_OPTION, "none");
codegen.additionalProperties().put(USE_FLOW_FOR_ARRAY_RETURN_TYPE, false);
@@ -1237,7 +1240,7 @@ public void generateHttpInterfaceResponseEntity() throws Exception {
codegen.setOutputDir(output.getAbsolutePath());
codegen.additionalProperties().put(CodegenConstants.LIBRARY, "spring-declarative-http-interface");
codegen.additionalProperties().put(REACTIVE, false);
- codegen.additionalProperties().put(DECLARATIVE_INTERFACE_WRAP_RESPONSES, true);
+ codegen.additionalProperties().put(USE_RESPONSE_ENTITY, true);
codegen.additionalProperties().put(REQUEST_MAPPING_OPTION, "none");
codegen.additionalProperties().put(USE_FLOW_FOR_ARRAY_RETURN_TYPE, false);
@@ -1282,7 +1285,7 @@ public void generateHttpInterface() throws Exception {
codegen.setOutputDir(output.getAbsolutePath());
codegen.additionalProperties().put(CodegenConstants.LIBRARY, "spring-declarative-http-interface");
codegen.additionalProperties().put(REACTIVE, false);
- codegen.additionalProperties().put(DECLARATIVE_INTERFACE_WRAP_RESPONSES, false);
+ codegen.additionalProperties().put(USE_RESPONSE_ENTITY, false);
codegen.additionalProperties().put(REQUEST_MAPPING_OPTION, "none");
codegen.additionalProperties().put(USE_FLOW_FOR_ARRAY_RETURN_TYPE, false);
@@ -1383,7 +1386,12 @@ private void verifyGeneratedFilesContain(Map> expectedSnippet
for (var expectedSnippetsByPathToFile : expectedSnippetsByPathsToFiles.entrySet()) {
assertFileContains(expectedSnippetsByPathToFile.getKey(), expectedSnippetsByPathToFile.getValue().toArray(new String[0]));
}
+ }
+ private void verifyGeneratedFilesNotContain(Map> unexpectedSnippetsByPathsToFiles) {
+ for (var unexpectedSnippetsByPathToFile : unexpectedSnippetsByPathsToFiles.entrySet()) {
+ assertFileNotContains(unexpectedSnippetsByPathToFile.getKey(), unexpectedSnippetsByPathToFile.getValue().toArray(new String[0]));
+ }
}
@Test
@@ -1405,8 +1413,15 @@ public void reactiveWithHttpRequestContextControllerImplAnnotationSwaggerNoDeleg
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApiController.kt"), List.of(
- "deletePet(@Parameter(description = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,@Parameter(description = \"\", `in` = ParameterIn.HEADER) @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, @Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity",
- "getPetById(@Parameter(description = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long, @Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
+ "deletePet("
+ + " @Parameter(description = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @Parameter(description = \"\", `in` = ParameterIn.HEADER) @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " @Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @Parameter(description = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApiController.kt"), List.of(
"logoutUser(@Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange)")
)
@@ -1432,8 +1447,15 @@ public void reactiveWithHttpRequestContextControllerImplAnnotationSwagger1NoDele
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApiController.kt"), List.of(
- "deletePet(@ApiParam(value = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,@ApiParam(value = \"\") @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, @ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity",
- "getPetById(@ApiParam(value = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long, @ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
+ "deletePet("
+ + " @ApiParam(value = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @ApiParam(value = \"\") @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " @ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @ApiParam(value = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApiController.kt"), List.of(
"logoutUser(@ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange")
)
@@ -1459,8 +1481,15 @@ public void reactiveWithHttpRequestContextControllerImplAnnotationNoneNoDelegate
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApiController.kt"), List.of(
- "deletePet( @PathVariable(\"petId\") petId: kotlin.Long, @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity",
- "getPetById( @PathVariable(\"petId\") petId: kotlin.Long, exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
+ "deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApiController.kt"), List.of(
"logoutUser(exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity")
)
@@ -1486,8 +1515,13 @@ public void reactiveWithoutHttpRequestContextControllerImplAnnotationNoneNoDeleg
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApiController.kt"), List.of(
- "deletePet( @PathVariable(\"petId\") petId: kotlin.Long, @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?): ResponseEntity",
- "getPetById( @PathVariable(\"petId\") petId: kotlin.Long): ResponseEntity"),
+ "deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApiController.kt"), List.of(
"logoutUser(): ResponseEntity")
)
@@ -1513,8 +1547,15 @@ public void nonReactiveWithHttpRequestContextControllerImplAnnotationSwaggerNoDe
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApiController.kt"), List.of(
- "deletePet(@Parameter(description = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,@Parameter(description = \"\", `in` = ParameterIn.HEADER) @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity",
- "getPetById(@Parameter(description = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long, @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
+ "deletePet("
+ + " @Parameter(description = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @Parameter(description = \"\", `in` = ParameterIn.HEADER) @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @Parameter(description = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApiController.kt"), List.of(
"logoutUser(@Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity")
)
@@ -1540,8 +1581,15 @@ public void nonReactiveWithHttpRequestContextControllerImplAnnotationSwagger1NoD
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApiController.kt"), List.of(
- "deletePet(@ApiParam(value = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,@ApiParam(value = \"\") @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity",
- "getPetById(@ApiParam(value = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long, @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
+ "deletePet("
+ + " @ApiParam(value = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @ApiParam(value = \"\") @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @ApiParam(value = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApiController.kt"), List.of(
"logoutUser(@ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity")
)
@@ -1567,8 +1615,15 @@ public void nonReactiveWithHttpRequestContextControllerImplAnnotationNoneNoDeleg
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApiController.kt"), List.of(
- "deletePet( @PathVariable(\"petId\") petId: kotlin.Long, @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, request: javax.servlet.http.HttpServletRequest): ResponseEntity",
- "getPetById( @PathVariable(\"petId\") petId: kotlin.Long, request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
+ "deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApiController.kt"), List.of(
"logoutUser(request: javax.servlet.http.HttpServletRequest): ResponseEntity")
)
@@ -1594,8 +1649,13 @@ public void nonReactiveWithoutHttpRequestContextControllerImplAnnotationNoneNoDe
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApiController.kt"), List.of(
- "deletePet( @PathVariable(\"petId\") petId: kotlin.Long, @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?): ResponseEntity",
- "getPetById( @PathVariable(\"petId\") petId: kotlin.Long): ResponseEntity"),
+ "deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApiController.kt"), List.of(
"logoutUser(): ResponseEntity")
)
@@ -1621,8 +1681,15 @@ public void reactiveWithHttpRequestContextInterfaceOnlyAnnotationSwaggerNoDelega
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet(@Parameter(description = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,@Parameter(description = \"\", `in` = ParameterIn.HEADER) @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, @Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity",
- "getPetById(@Parameter(description = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long, @Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
+ "deletePet("
+ + " @Parameter(description = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @Parameter(description = \"\", `in` = ParameterIn.HEADER) @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " @Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @Parameter(description = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(@Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity")
)
@@ -1648,8 +1715,15 @@ public void reactiveWithHttpRequestContextInterfaceOnlyAnnotationSwagger1NoDeleg
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet(@ApiParam(value = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,@ApiParam(value = \"\") @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, @ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity",
- "getPetById(@ApiParam(value = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long, @ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
+ "deletePet("
+ + " @ApiParam(value = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @ApiParam(value = \"\") @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " @ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @ApiParam(value = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(@ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity")
)
@@ -1675,8 +1749,15 @@ public void reactiveWithHttpRequestContextInterfaceOnlyAnnotationNoneNoDelegate(
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet( @PathVariable(\"petId\") petId: kotlin.Long, @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity",
- "getPetById( @PathVariable(\"petId\") petId: kotlin.Long, exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
+ "deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity")
)
@@ -1702,8 +1783,13 @@ public void reactiveWithoutHttpRequestContextInterfaceOnlyAnnotationNoneNoDelega
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet( @PathVariable(\"petId\") petId: kotlin.Long, @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?): ResponseEntity",
- "getPetById( @PathVariable(\"petId\") petId: kotlin.Long): ResponseEntity"),
+ "deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(): ResponseEntity")
)
@@ -1729,8 +1815,15 @@ public void nonReactiveWithHttpRequestContextInterfaceOnlyAnnotationSwaggerNoDel
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet(@Parameter(description = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,@Parameter(description = \"\", `in` = ParameterIn.HEADER) @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity",
- "getPetById(@Parameter(description = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long, @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
+ "deletePet("
+ + " @Parameter(description = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @Parameter(description = \"\", `in` = ParameterIn.HEADER) @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @Parameter(description = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(@Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity")
)
@@ -1756,8 +1849,15 @@ public void nonReactiveWithHttpRequestContextInterfaceOnlyAnnotationSwagger1NoDe
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet(@ApiParam(value = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,@ApiParam(value = \"\") @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity",
- "getPetById(@ApiParam(value = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long, @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
+ "deletePet("
+ + " @ApiParam(value = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @ApiParam(value = \"\") @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @ApiParam(value = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(@ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity")
)
@@ -1783,8 +1883,15 @@ public void nonReactiveWithHttpRequestContextInterfaceOnlyAnnotationNoneNoDelega
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet( @PathVariable(\"petId\") petId: kotlin.Long, @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, request: javax.servlet.http.HttpServletRequest): ResponseEntity",
- "getPetById( @PathVariable(\"petId\") petId: kotlin.Long, request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
+ "deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(request: javax.servlet.http.HttpServletRequest): ResponseEntity")
)
@@ -1811,8 +1918,15 @@ public void nonReactiveWithHttpRequestContextControllerImplAnnotationNoneNoDeleg
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApiController.kt"), List.of(
- "deletePet( @PathVariable(\"petId\") petId: kotlin.Long, @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, request: javax.servlet.http.HttpServletRequest): ResponseEntity",
- "getPetById( @PathVariable(\"petId\") petId: kotlin.Long, request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
+ "deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApiController.kt"), List.of(
"logoutUser(request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
root.resolve("src/test/kotlin/org/openapitools/api/PetApiTest.kt"), List.of(
@@ -1825,7 +1939,6 @@ public void nonReactiveWithHttpRequestContextControllerImplAnnotationNoneNoDeleg
);
}
-
@Test
public void reactiveWithHttpRequestContextControllerImplAnnotationNoneNoDelegateWithApiTests() throws Exception {
Path root = generateApiSources(Map.of(
@@ -1846,8 +1959,15 @@ public void reactiveWithHttpRequestContextControllerImplAnnotationNoneNoDelegate
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApiController.kt"), List.of(
- "deletePet( @PathVariable(\"petId\") petId: kotlin.Long, @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity",
- "getPetById( @PathVariable(\"petId\") petId: kotlin.Long, exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
+ "deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApiController.kt"), List.of(
"logoutUser(exchange: org.springframework.web.server.ServerWebExchange)"),
root.resolve("src/test/kotlin/org/openapitools/api/PetApiTest.kt"), List.of(
@@ -1879,8 +1999,13 @@ public void nonReactiveWithoutHttpRequestContextInterfaceOnlyAnnotationNoneNoDel
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet( @PathVariable(\"petId\") petId: kotlin.Long, @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?): ResponseEntity",
- "getPetById( @PathVariable(\"petId\") petId: kotlin.Long): ResponseEntity"),
+ "deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(): ResponseEntity")
)
@@ -1906,8 +2031,15 @@ public void reactiveWithHttpRequestContextControllerImplAnnotationSwaggerDelegat
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet(@Parameter(description = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,@Parameter(description = \"\", `in` = ParameterIn.HEADER) @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, @Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity",
- "getPetById(@Parameter(description = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long, @Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
+ "deletePet("
+ + " @Parameter(description = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @Parameter(description = \"\", `in` = ParameterIn.HEADER) @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " @Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @Parameter(description = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(@Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/PetApiDelegate.kt"), List.of(
@@ -1938,8 +2070,15 @@ public void reactiveWithHttpRequestContextControllerImplAnnotationSwagger1Delega
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet(@ApiParam(value = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,@ApiParam(value = \"\") @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, @ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity",
- "getPetById(@ApiParam(value = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long, @ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
+ "deletePet("
+ + " @ApiParam(value = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @ApiParam(value = \"\") @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " @ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @ApiParam(value = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(@ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/PetApiDelegate.kt"), List.of(
@@ -1970,8 +2109,15 @@ public void reactiveWithHttpRequestContextControllerImplAnnotationNoneDelegate()
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet( @PathVariable(\"petId\") petId: kotlin.Long, @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity",
- "getPetById( @PathVariable(\"petId\") petId: kotlin.Long, exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
+ "deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/PetApiDelegate.kt"), List.of(
@@ -2002,8 +2148,13 @@ public void reactiveWithoutHttpRequestContextControllerImplAnnotationNoneDelegat
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet( @PathVariable(\"petId\") petId: kotlin.Long, @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?): ResponseEntity",
- "getPetById( @PathVariable(\"petId\") petId: kotlin.Long): ResponseEntity"),
+ "deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/PetApiDelegate.kt"), List.of(
@@ -2034,8 +2185,15 @@ public void nonReactiveWithHttpRequestContextControllerImplAnnotationSwaggerDele
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet(@Parameter(description = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,@Parameter(description = \"\", `in` = ParameterIn.HEADER) @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity",
- "getPetById(@Parameter(description = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long, @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
+ "deletePet("
+ + " @Parameter(description = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @Parameter(description = \"\", `in` = ParameterIn.HEADER) @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @Parameter(description = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(@Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/PetApiDelegate.kt"), List.of(
@@ -2066,8 +2224,15 @@ public void nonReactiveWithHttpRequestContextControllerImplAnnotationSwagger1Del
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet(@ApiParam(value = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,@ApiParam(value = \"\") @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity",
- "getPetById(@ApiParam(value = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long, @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
+ "deletePet("
+ + " @ApiParam(value = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @ApiParam(value = \"\") @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @ApiParam(value = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(@ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/PetApiDelegate.kt"), List.of(
@@ -2098,8 +2263,15 @@ public void nonReactiveWithHttpRequestContextControllerImplAnnotationNoneDelegat
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet( @PathVariable(\"petId\") petId: kotlin.Long, @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, request: javax.servlet.http.HttpServletRequest): ResponseEntity",
- "getPetById( @PathVariable(\"petId\") petId: kotlin.Long, request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
+ "fun deletePet(\n"
+ + " @PathVariable(\"petId\") petId: kotlin.Long,\n"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,\n"
+ + " request: javax.servlet.http.HttpServletRequest\n"
+ + " ): ResponseEntity {",
+ "fun getPetById(\n"
+ + " @PathVariable(\"petId\") petId: kotlin.Long,\n"
+ + " request: javax.servlet.http.HttpServletRequest\n"
+ + " ): ResponseEntity {"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/PetApiDelegate.kt"), List.of(
@@ -2130,8 +2302,13 @@ public void nonReactiveWithoutHttpRequestContextControllerImplAnnotationNoneDele
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet( @PathVariable(\"petId\") petId: kotlin.Long, @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?): ResponseEntity",
- "getPetById( @PathVariable(\"petId\") petId: kotlin.Long): ResponseEntity"),
+ "deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/PetApiDelegate.kt"), List.of(
@@ -2162,8 +2339,15 @@ public void reactiveWithHttpRequestContextInterfaceOnlyAnnotationSwaggerDelegate
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet(@Parameter(description = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,@Parameter(description = \"\", `in` = ParameterIn.HEADER) @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, @Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity",
- "getPetById(@Parameter(description = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long, @Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
+ "deletePet("
+ + " @Parameter(description = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @Parameter(description = \"\", `in` = ParameterIn.HEADER) @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " @Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @Parameter(description = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(@Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/PetApiDelegate.kt"), List.of(
@@ -2194,8 +2378,15 @@ public void reactiveWithHttpRequestContextInterfaceOnlyAnnotationSwagger1Delegat
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet(@ApiParam(value = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,@ApiParam(value = \"\") @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, @ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity",
- "getPetById(@ApiParam(value = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long, @ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
+ "deletePet("
+ + " @ApiParam(value = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @ApiParam(value = \"\") @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " @ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @ApiParam(value = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(@ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/PetApiDelegate.kt"), List.of(
@@ -2226,8 +2417,15 @@ public void reactiveWithHttpRequestContextInterfaceOnlyAnnotationNoneDelegate()
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet( @PathVariable(\"petId\") petId: kotlin.Long, @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity",
- "getPetById( @PathVariable(\"petId\") petId: kotlin.Long, exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
+ "deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " exchange: org.springframework.web.server.ServerWebExchange"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/PetApiDelegate.kt"), List.of(
@@ -2258,8 +2456,13 @@ public void reactiveWithoutHttpRequestContextInterfaceOnlyAnnotationNoneDelegate
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet( @PathVariable(\"petId\") petId: kotlin.Long, @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?): ResponseEntity",
- "getPetById( @PathVariable(\"petId\") petId: kotlin.Long): ResponseEntity"),
+ "deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/PetApiDelegate.kt"), List.of(
@@ -2290,8 +2493,15 @@ public void nonReactiveWithHttpRequestContextInterfaceOnlyAnnotationSwaggerDeleg
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet(@Parameter(description = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,@Parameter(description = \"\", `in` = ParameterIn.HEADER) @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity",
- "getPetById(@Parameter(description = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long, @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
+ "deletePet("
+ + " @Parameter(description = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @Parameter(description = \"\", `in` = ParameterIn.HEADER) @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @Parameter(description = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(@Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/PetApiDelegate.kt"), List.of(
@@ -2322,8 +2532,15 @@ public void nonReactiveWithHttpRequestContextInterfaceOnlyAnnotationSwagger1Dele
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet(@ApiParam(value = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,@ApiParam(value = \"\") @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity",
- "getPetById(@ApiParam(value = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long, @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
+ "deletePet("
+ + " @ApiParam(value = \"Pet id to delete\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @ApiParam(value = \"\") @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @ApiParam(value = \"ID of pet to return\", required = true) @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(@ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/PetApiDelegate.kt"), List.of(
@@ -2354,8 +2571,15 @@ public void nonReactiveWithHttpRequestContextInterfaceOnlyAnnotationNoneDelegate
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet( @PathVariable(\"petId\") petId: kotlin.Long, @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?, request: javax.servlet.http.HttpServletRequest): ResponseEntity",
- "getPetById( @PathVariable(\"petId\") petId: kotlin.Long, request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
+ "deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?,"
+ + " request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " request: javax.servlet.http.HttpServletRequest"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(request: javax.servlet.http.HttpServletRequest): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/PetApiDelegate.kt"), List.of(
@@ -2386,8 +2610,13 @@ public void nonReactiveWithoutHttpRequestContextInterfaceOnlyAnnotationNoneDeleg
verifyGeneratedFilesContain(
Map.of(
root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
- "deletePet( @PathVariable(\"petId\") petId: kotlin.Long, @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?): ResponseEntity",
- "getPetById( @PathVariable(\"petId\") petId: kotlin.Long): ResponseEntity"),
+ "deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?"
+ + " ): ResponseEntity",
+ "getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long"
+ + " ): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
"logoutUser(): ResponseEntity"),
root.resolve("src/main/kotlin/org/openapitools/api/PetApiDelegate.kt"), List.of(
@@ -2399,6 +2628,174 @@ public void nonReactiveWithoutHttpRequestContextInterfaceOnlyAnnotationNoneDeleg
);
}
+ @Test
+ public void reactiveWithoutResponseEntity() throws Exception {
+ Path root = generateApiSources(Map.of(
+ KotlinSpringServerCodegen.REACTIVE, true,
+ KotlinSpringServerCodegen.DOCUMENTATION_PROVIDER, "none",
+ KotlinSpringServerCodegen.ANNOTATION_LIBRARY, "none",
+ KotlinSpringServerCodegen.INTERFACE_ONLY, true,
+ KotlinSpringServerCodegen.USE_RESPONSE_ENTITY, false
+ ), Map.of(
+ CodegenConstants.MODELS, "false",
+ CodegenConstants.MODEL_TESTS, "false",
+ CodegenConstants.MODEL_DOCS, "false",
+ CodegenConstants.APIS, "true",
+ CodegenConstants.SUPPORTING_FILES, "false"
+ ));
+ verifyGeneratedFilesContain(
+ Map.of(
+ root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
+ "@ResponseStatus(HttpStatus.BAD_REQUEST)",
+ "suspend fun deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?"
+ + " ): Unit",
+ "@ResponseStatus(HttpStatus.OK)",
+ "suspend fun getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long"
+ + " ): Pet"),
+ root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
+ "@ResponseStatus(HttpStatus.OK)",
+ "suspend fun logoutUser(): Unit"
+ ),
+ root.resolve("src/main/kotlin/org/openapitools/api/StoreApi.kt"), List.of(
+ "@ResponseStatus(HttpStatus.OK)",
+ "suspend fun getInventory(): Map")
+ )
+ );
+ }
+
+ @Test
+ public void nonReactiveWithoutResponseEntity() throws Exception {
+ Path root = generateApiSources(Map.of(
+ KotlinSpringServerCodegen.REACTIVE, false,
+ KotlinSpringServerCodegen.DOCUMENTATION_PROVIDER, "none",
+ KotlinSpringServerCodegen.ANNOTATION_LIBRARY, "none",
+ KotlinSpringServerCodegen.INTERFACE_ONLY, true,
+ KotlinSpringServerCodegen.USE_RESPONSE_ENTITY, false
+ ), Map.of(
+ CodegenConstants.MODELS, "false",
+ CodegenConstants.MODEL_TESTS, "false",
+ CodegenConstants.MODEL_DOCS, "false",
+ CodegenConstants.APIS, "true",
+ CodegenConstants.SUPPORTING_FILES, "false"
+ ));
+ verifyGeneratedFilesContain(
+ Map.of(
+ root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
+ "@ResponseStatus(HttpStatus.BAD_REQUEST)",
+ "fun deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?"
+ + " ): Unit",
+ "@ResponseStatus(HttpStatus.OK)",
+ "fun getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long"
+ + " ): Pet"),
+ root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
+ "@ResponseStatus(HttpStatus.OK)",
+ "fun logoutUser(): Unit"
+ ),
+ root.resolve("src/main/kotlin/org/openapitools/api/StoreApi.kt"), List.of(
+ "@ResponseStatus(HttpStatus.OK)",
+ "fun getInventory(): Map")
+ )
+ );
+
+ verifyGeneratedFilesNotContain(
+ Map.of(
+ root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of("suspend"),
+ root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of("suspend"),
+ root.resolve("src/main/kotlin/org/openapitools/api/StoreApi.kt"), List.of("suspend")
+ )
+ );
+ }
+
+ @Test
+ public void reactiveWithResponseEntity() throws Exception {
+ Path root = generateApiSources(Map.of(
+ KotlinSpringServerCodegen.REACTIVE, true,
+ KotlinSpringServerCodegen.DOCUMENTATION_PROVIDER, "none",
+ KotlinSpringServerCodegen.ANNOTATION_LIBRARY, "none",
+ KotlinSpringServerCodegen.INTERFACE_ONLY, true,
+ KotlinSpringServerCodegen.USE_RESPONSE_ENTITY, true
+ ), Map.of(
+ CodegenConstants.MODELS, "false",
+ CodegenConstants.MODEL_TESTS, "false",
+ CodegenConstants.MODEL_DOCS, "false",
+ CodegenConstants.APIS, "true",
+ CodegenConstants.SUPPORTING_FILES, "false"
+ ));
+ verifyGeneratedFilesContain(
+ Map.of(
+ root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt"), List.of(
+ "suspend fun deletePet("
+ + " @PathVariable(\"petId\") petId: kotlin.Long,"
+ + " @RequestHeader(value = \"api_key\", required = false) apiKey: kotlin.String?"
+ + " ): ResponseEntity",
+ "suspend fun getPetById("
+ + " @PathVariable(\"petId\") petId: kotlin.Long"
+ + " ): ResponseEntity"),
+ root.resolve("src/main/kotlin/org/openapitools/api/UserApi.kt"), List.of(
+ "suspend fun logoutUser(): ResponseEntity"
+ ),
+ root.resolve("src/main/kotlin/org/openapitools/api/StoreApi.kt"), List.of(
+ "suspend fun getInventory(): ResponseEntity