[Kotlin][Server] Skip new post processing routine for kotlin server jaxrs (#18180)

* Skip post processing when generating JAXRS spec with Kotlin
This feature was previously added to work with the javalin5 library

* Add sample that proves what we expect after fixing this

* Update sample

* Added new samples to samples workflow

* Revert from jdk17 pipeline
This commit is contained in:
Sondre Eikanger Kvalø
2024-03-21 08:55:28 +01:00
committed by GitHub
parent e39b99051c
commit c7e9bd2f29
14 changed files with 328 additions and 5 deletions

View File

@@ -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

View File

@@ -0,0 +1,6 @@
README.md
build.gradle
gradle.properties
settings.gradle
src/main/kotlin/org/openapitools/server/apis/StuffApi.kt
src/main/kotlin/org/openapitools/server/models/Stuff.kt

View File

@@ -0,0 +1,56 @@
# org.openapitools.server - Kotlin Server library for OpenAPI Stuff API created to reproduce issue
## Requires
* Kotlin 1.4.31
* Gradle 6.8.2
## Build
First, create the gradle wrapper script:
```
gradle wrapper
```
Then, run:
```
./gradlew check assemble
```
This runs all tests and packages the library.
## Features/Implementation Notes
* Supports JSON inputs/outputs, File inputs, and Form inputs.
* 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.
<a id="documentation-for-api-endpoints"></a>
## Documentation for API Endpoints
All URIs are relative to *https://example.org/v1*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*StuffApi* | [**findStuff**](docs/StuffApi.md#findstuff) | **GET** /stuff | Finds stuff
*StuffApi* | [**findUniqueStuff**](docs/StuffApi.md#finduniquestuff) | **GET** /uniquestuff | Finds unique stuff
<a id="documentation-for-models"></a>
## Documentation for Models
- [org.openapitools.server.models.Stuff](docs/Stuff.md)
<a id="documentation-for-authorization"></a>
## Documentation for Authorization
Authentication schemes defined for the API:
<a id="bearerAuth"></a>
### bearerAuth
- **Type**: HTTP Bearer Token authentication (JWT)

View File

@@ -0,0 +1,51 @@
group "org.openapitools"
version "1.0.0"
wrapper {
gradleVersion = '6.9'
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}
buildscript {
ext.kotlin_version = "1.7.20"
ext.swagger_annotations_version = "1.5.3"
ext.jakarta_annotations_version = "2.1.1"
ext.jakarta_ws_rs_version = "3.1.0"
ext.jackson_version = "2.9.9"
repositories {
maven { url "https://repo1.maven.org/maven2" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
}
}
apply plugin: "java"
apply plugin: "kotlin"
apply plugin: "application"
sourceCompatibility = 1.8
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
repositories {
maven { setUrl("https://repo1.maven.org/maven2") }
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version")
implementation("ch.qos.logback:logback-classic:1.2.1")
implementation("jakarta.ws.rs:jakarta.ws.rs-api:$jakarta_ws_rs_version")
implementation("jakarta.annotation:jakarta.annotation-api:$jakarta_annotations_version")
implementation("io.swagger:swagger-annotations:$swagger_annotations_version")
implementation("com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version")
testImplementation("junit:junit:4.13.2")
}

View File

@@ -0,0 +1 @@
org.gradle.caching=true

View File

@@ -0,0 +1 @@
rootProject.name = 'kotlin-server'

View File

@@ -0,0 +1,26 @@
package org.openapitools.server.apis;
import org.openapitools.server.models.Stuff
import jakarta.ws.rs.*
import jakarta.ws.rs.core.Response
import java.io.InputStream
@Path("/")
@jakarta.annotation.Generated(value = arrayOf("org.openapitools.codegen.languages.KotlinServerCodegen"), comments = "Generator version: 7.5.0-SNAPSHOT")
interface StuffApi {
@GET
@Path("/stuff")
@Produces("application/json")
fun findStuff(): kotlin.collections.List<Stuff>
@GET
@Path("/uniquestuff")
@Produces("application/json")
fun findUniqueStuff(): kotlin.collections.Set<Stuff>
}

View File

@@ -0,0 +1,39 @@
/**
* OpenAPI Stuff API created to reproduce issue
* Example created
*
* 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 com.fasterxml.jackson.annotation.JsonProperty
/**
*
*
* @param name
* @param id
* @param tag
*/
data class Stuff (
@JsonProperty("name")
val name: kotlin.String,
@JsonProperty("id")
val id: kotlin.Long? = null,
@JsonProperty("tag")
val tag: kotlin.String? = null
)