diff --git a/.github/workflows/samples-kotlin-server-jdk17.yaml b/.github/workflows/samples-kotlin-server-jdk17.yaml
index 4133fb979a9..e0f850fb0f5 100644
--- a/.github/workflows/samples-kotlin-server-jdk17.yaml
+++ b/.github/workflows/samples-kotlin-server-jdk17.yaml
@@ -1,16 +1,18 @@
-name: Samples Kotlin server
+name: Samples Kotlin server (jdk17)
on:
push:
branches:
- 'samples/server/petstore/kotlin-springboot-3*/**'
- 'samples/server/petstore/kotlin-server/javalin/**'
+ - 'samples/server/petstore/kotlin-server/javalin-6/**'
# comment out due to gradle build failure
# - samples/server/petstore/kotlin-spring-default/**
pull_request:
paths:
- 'samples/server/petstore/kotlin-springboot-3*/**'
- 'samples/server/petstore/kotlin-server/javalin/**'
+ - 'samples/server/petstore/kotlin-server/javalin-6/**'
# comment out due to gradle build failure
# - samples/server/petstore/kotlin-spring-default/**
@@ -30,6 +32,7 @@ jobs:
- samples/server/petstore/kotlin-springboot-request
- samples/server/petstore/kotlin-springboot-request-cookie
- samples/server/petstore/kotlin-server/javalin
+ - samples/server/petstore/kotlin-server/javalin-6
# comment out due to gradle build failure
# - samples/server/petstore/kotlin-spring-default/
steps:
diff --git a/.github/workflows/samples-kotlin-server-jdk21.yaml b/.github/workflows/samples-kotlin-server-jdk21.yaml
new file mode 100644
index 00000000000..98656961d16
--- /dev/null
+++ b/.github/workflows/samples-kotlin-server-jdk21.yaml
@@ -0,0 +1,45 @@
+name: Samples Kotlin server (jdk21)
+
+on:
+ push:
+ branches:
+ - 'samples/server/petstore/kotlin-server/javalin-6/**'
+ pull_request:
+ paths:
+ - 'samples/server/petstore/kotlin-server/javalin-6/**'
+
+env:
+ GRADLE_VERSION: 8.8
+
+jobs:
+ build:
+ name: Build Kotlin server
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ sample:
+ - samples/server/petstore/kotlin-server/javalin-6
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-java@v4
+ with:
+ distribution: 'temurin'
+ java-version: 21
+ - name: Cache maven dependencies
+ uses: actions/cache@v4
+ env:
+ cache-name: maven-repository
+ with:
+ path: |
+ ~/.gradle
+ key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
+ - name: Install Gradle wrapper
+ uses: eskatos/gradle-command-action@v3
+ with:
+ gradle-version: ${{ env.GRADLE_VERSION }}
+ build-root-directory: ${{ matrix.sample }}
+ arguments: wrapper
+ - name: Build
+ working-directory: ${{ matrix.sample }}
+ run: ./gradlew build -x test
diff --git a/bin/configs/kotlin-server-javalin-6.yaml b/bin/configs/kotlin-server-javalin-6.yaml
new file mode 100644
index 00000000000..395da5f035f
--- /dev/null
+++ b/bin/configs/kotlin-server-javalin-6.yaml
@@ -0,0 +1,7 @@
+generatorName: kotlin-server
+outputDir: samples/server/petstore/kotlin-server/javalin-6
+library: javalin6
+inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
+templateDir: modules/openapi-generator/src/main/resources/kotlin-server
+additionalProperties:
+ hideGenerationTimestamp: "true"
diff --git a/docs/generators/kotlin-server.md b/docs/generators/kotlin-server.md
index e8bcf88662c..9e8c7c2291d 100644
--- a/docs/generators/kotlin-server.md
+++ b/docs/generators/kotlin-server.md
@@ -32,7 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|featureResources|Generates routes in a typed way, for both: constructing URLs and reading the parameters.| |true|
|groupId|Generated artifact package's organization (i.e. maven groupId).| |org.openapitools|
|interfaceOnly|Whether to generate only API interface stubs without the server files. This option is currently supported only when using jaxrs-spec library.| |false|
-|library|library template (sub-template)|
- **ktor**
- ktor framework
- **jaxrs-spec**
- JAX-RS spec only
- **javalin5**
- Javalin 5
|ktor|
+|library|library template (sub-template)|- **ktor**
- ktor framework
- **jaxrs-spec**
- JAX-RS spec only
- **javalin5**
- Javalin 5
- **javalin6**
- Javalin 6
|ktor|
|modelMutable|Create mutable models| |false|
|omitGradleWrapper|Whether to omit Gradle wrapper for creating a sub project.| |false|
|packageName|Generated artifact package name.| |org.openapitools.server|
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinServerCodegen.java
index 044b6323908..1db516c090d 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinServerCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinServerCodegen.java
@@ -27,6 +27,7 @@ import org.openapitools.codegen.meta.features.*;
import org.openapitools.codegen.model.ModelMap;
import org.openapitools.codegen.model.OperationMap;
import org.openapitools.codegen.model.OperationsMap;
+import org.openapitools.codegen.templating.mustache.CamelCaseLambda;
import org.openapitools.codegen.templating.mustache.LowercaseLambda;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -128,6 +129,7 @@ public class KotlinServerCodegen extends AbstractKotlinCodegen implements BeanVa
supportedLibraries.put(Constants.KTOR, "ktor framework");
supportedLibraries.put(Constants.JAXRS_SPEC, "JAX-RS spec only");
supportedLibraries.put(Constants.JAVALIN5, "Javalin 5");
+ supportedLibraries.put(Constants.JAVALIN6, "Javalin 6");
// TODO: Configurable server engine. Defaults to netty in build.gradle.
addOption(CodegenConstants.LIBRARY, CodegenConstants.LIBRARY_DESC, DEFAULT_LIBRARY, supportedLibraries);
@@ -276,7 +278,7 @@ public class KotlinServerCodegen extends AbstractKotlinCodegen implements BeanVa
String gradleBuildFile = "build.gradle";
- if (library.equals(Constants.JAVALIN5)) {
+ if (isJavalin()) {
gradleBuildFile = "build.gradle.kts";
}
@@ -298,11 +300,12 @@ public class KotlinServerCodegen extends AbstractKotlinCodegen implements BeanVa
final String infrastructureFolder = (sourceFolder + File.separator + packageName + File.separator + "infrastructure").replace(".", File.separator);
supportingFiles.add(new SupportingFile("ApiKeyAuth.kt.mustache", infrastructureFolder, "ApiKeyAuth.kt"));
- } else if (library.equals(Constants.JAVALIN5)) {
+ } else if (isJavalin()) {
supportingFiles.add(new SupportingFile("Main.kt.mustache", packageFolder, "Main.kt"));
apiTemplateFiles.put("service.mustache", "Service.kt");
apiTemplateFiles.put("serviceImpl.mustache", "ServiceImpl.kt");
additionalProperties.put("lowercase", new LowercaseLambda());
+ additionalProperties.put("camelcase", new CamelCaseLambda());
typeMapping.put("file", "io.javalin.http.UploadedFile");
importMapping.put("io.javalin.http.UploadedFile", "io.javalin.http.UploadedFile");
}
@@ -318,6 +321,7 @@ public class KotlinServerCodegen extends AbstractKotlinCodegen implements BeanVa
public final static String JAXRS_SPEC = "jaxrs-spec";
public final static String JAVALIN5 = "javalin5";
+ public final static String JAVALIN6 = "javalin6";
public final static String AUTOMATIC_HEAD_REQUESTS = "featureAutoHead";
public final static String AUTOMATIC_HEAD_REQUESTS_DESC = "Automatically provide responses to HEAD requests for existing routes that have the GET verb defined.";
public final static String CONDITIONAL_HEADERS = "featureConditionalHeaders";
@@ -404,4 +408,8 @@ public class KotlinServerCodegen extends AbstractKotlinCodegen implements BeanVa
return objs;
}
+
+ private boolean isJavalin() {
+ return Constants.JAVALIN5.equals(library) || Constants.JAVALIN6.equals(library);
+ }
}
diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/Main.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/Main.kt.mustache
new file mode 100644
index 00000000000..c3413301359
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/Main.kt.mustache
@@ -0,0 +1,36 @@
+package {{packageName}}
+
+import io.javalin.Javalin
+import io.javalin.apibuilder.ApiBuilder.*
+
+{{#apiInfo}}
+{{#apis}}
+{{#operations}}import {{apiPackage}}.{{classname}}
+import {{apiPackage}}.{{classname}}ServiceImpl
+{{/operations}}
+{{/apis}}
+
+fun main() {
+ {{#apis}}
+ {{#operations}}
+ val {{#camelcase}}{{classname}}{{/camelcase}} = {{classname}}({{classname}}ServiceImpl())
+ {{/operations}}
+ {{/apis}}
+
+ val app = Javalin
+ .create { config ->
+ config.router.apiBuilder {
+ {{#apis}}
+ {{#operations}}
+ {{#operation}}
+ path("{{path}}") { {{#lowercase}}{{httpMethod}}{{/lowercase}}({{#camelcase}}{{classname}}{{/camelcase}}::{{operationId}}) }
+ {{/operation}}
+ {{/operations}}
+
+ {{/apis}}
+ }
+ }
+
+ app.start({{serverPort}})
+}
+{{/apiInfo}}
diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/README.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/README.mustache
new file mode 100644
index 00000000000..2c5d5f19518
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/README.mustache
@@ -0,0 +1,94 @@
+# {{packageName}} - Kotlin Server library for {{appName}}
+
+{{#unescapedAppDescription}}
+{{.}}
+{{/unescapedAppDescription}}
+
+Generated by OpenAPI Generator {{generatorVersion}}{{^hideGenerationTimestamp}} ({{generatedDate}}){{/hideGenerationTimestamp}}.
+
+## Build
+
+First, create the gradle wrapper script:
+
+```
+gradle wrapper
+```
+
+Then, run:
+
+```
+./gradlew check assemble
+```
+
+This runs all tests and packages the library.
+
+## Running
+
+The server builds as a fat jar with a main entrypoint. To start the service, run `java -jar ./build/libs/{{artifactId}}.jar`.
+
+You may also run in docker:
+
+```
+docker build -t {{artifactId}} .
+docker run -p 8080:8080 {{artifactId}}
+```
+
+## Features/Implementation Notes
+
+* Supports JSON inputs/outputs, File inputs, and Form inputs (see ktor documentation for more info).
+* ~Supports collection formats for query parameters: csv, tsv, ssv, pipes.~
+* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions.
+
+{{#generateApiDocs}}
+
+## Documentation for API Endpoints
+
+All URIs are relative to *{{{basePath}}}*
+
+Class | Method | HTTP request | Description
+------------ | ------------- | ------------- | -------------
+{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{{summary}}}
+{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
+{{/generateApiDocs}}
+
+{{#generateModelDocs}}
+
+## Documentation for Models
+
+{{#modelPackage}}
+{{#models}}{{#model}} - [{{{modelPackage}}}.{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
+{{/model}}{{/models}}
+{{/modelPackage}}
+{{^modelPackage}}
+No model defined in this package
+{{/modelPackage}}
+{{/generateModelDocs}}
+
+
+## Documentation for Authorization
+
+{{^authMethods}}Endpoints do not require authorization.{{/authMethods}}
+{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}}
+{{#authMethods}}
+
+### {{name}}
+
+{{#isApiKey}}- **Type**: API key
+- **API key parameter name**: {{keyParamName}}
+- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
+{{/isApiKey}}
+{{#isBasicBasic}}- **Type**: HTTP basic authentication
+{{/isBasicBasic}}
+{{#isBasicBearer}}- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
+{{/isBasicBearer}}
+{{#isHttpSignature}}- **Type**: HTTP signature authentication
+{{/isHttpSignature}}
+{{#isOAuth}}- **Type**: OAuth
+- **Flow**: {{flow}}
+- **Authorization URL**: {{authorizationUrl}}
+- **Scopes**: {{^scopes}}N/A{{/scopes}}
+{{#scopes}} - {{scope}}: {{description}}
+{{/scopes}}
+{{/isOAuth}}
+
+{{/authMethods}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/api.mustache
new file mode 100644
index 00000000000..5d6920acaed
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/api.mustache
@@ -0,0 +1,26 @@
+package {{apiPackage}}
+
+import io.javalin.http.Context
+import io.javalin.http.bodyAsClass
+import io.javalin.http.pathParamAsClass
+import io.javalin.http.queryParamAsClass
+
+{{#imports}}import {{import}}
+{{/imports}}
+
+{{#operations}}
+class {{classname}}(private val service: {{classname}}Service) {
+ {{#operation}}
+ /**{{#summary}}
+ * {{.}}{{/summary}}
+ * {{unescapedNotes}}
+ {{#allParams}}* @param {{paramName}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
+ {{/allParams}}*/
+ fun {{operationId}}(ctx: Context) {
+ val result = service.{{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}ctx)
+ ctx.status({{#responses}}{{#-first}}{{code}}{{/-first}}{{/responses}}).json(result)
+ }
+
+ {{/operation}}
+}
+{{/operations}}
diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/bodyParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/bodyParams.mustache
new file mode 100644
index 00000000000..63063e10d76
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/bodyParams.mustache
@@ -0,0 +1 @@
+{{#isBodyParam}}{{#isArray}}ctx.bodyAsClass>(){{/isArray}}{{^isArray}}ctx.bodyAsClass<{{{baseType}}}>(){{/isArray}}{{/isBodyParam}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/build.gradle.kts.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/build.gradle.kts.mustache
new file mode 100644
index 00000000000..e7ca78dba68
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/build.gradle.kts.mustache
@@ -0,0 +1,33 @@
+plugins {
+ kotlin("jvm") version "2.0.0"
+}
+
+group = "{{groupId}}"
+version = "{{artifactVersion}}"
+
+kotlin {
+ jvmToolchain(21)
+}
+
+java {
+ toolchain {
+ languageVersion.set(JavaLanguageVersion.of(21))
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ implementation("io.javalin:javalin:6.1.6")
+ implementation("com.fasterxml.jackson.core:jackson-databind:2.17.1")
+ implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.17.1")
+ implementation("org.slf4j:slf4j-simple:2.0.13")
+
+ testImplementation("org.jetbrains.kotlin:kotlin-test")
+}
+
+tasks.test {
+ useJUnitPlatform()
+}
diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/formParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/formParams.mustache
new file mode 100644
index 00000000000..8dc63bc3ca6
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/formParams.mustache
@@ -0,0 +1 @@
+{{#isFormParam}}{{^isFile}}ctx.formParam("{{baseName}}"){{/isFile}}{{#isFile}}ctx.uploadedFile("{{baseName}}"){{/isFile}}{{/isFormParam}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/gradle.properties b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/gradle.properties
new file mode 100644
index 00000000000..5f1ed7bbe02
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/gradle.properties
@@ -0,0 +1 @@
+org.gradle.caching=true
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/headerParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/headerParams.mustache
new file mode 100644
index 00000000000..a5b25b1a993
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/headerParams.mustache
@@ -0,0 +1 @@
+{{#isHeaderParam}}ctx.header("{{baseName}}"){{/isHeaderParam}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/optionalDataType.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/optionalDataType.mustache
new file mode 100644
index 00000000000..7c026fa826f
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/optionalDataType.mustache
@@ -0,0 +1 @@
+{{#required}}{{{dataType}}}{{/required}}{{^required}}{{#defaultValue}}{{{dataType}}}{{/defaultValue}}{{^defaultValue}}{{{dataType}}}?{{/defaultValue}}{{/required}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/pathParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/pathParams.mustache
new file mode 100644
index 00000000000..4f1cfe9bfc7
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/pathParams.mustache
@@ -0,0 +1 @@
+{{#isPathParam}}ctx.pathParamAsClass<{{{dataType}}}>("{{baseName}}").get(){{/isPathParam}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/queryParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/queryParams.mustache
new file mode 100644
index 00000000000..157e39c9778
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/queryParams.mustache
@@ -0,0 +1 @@
+{{#isQueryParam}}{{#isArray}}ctx.queryParams("{{baseName}}"){{/isArray}}{{^isArray}}ctx.queryParamAsClass<{{{dataType}}}>("{{baseName}}"){{^required}}.allowNullable(){{/required}}.get(){{/isArray}}{{/isQueryParam}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/returnTypes.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/returnTypes.mustache
new file mode 100644
index 00000000000..12a74e5ad7a
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/returnTypes.mustache
@@ -0,0 +1 @@
+{{#isMap}}Map{{/isMap}}{{#isArray}}{{#reactive}}Flow{{/reactive}}{{^reactive}}{{{returnContainer}}}{{/reactive}}<{{{returnType}}}>{{/isArray}}{{^returnContainer}}{{{returnType}}}{{/returnContainer}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/service.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/service.mustache
new file mode 100644
index 00000000000..0c524ab1ec6
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/service.mustache
@@ -0,0 +1,35 @@
+package {{package}}
+
+{{#imports}}import {{import}}
+{{/imports}}
+import io.javalin.http.Context
+
+{{#operations}}
+interface {{classname}}Service {
+{{#operation}}
+
+ /**
+ * {{httpMethod}} {{{path}}}{{#summary}} : {{.}}{{/summary}}
+ {{#notes}}
+ * {{.}}
+ {{/notes}}
+ *
+ {{#allParams}}
+ * @param {{{paramName}}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}
+ {{/allParams}}
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return {{#responses}}{{message}} (status code {{code}}){{^-last}}
+ * or {{/-last}}{{/responses}}
+ {{#isDeprecated}}
+ * @deprecated
+ {{/isDeprecated}}
+ {{#externalDocs}}
+ * {{description}}
+ * @see {{summary}} Documentation
+ {{/externalDocs}}
+ * @see {{classname}}#{{operationId}}
+ */
+ {{#reactive}}{{^isArray}}suspend {{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}{{>optionalDataType}}{{/isArray}}{{#isArray}}Flow<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}ctx: Context): {{>returnTypes}}
+{{/operation}}
+}
+{{/operations}}
diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/serviceImpl.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/serviceImpl.mustache
new file mode 100644
index 00000000000..7358a3492ea
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/javalin6/serviceImpl.mustache
@@ -0,0 +1,19 @@
+package {{package}}
+
+{{#imports}}import {{import}}
+{{/imports}}
+import io.javalin.http.Context
+{{#reactive}}
+import kotlinx.coroutines.flow.Flow
+{{/reactive}}
+{{#operations}}
+
+class {{classname}}ServiceImpl : {{classname}}Service {
+{{#operation}}
+
+ override {{#reactive}}{{^isArray}}suspend {{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{paramName}}: {{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}{{>optionalDataType}}{{/isArray}}{{#isArray}}Flow<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}ctx: Context): {{>returnTypes}} {
+ TODO("Implement me")
+ }
+{{/operation}}
+}
+{{/operations}}
diff --git a/samples/server/petstore/kotlin-server/javalin-6/.openapi-generator-ignore b/samples/server/petstore/kotlin-server/javalin-6/.openapi-generator-ignore
new file mode 100644
index 00000000000..7484ee590a3
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/.openapi-generator-ignore
@@ -0,0 +1,23 @@
+# OpenAPI Generator Ignore
+# Generated by openapi-generator https://github.com/openapitools/openapi-generator
+
+# Use this file to prevent files from being overwritten by the generator.
+# The patterns follow closely to .gitignore or .dockerignore.
+
+# As an example, the C# client generator defines ApiClient.cs.
+# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
+#ApiClient.cs
+
+# You can match any string of characters against a directory, file or extension with a single asterisk (*):
+#foo/*/qux
+# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
+
+# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
+#foo/**/qux
+# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
+
+# You can also negate patterns with an exclamation (!).
+# For example, you can ignore all files in a docs folder with the file extension .md:
+#docs/*.md
+# Then explicitly reverse the ignore rule for a single file:
+#!docs/README.md
diff --git a/samples/server/petstore/kotlin-server/javalin-6/.openapi-generator/FILES b/samples/server/petstore/kotlin-server/javalin-6/.openapi-generator/FILES
new file mode 100644
index 00000000000..171ae436439
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/.openapi-generator/FILES
@@ -0,0 +1,20 @@
+README.md
+build.gradle.kts
+gradle.properties
+settings.gradle
+src/main/kotlin/org/openapitools/server/Main.kt
+src/main/kotlin/org/openapitools/server/apis/PetApi.kt
+src/main/kotlin/org/openapitools/server/apis/PetApiService.kt
+src/main/kotlin/org/openapitools/server/apis/PetApiServiceImpl.kt
+src/main/kotlin/org/openapitools/server/apis/StoreApi.kt
+src/main/kotlin/org/openapitools/server/apis/StoreApiService.kt
+src/main/kotlin/org/openapitools/server/apis/StoreApiServiceImpl.kt
+src/main/kotlin/org/openapitools/server/apis/UserApi.kt
+src/main/kotlin/org/openapitools/server/apis/UserApiService.kt
+src/main/kotlin/org/openapitools/server/apis/UserApiServiceImpl.kt
+src/main/kotlin/org/openapitools/server/models/Category.kt
+src/main/kotlin/org/openapitools/server/models/ModelApiResponse.kt
+src/main/kotlin/org/openapitools/server/models/Order.kt
+src/main/kotlin/org/openapitools/server/models/Pet.kt
+src/main/kotlin/org/openapitools/server/models/Tag.kt
+src/main/kotlin/org/openapitools/server/models/User.kt
diff --git a/samples/server/petstore/kotlin-server/javalin-6/.openapi-generator/VERSION b/samples/server/petstore/kotlin-server/javalin-6/.openapi-generator/VERSION
new file mode 100644
index 00000000000..7e7b8b9bc73
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/.openapi-generator/VERSION
@@ -0,0 +1 @@
+7.7.0-SNAPSHOT
diff --git a/samples/server/petstore/kotlin-server/javalin-6/README.md b/samples/server/petstore/kotlin-server/javalin-6/README.md
new file mode 100644
index 00000000000..92a895d9c8d
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/README.md
@@ -0,0 +1,101 @@
+# org.openapitools.server - Kotlin Server library for OpenAPI Petstore
+
+This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+
+Generated by OpenAPI Generator 7.7.0-SNAPSHOT.
+
+## Build
+
+First, create the gradle wrapper script:
+
+```
+gradle wrapper
+```
+
+Then, run:
+
+```
+./gradlew check assemble
+```
+
+This runs all tests and packages the library.
+
+## Running
+
+The server builds as a fat jar with a main entrypoint. To start the service, run `java -jar ./build/libs/kotlin-server.jar`.
+
+You may also run in docker:
+
+```
+docker build -t kotlin-server .
+docker run -p 8080:8080 kotlin-server
+```
+
+## Features/Implementation Notes
+
+* Supports JSON inputs/outputs, File inputs, and Form inputs (see ktor documentation for more info).
+* ~Supports collection formats for query parameters: csv, tsv, ssv, pipes.~
+* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions.
+
+
+## Documentation for API Endpoints
+
+All URIs are relative to *http://petstore.swagger.io/v2*
+
+Class | Method | HTTP request | Description
+------------ | ------------- | ------------- | -------------
+*PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
+*PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
+*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
+*PetApi* | [**findPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
+*PetApi* | [**getPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
+*PetApi* | [**updatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
+*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
+*PetApi* | [**uploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
+*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
+*StoreApi* | [**getInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
+*StoreApi* | [**getOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
+*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
+*UserApi* | [**createUser**](docs/UserApi.md#createuser) | **POST** /user | Create user
+*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
+*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
+*UserApi* | [**deleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
+*UserApi* | [**getUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
+*UserApi* | [**loginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
+*UserApi* | [**logoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
+*UserApi* | [**updateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
+
+
+
+## Documentation for Models
+
+ - [org.openapitools.server.models.Category](docs/Category.md)
+ - [org.openapitools.server.models.ModelApiResponse](docs/ModelApiResponse.md)
+ - [org.openapitools.server.models.Order](docs/Order.md)
+ - [org.openapitools.server.models.Pet](docs/Pet.md)
+ - [org.openapitools.server.models.Tag](docs/Tag.md)
+ - [org.openapitools.server.models.User](docs/User.md)
+
+
+
+## Documentation for Authorization
+
+
+Authentication schemes defined for the API:
+
+### petstore_auth
+
+- **Type**: OAuth
+- **Flow**: implicit
+- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
+- **Scopes**:
+ - write:pets: modify pets in your account
+ - read:pets: read your pets
+
+
+### api_key
+
+- **Type**: API key
+- **API key parameter name**: api_key
+- **Location**: HTTP header
+
diff --git a/samples/server/petstore/kotlin-server/javalin-6/build.gradle.kts b/samples/server/petstore/kotlin-server/javalin-6/build.gradle.kts
new file mode 100644
index 00000000000..e2d7db33382
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/build.gradle.kts
@@ -0,0 +1,33 @@
+plugins {
+ kotlin("jvm") version "2.0.0"
+}
+
+group = "org.openapitools"
+version = "1.0.0"
+
+kotlin {
+ jvmToolchain(21)
+}
+
+java {
+ toolchain {
+ languageVersion.set(JavaLanguageVersion.of(21))
+ }
+}
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ implementation("io.javalin:javalin:6.1.6")
+ implementation("com.fasterxml.jackson.core:jackson-databind:2.17.1")
+ implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.17.1")
+ implementation("org.slf4j:slf4j-simple:2.0.13")
+
+ testImplementation("org.jetbrains.kotlin:kotlin-test")
+}
+
+tasks.test {
+ useJUnitPlatform()
+}
diff --git a/samples/server/petstore/kotlin-server/javalin-6/gradle.properties b/samples/server/petstore/kotlin-server/javalin-6/gradle.properties
new file mode 100644
index 00000000000..5f1ed7bbe02
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/gradle.properties
@@ -0,0 +1 @@
+org.gradle.caching=true
\ No newline at end of file
diff --git a/samples/server/petstore/kotlin-server/javalin-6/settings.gradle b/samples/server/petstore/kotlin-server/javalin-6/settings.gradle
new file mode 100644
index 00000000000..a09a58efab1
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'kotlin-server'
\ No newline at end of file
diff --git a/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/Main.kt b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/Main.kt
new file mode 100644
index 00000000000..29af342a158
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/Main.kt
@@ -0,0 +1,48 @@
+package org.openapitools.server
+
+import io.javalin.Javalin
+import io.javalin.apibuilder.ApiBuilder.*
+
+import org.openapitools.server.apis.PetApi
+import org.openapitools.server.apis.PetApiServiceImpl
+import org.openapitools.server.apis.StoreApi
+import org.openapitools.server.apis.StoreApiServiceImpl
+import org.openapitools.server.apis.UserApi
+import org.openapitools.server.apis.UserApiServiceImpl
+
+fun main() {
+ val petApi = PetApi(PetApiServiceImpl())
+ val storeApi = StoreApi(StoreApiServiceImpl())
+ val userApi = UserApi(UserApiServiceImpl())
+
+ val app = Javalin
+ .create { config ->
+ config.router.apiBuilder {
+ path("/pet") { post(petApi::addPet) }
+ path("/pet/{petId}") { delete(petApi::deletePet) }
+ path("/pet/findByStatus") { get(petApi::findPetsByStatus) }
+ path("/pet/findByTags") { get(petApi::findPetsByTags) }
+ path("/pet/{petId}") { get(petApi::getPetById) }
+ path("/pet") { put(petApi::updatePet) }
+ path("/pet/{petId}") { post(petApi::updatePetWithForm) }
+ path("/pet/{petId}/uploadImage") { post(petApi::uploadFile) }
+
+ path("/store/order/{orderId}") { delete(storeApi::deleteOrder) }
+ path("/store/inventory") { get(storeApi::getInventory) }
+ path("/store/order/{orderId}") { get(storeApi::getOrderById) }
+ path("/store/order") { post(storeApi::placeOrder) }
+
+ path("/user") { post(userApi::createUser) }
+ path("/user/createWithArray") { post(userApi::createUsersWithArrayInput) }
+ path("/user/createWithList") { post(userApi::createUsersWithListInput) }
+ path("/user/{username}") { delete(userApi::deleteUser) }
+ path("/user/{username}") { get(userApi::getUserByName) }
+ path("/user/login") { get(userApi::loginUser) }
+ path("/user/logout") { get(userApi::logoutUser) }
+ path("/user/{username}") { put(userApi::updateUser) }
+
+ }
+ }
+
+ app.start()
+}
diff --git a/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/PetApi.kt b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/PetApi.kt
new file mode 100644
index 00000000000..23014fe2f14
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/PetApi.kt
@@ -0,0 +1,97 @@
+package org.openapitools.server.apis
+
+import io.javalin.http.Context
+import io.javalin.http.bodyAsClass
+import io.javalin.http.pathParamAsClass
+import io.javalin.http.queryParamAsClass
+
+import org.openapitools.server.models.ModelApiResponse
+import org.openapitools.server.models.Pet
+
+class PetApi(private val service: PetApiService) {
+ /**
+ * Add a new pet to the store
+ *
+ * @param pet Pet object that needs to be added to the store
+ */
+ fun addPet(ctx: Context) {
+ val result = service.addPet(ctx.bodyAsClass(), ctx)
+ ctx.status(200).json(result)
+ }
+
+ /**
+ * Deletes a pet
+ *
+ * @param petId Pet id to delete
+ * @param apiKey (optional)
+ */
+ fun deletePet(ctx: Context) {
+ val result = service.deletePet(ctx.pathParamAsClass("petId").get(), ctx.header("api_key"), ctx)
+ ctx.status(400).json(result)
+ }
+
+ /**
+ * Finds Pets by status
+ * Multiple status values can be provided with comma separated strings
+ * @param status Status values that need to be considered for filter
+ */
+ fun findPetsByStatus(ctx: Context) {
+ val result = service.findPetsByStatus(ctx.queryParams("status"), ctx)
+ ctx.status(200).json(result)
+ }
+
+ /**
+ * Finds Pets by tags
+ * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+ * @param tags Tags to filter by
+ */
+ fun findPetsByTags(ctx: Context) {
+ val result = service.findPetsByTags(ctx.queryParams("tags"), ctx)
+ ctx.status(200).json(result)
+ }
+
+ /**
+ * Find pet by ID
+ * Returns a single pet
+ * @param petId ID of pet to return
+ */
+ fun getPetById(ctx: Context) {
+ val result = service.getPetById(ctx.pathParamAsClass("petId").get(), ctx)
+ ctx.status(200).json(result)
+ }
+
+ /**
+ * Update an existing pet
+ *
+ * @param pet Pet object that needs to be added to the store
+ */
+ fun updatePet(ctx: Context) {
+ val result = service.updatePet(ctx.bodyAsClass(), ctx)
+ ctx.status(200).json(result)
+ }
+
+ /**
+ * Updates a pet in the store with form data
+ *
+ * @param petId ID of pet that needs to be updated
+ * @param name Updated name of the pet (optional)
+ * @param status Updated status of the pet (optional)
+ */
+ fun updatePetWithForm(ctx: Context) {
+ val result = service.updatePetWithForm(ctx.pathParamAsClass("petId").get(), ctx.formParam("name"), ctx.formParam("status"), ctx)
+ ctx.status(405).json(result)
+ }
+
+ /**
+ * uploads an image
+ *
+ * @param petId ID of pet to update
+ * @param additionalMetadata Additional data to pass to server (optional)
+ * @param file file to upload (optional)
+ */
+ fun uploadFile(ctx: Context) {
+ val result = service.uploadFile(ctx.pathParamAsClass("petId").get(), ctx.formParam("additionalMetadata"), ctx.uploadedFile("file"), ctx)
+ ctx.status(200).json(result)
+ }
+
+}
diff --git a/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/PetApiService.kt b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/PetApiService.kt
new file mode 100644
index 00000000000..6c06f129bea
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/PetApiService.kt
@@ -0,0 +1,112 @@
+package org.openapitools.server.apis
+
+import org.openapitools.server.models.ModelApiResponse
+import org.openapitools.server.models.Pet
+import io.javalin.http.Context
+
+interface PetApiService {
+
+ /**
+ * POST /pet : Add a new pet to the store
+ *
+ *
+ * @param pet Pet object that needs to be added to the store (required)
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return successful operation (status code 200)
+ * or Invalid input (status code 405)
+ * @see PetApi#addPet
+ */
+ fun addPet(pet: Pet, ctx: Context): Pet
+
+ /**
+ * DELETE /pet/{petId} : Deletes a pet
+ *
+ *
+ * @param petId Pet id to delete (required)
+ * @param apiKey (optional)
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return Invalid pet value (status code 400)
+ * @see PetApi#deletePet
+ */
+ fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?, ctx: Context): Unit
+
+ /**
+ * GET /pet/findByStatus : Finds Pets by status
+ * Multiple status values can be provided with comma separated strings
+ *
+ * @param status Status values that need to be considered for filter (required)
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return successful operation (status code 200)
+ * or Invalid status value (status code 400)
+ * @see PetApi#findPetsByStatus
+ */
+ fun findPetsByStatus(status: kotlin.collections.List, ctx: Context): List
+
+ /**
+ * GET /pet/findByTags : Finds Pets by tags
+ * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+ *
+ * @param tags Tags to filter by (required)
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return successful operation (status code 200)
+ * or Invalid tag value (status code 400)
+ * @deprecated
+ * @see PetApi#findPetsByTags
+ */
+ fun findPetsByTags(tags: kotlin.collections.List, ctx: Context): List
+
+ /**
+ * GET /pet/{petId} : Find pet by ID
+ * Returns a single pet
+ *
+ * @param petId ID of pet to return (required)
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return successful operation (status code 200)
+ * or Invalid ID supplied (status code 400)
+ * or Pet not found (status code 404)
+ * @see PetApi#getPetById
+ */
+ fun getPetById(petId: kotlin.Long, ctx: Context): Pet
+
+ /**
+ * PUT /pet : Update an existing pet
+ *
+ *
+ * @param pet Pet object that needs to be added to the store (required)
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return successful operation (status code 200)
+ * or Invalid ID supplied (status code 400)
+ * or Pet not found (status code 404)
+ * or Validation exception (status code 405)
+ * API documentation for the updatePet operation
+ * @see Update an existing pet Documentation
+ * @see PetApi#updatePet
+ */
+ fun updatePet(pet: Pet, ctx: Context): Pet
+
+ /**
+ * POST /pet/{petId} : Updates a pet in the store with form data
+ *
+ *
+ * @param petId ID of pet that needs to be updated (required)
+ * @param name Updated name of the pet (optional)
+ * @param status Updated status of the pet (optional)
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return Invalid input (status code 405)
+ * @see PetApi#updatePetWithForm
+ */
+ fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?, ctx: Context): Unit
+
+ /**
+ * POST /pet/{petId}/uploadImage : uploads an image
+ *
+ *
+ * @param petId ID of pet to update (required)
+ * @param additionalMetadata Additional data to pass to server (optional)
+ * @param file file to upload (optional)
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return successful operation (status code 200)
+ * @see PetApi#uploadFile
+ */
+ fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: io.javalin.http.UploadedFile?, ctx: Context): ModelApiResponse
+}
diff --git a/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/PetApiServiceImpl.kt b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/PetApiServiceImpl.kt
new file mode 100644
index 00000000000..9bdc5356561
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/PetApiServiceImpl.kt
@@ -0,0 +1,40 @@
+package org.openapitools.server.apis
+
+import org.openapitools.server.models.ModelApiResponse
+import org.openapitools.server.models.Pet
+import io.javalin.http.Context
+
+class PetApiServiceImpl : PetApiService {
+
+ override fun addPet(pet: Pet, ctx: Context): Pet {
+ TODO("Implement me")
+ }
+
+ override fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?, ctx: Context): Unit {
+ TODO("Implement me")
+ }
+
+ override fun findPetsByStatus(status: kotlin.collections.List, ctx: Context): List {
+ TODO("Implement me")
+ }
+
+ override fun findPetsByTags(tags: kotlin.collections.List, ctx: Context): List {
+ TODO("Implement me")
+ }
+
+ override fun getPetById(petId: kotlin.Long, ctx: Context): Pet {
+ TODO("Implement me")
+ }
+
+ override fun updatePet(pet: Pet, ctx: Context): Pet {
+ TODO("Implement me")
+ }
+
+ override fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?, ctx: Context): Unit {
+ TODO("Implement me")
+ }
+
+ override fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: io.javalin.http.UploadedFile?, ctx: Context): ModelApiResponse {
+ TODO("Implement me")
+ }
+}
diff --git a/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/StoreApi.kt b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/StoreApi.kt
new file mode 100644
index 00000000000..9d04501a2f9
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/StoreApi.kt
@@ -0,0 +1,50 @@
+package org.openapitools.server.apis
+
+import io.javalin.http.Context
+import io.javalin.http.bodyAsClass
+import io.javalin.http.pathParamAsClass
+import io.javalin.http.queryParamAsClass
+
+import org.openapitools.server.models.Order
+
+class StoreApi(private val service: StoreApiService) {
+ /**
+ * Delete purchase order by ID
+ * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+ * @param orderId ID of the order that needs to be deleted
+ */
+ fun deleteOrder(ctx: Context) {
+ val result = service.deleteOrder(ctx.pathParamAsClass("orderId").get(), ctx)
+ ctx.status(400).json(result)
+ }
+
+ /**
+ * Returns pet inventories by status
+ * Returns a map of status codes to quantities
+ */
+ fun getInventory(ctx: Context) {
+ val result = service.getInventory(ctx)
+ ctx.status(200).json(result)
+ }
+
+ /**
+ * Find purchase order by ID
+ * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions
+ * @param orderId ID of pet that needs to be fetched
+ */
+ fun getOrderById(ctx: Context) {
+ val result = service.getOrderById(ctx.pathParamAsClass("orderId").get(), ctx)
+ ctx.status(200).json(result)
+ }
+
+ /**
+ * Place an order for a pet
+ *
+ * @param order order placed for purchasing the pet
+ */
+ fun placeOrder(ctx: Context) {
+ val result = service.placeOrder(ctx.bodyAsClass(), ctx)
+ ctx.status(200).json(result)
+ }
+
+}
diff --git a/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/StoreApiService.kt b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/StoreApiService.kt
new file mode 100644
index 00000000000..684f0810140
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/StoreApiService.kt
@@ -0,0 +1,54 @@
+package org.openapitools.server.apis
+
+import org.openapitools.server.models.Order
+import io.javalin.http.Context
+
+interface StoreApiService {
+
+ /**
+ * DELETE /store/order/{orderId} : Delete purchase order by ID
+ * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+ *
+ * @param orderId ID of the order that needs to be deleted (required)
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return Invalid ID supplied (status code 400)
+ * or Order not found (status code 404)
+ * @see StoreApi#deleteOrder
+ */
+ fun deleteOrder(orderId: kotlin.String, ctx: Context): Unit
+
+ /**
+ * GET /store/inventory : Returns pet inventories by status
+ * Returns a map of status codes to quantities
+ *
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return successful operation (status code 200)
+ * @see StoreApi#getInventory
+ */
+ fun getInventory(ctx: Context): Map
+
+ /**
+ * GET /store/order/{orderId} : Find purchase order by ID
+ * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions
+ *
+ * @param orderId ID of pet that needs to be fetched (required)
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return successful operation (status code 200)
+ * or Invalid ID supplied (status code 400)
+ * or Order not found (status code 404)
+ * @see StoreApi#getOrderById
+ */
+ fun getOrderById(orderId: kotlin.Long, ctx: Context): Order
+
+ /**
+ * POST /store/order : Place an order for a pet
+ *
+ *
+ * @param order order placed for purchasing the pet (required)
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return successful operation (status code 200)
+ * or Invalid Order (status code 400)
+ * @see StoreApi#placeOrder
+ */
+ fun placeOrder(order: Order, ctx: Context): Order
+}
diff --git a/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/StoreApiServiceImpl.kt b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/StoreApiServiceImpl.kt
new file mode 100644
index 00000000000..fd499c8f4fb
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/StoreApiServiceImpl.kt
@@ -0,0 +1,23 @@
+package org.openapitools.server.apis
+
+import org.openapitools.server.models.Order
+import io.javalin.http.Context
+
+class StoreApiServiceImpl : StoreApiService {
+
+ override fun deleteOrder(orderId: kotlin.String, ctx: Context): Unit {
+ TODO("Implement me")
+ }
+
+ override fun getInventory(ctx: Context): Map {
+ TODO("Implement me")
+ }
+
+ override fun getOrderById(orderId: kotlin.Long, ctx: Context): Order {
+ TODO("Implement me")
+ }
+
+ override fun placeOrder(order: Order, ctx: Context): Order {
+ TODO("Implement me")
+ }
+}
diff --git a/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/UserApi.kt b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/UserApi.kt
new file mode 100644
index 00000000000..cbf3648c647
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/UserApi.kt
@@ -0,0 +1,92 @@
+package org.openapitools.server.apis
+
+import io.javalin.http.Context
+import io.javalin.http.bodyAsClass
+import io.javalin.http.pathParamAsClass
+import io.javalin.http.queryParamAsClass
+
+import org.openapitools.server.models.User
+
+class UserApi(private val service: UserApiService) {
+ /**
+ * Create user
+ * This can only be done by the logged in user.
+ * @param user Created user object
+ */
+ fun createUser(ctx: Context) {
+ val result = service.createUser(ctx.bodyAsClass(), ctx)
+ ctx.status(200).json(result)
+ }
+
+ /**
+ * Creates list of users with given input array
+ *
+ * @param user List of user object
+ */
+ fun createUsersWithArrayInput(ctx: Context) {
+ val result = service.createUsersWithArrayInput(ctx.bodyAsClass>(), ctx)
+ ctx.status(200).json(result)
+ }
+
+ /**
+ * Creates list of users with given input array
+ *
+ * @param user List of user object
+ */
+ fun createUsersWithListInput(ctx: Context) {
+ val result = service.createUsersWithListInput(ctx.bodyAsClass>(), ctx)
+ ctx.status(200).json(result)
+ }
+
+ /**
+ * Delete user
+ * This can only be done by the logged in user.
+ * @param username The name that needs to be deleted
+ */
+ fun deleteUser(ctx: Context) {
+ val result = service.deleteUser(ctx.pathParamAsClass("username").get(), ctx)
+ ctx.status(400).json(result)
+ }
+
+ /**
+ * Get user by user name
+ *
+ * @param username The name that needs to be fetched. Use user1 for testing.
+ */
+ fun getUserByName(ctx: Context) {
+ val result = service.getUserByName(ctx.pathParamAsClass("username").get(), ctx)
+ ctx.status(200).json(result)
+ }
+
+ /**
+ * Logs user into the system
+ *
+ * @param username The user name for login
+ * @param password The password for login in clear text
+ */
+ fun loginUser(ctx: Context) {
+ val result = service.loginUser(ctx.queryParamAsClass("username").get(), ctx.queryParamAsClass("password").get(), ctx)
+ ctx.status(200).json(result)
+ }
+
+ /**
+ * Logs out current logged in user session
+ *
+ */
+ fun logoutUser(ctx: Context) {
+ val result = service.logoutUser(ctx)
+ ctx.status(200).json(result)
+ }
+
+ /**
+ * Updated user
+ * This can only be done by the logged in user.
+ * @param username name that need to be deleted
+ * @param user Updated user object
+ */
+ fun updateUser(ctx: Context) {
+ val result = service.updateUser(ctx.pathParamAsClass("username").get(), ctx.bodyAsClass(), ctx)
+ ctx.status(400).json(result)
+ }
+
+}
diff --git a/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/UserApiService.kt b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/UserApiService.kt
new file mode 100644
index 00000000000..b66d6d8d1e4
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/UserApiService.kt
@@ -0,0 +1,101 @@
+package org.openapitools.server.apis
+
+import org.openapitools.server.models.User
+import io.javalin.http.Context
+
+interface UserApiService {
+
+ /**
+ * POST /user : Create user
+ * This can only be done by the logged in user.
+ *
+ * @param user Created user object (required)
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return successful operation (status code 200)
+ * @see UserApi#createUser
+ */
+ fun createUser(user: User, ctx: Context): Unit
+
+ /**
+ * POST /user/createWithArray : Creates list of users with given input array
+ *
+ *
+ * @param user List of user object (required)
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return successful operation (status code 200)
+ * @see UserApi#createUsersWithArrayInput
+ */
+ fun createUsersWithArrayInput(user: kotlin.collections.List, ctx: Context): Unit
+
+ /**
+ * POST /user/createWithList : Creates list of users with given input array
+ *
+ *
+ * @param user List of user object (required)
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return successful operation (status code 200)
+ * @see UserApi#createUsersWithListInput
+ */
+ fun createUsersWithListInput(user: kotlin.collections.List, ctx: Context): Unit
+
+ /**
+ * DELETE /user/{username} : Delete user
+ * This can only be done by the logged in user.
+ *
+ * @param username The name that needs to be deleted (required)
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return Invalid username supplied (status code 400)
+ * or User not found (status code 404)
+ * @see UserApi#deleteUser
+ */
+ fun deleteUser(username: kotlin.String, ctx: Context): Unit
+
+ /**
+ * GET /user/{username} : Get user by user name
+ *
+ *
+ * @param username The name that needs to be fetched. Use user1 for testing. (required)
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return successful operation (status code 200)
+ * or Invalid username supplied (status code 400)
+ * or User not found (status code 404)
+ * @see UserApi#getUserByName
+ */
+ fun getUserByName(username: kotlin.String, ctx: Context): User
+
+ /**
+ * GET /user/login : Logs user into the system
+ *
+ *
+ * @param username The user name for login (required)
+ * @param password The password for login in clear text (required)
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return successful operation (status code 200)
+ * or Invalid username/password supplied (status code 400)
+ * @see UserApi#loginUser
+ */
+ fun loginUser(username: kotlin.String, password: kotlin.String, ctx: Context): kotlin.String
+
+ /**
+ * GET /user/logout : Logs out current logged in user session
+ *
+ *
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return successful operation (status code 200)
+ * @see UserApi#logoutUser
+ */
+ fun logoutUser(ctx: Context): Unit
+
+ /**
+ * PUT /user/{username} : Updated user
+ * This can only be done by the logged in user.
+ *
+ * @param username name that need to be deleted (required)
+ * @param user Updated user object (required)
+ * @param ctx The Javalin context. Especially handy if you need to access things like authentication headers in your service. (required)
+ * @return Invalid user supplied (status code 400)
+ * or User not found (status code 404)
+ * @see UserApi#updateUser
+ */
+ fun updateUser(username: kotlin.String, user: User, ctx: Context): Unit
+}
diff --git a/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/UserApiServiceImpl.kt b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/UserApiServiceImpl.kt
new file mode 100644
index 00000000000..60d3ab35d05
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/apis/UserApiServiceImpl.kt
@@ -0,0 +1,39 @@
+package org.openapitools.server.apis
+
+import org.openapitools.server.models.User
+import io.javalin.http.Context
+
+class UserApiServiceImpl : UserApiService {
+
+ override fun createUser(user: User, ctx: Context): Unit {
+ TODO("Implement me")
+ }
+
+ override fun createUsersWithArrayInput(user: kotlin.collections.List, ctx: Context): Unit {
+ TODO("Implement me")
+ }
+
+ override fun createUsersWithListInput(user: kotlin.collections.List, ctx: Context): Unit {
+ TODO("Implement me")
+ }
+
+ override fun deleteUser(username: kotlin.String, ctx: Context): Unit {
+ TODO("Implement me")
+ }
+
+ override fun getUserByName(username: kotlin.String, ctx: Context): User {
+ TODO("Implement me")
+ }
+
+ override fun loginUser(username: kotlin.String, password: kotlin.String, ctx: Context): kotlin.String {
+ TODO("Implement me")
+ }
+
+ override fun logoutUser(ctx: Context): Unit {
+ TODO("Implement me")
+ }
+
+ override fun updateUser(username: kotlin.String, user: User, ctx: Context): Unit {
+ TODO("Implement me")
+ }
+}
diff --git a/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/models/Category.kt b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/models/Category.kt
new file mode 100644
index 00000000000..71098339bc8
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/models/Category.kt
@@ -0,0 +1,24 @@
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+*/
+package org.openapitools.server.models
+
+
+/**
+ * A category for a pet
+ * @param id
+ * @param name
+ */
+data class Category(
+ val id: kotlin.Long? = null,
+ val name: kotlin.String? = null
+)
+
diff --git a/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/models/ModelApiResponse.kt b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/models/ModelApiResponse.kt
new file mode 100644
index 00000000000..9e80c50c660
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/models/ModelApiResponse.kt
@@ -0,0 +1,26 @@
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+*/
+package org.openapitools.server.models
+
+
+/**
+ * Describes the result of uploading an image resource
+ * @param code
+ * @param type
+ * @param message
+ */
+data class ModelApiResponse(
+ val code: kotlin.Int? = null,
+ val type: kotlin.String? = null,
+ val message: kotlin.String? = null
+)
+
diff --git a/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/models/Order.kt b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/models/Order.kt
new file mode 100644
index 00000000000..be802beb8d8
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/models/Order.kt
@@ -0,0 +1,44 @@
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+*/
+package org.openapitools.server.models
+
+
+/**
+ * An order for a pets from the pet store
+ * @param id
+ * @param petId
+ * @param quantity
+ * @param shipDate
+ * @param status Order Status
+ * @param complete
+ */
+data class Order(
+ val id: kotlin.Long? = null,
+ val petId: kotlin.Long? = null,
+ val quantity: kotlin.Int? = null,
+ val shipDate: java.time.OffsetDateTime? = null,
+ /* Order Status */
+ val status: Order.Status? = null,
+ val complete: kotlin.Boolean? = false
+)
+{
+ /**
+ * Order Status
+ * Values: placed,approved,delivered
+ */
+ enum class Status(val value: kotlin.String){
+ placed("placed"),
+ approved("approved"),
+ delivered("delivered");
+ }
+}
+
diff --git a/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/models/Pet.kt b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/models/Pet.kt
new file mode 100644
index 00000000000..e5723fedd63
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/models/Pet.kt
@@ -0,0 +1,46 @@
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+*/
+package org.openapitools.server.models
+
+import org.openapitools.server.models.Category
+import org.openapitools.server.models.Tag
+
+/**
+ * A pet for sale in the pet store
+ * @param name
+ * @param photoUrls
+ * @param id
+ * @param category
+ * @param tags
+ * @param status pet status in the store
+ */
+data class Pet(
+ val name: kotlin.String,
+ val photoUrls: kotlin.collections.List,
+ val id: kotlin.Long? = null,
+ val category: Category? = null,
+ val tags: kotlin.collections.List? = null,
+ /* pet status in the store */
+ val status: Pet.Status? = null
+)
+{
+ /**
+ * pet status in the store
+ * Values: available,pending,sold
+ */
+ enum class Status(val value: kotlin.String){
+ available("available"),
+ pending("pending"),
+ sold("sold");
+ }
+}
+
diff --git a/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/models/Tag.kt b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/models/Tag.kt
new file mode 100644
index 00000000000..0a975290485
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/models/Tag.kt
@@ -0,0 +1,24 @@
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+*/
+package org.openapitools.server.models
+
+
+/**
+ * A tag for a pet
+ * @param id
+ * @param name
+ */
+data class Tag(
+ val id: kotlin.Long? = null,
+ val name: kotlin.String? = null
+)
+
diff --git a/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/models/User.kt b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/models/User.kt
new file mode 100644
index 00000000000..a4742582f46
--- /dev/null
+++ b/samples/server/petstore/kotlin-server/javalin-6/src/main/kotlin/org/openapitools/server/models/User.kt
@@ -0,0 +1,37 @@
+/**
+ * OpenAPI Petstore
+ * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+*/
+package org.openapitools.server.models
+
+
+/**
+ * A User who is purchasing from the pet store
+ * @param id
+ * @param username
+ * @param firstName
+ * @param lastName
+ * @param email
+ * @param password
+ * @param phone
+ * @param userStatus User Status
+ */
+data class User(
+ val id: kotlin.Long? = null,
+ val username: kotlin.String? = null,
+ val firstName: kotlin.String? = null,
+ val lastName: kotlin.String? = null,
+ val email: kotlin.String? = null,
+ val password: kotlin.String? = null,
+ val phone: kotlin.String? = null,
+ /* User Status */
+ val userStatus: kotlin.Int? = null
+)
+