Skip to content

Commit c350638

Browse files
committed
also add compile tests for interface_only to show multiline dollar escaping
1 parent f4a1cc5 commit c350638

29 files changed

+1868
-0
lines changed

.github/workflows/samples-kotlin-server-jdk17.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
- samples/server/petstore/kotlin-springboot-3
3939
- samples/server/petstore/kotlin-springboot-3-no-response-entity
4040
- samples/server/petstore/kotlin-springboot-3-dollar-issue-swagger2
41+
- samples/server/petstore/kotlin-springboot-3-dollar-issue-swagger2-interface-only
4142
- samples/server/petstore/kotlin-springboot-additionalproperties
4243
- samples/server/petstore/kotlin-springboot-delegate-nodefaults
4344
- samples/server/petstore/kotlin-springboot-request-cookie
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
generatorName: kotlin-spring
2+
outputDir: samples/server/petstore/kotlin-springboot-3-dollar-issue-swagger2-interface-only
3+
library: spring-boot
4+
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-dollars.yaml
5+
templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
6+
additionalProperties:
7+
documentationProvider: springDoc
8+
annotationLibrary: swagger2
9+
useSwaggerUI: "false"
10+
interfaceOnly: "true"
11+
serializableModel: "true"
12+
beanValidations: "true"
13+
useSpringBoot3: "true"
14+
requestMappingMode: api_interface
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.openapi-generator-ignore
2+
README.md
3+
build.gradle.kts
4+
gradle/wrapper/gradle-wrapper.jar
5+
gradle/wrapper/gradle-wrapper.properties
6+
gradlew
7+
gradlew.bat
8+
pom.xml
9+
settings.gradle
10+
src/main/kotlin/org/openapitools/SpringDocConfiguration.kt
11+
src/main/kotlin/org/openapitools/api/ApiUtil.kt
12+
src/main/kotlin/org/openapitools/api/Exceptions.kt
13+
src/main/kotlin/org/openapitools/api/ItemsApi.kt
14+
src/main/kotlin/org/openapitools/api/PetApi.kt
15+
src/main/kotlin/org/openapitools/api/StoreApi.kt
16+
src/main/kotlin/org/openapitools/api/UserApi.kt
17+
src/main/kotlin/org/openapitools/model/Category.kt
18+
src/main/kotlin/org/openapitools/model/ItemWithDollarAttributesAndExamples.kt
19+
src/main/kotlin/org/openapitools/model/ItemsItemIdSomethingItemSubIdGet200Response.kt
20+
src/main/kotlin/org/openapitools/model/ItemsItemIdSomethingItemSubIdGet200ResponseDetailsInfo.kt
21+
src/main/kotlin/org/openapitools/model/ModelApiResponse.kt
22+
src/main/kotlin/org/openapitools/model/Order.kt
23+
src/main/kotlin/org/openapitools/model/Pet.kt
24+
src/main/kotlin/org/openapitools/model/Tag.kt
25+
src/main/kotlin/org/openapitools/model/User.kt
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.18.0-SNAPSHOT
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# openAPIPetstore
2+
3+
This Kotlin based [Spring Boot](https://spring.io/projects/spring-boot) application has been generated using the [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator).
4+
5+
## Getting Started
6+
7+
This document assumes you have either maven or gradle available, either via the wrapper or otherwise. This does not come with a gradle / maven wrapper checked in.
8+
9+
By default a [`pom.xml`](pom.xml) file will be generated. If you specified `gradleBuildFile=true` when generating this project, a `build.gradle.kts` will also be generated. Note this uses [Gradle Kotlin DSL](https://github.com/gradle/kotlin-dsl).
10+
11+
To build the project using maven, run:
12+
```bash
13+
mvn package && java -jar target/openapi-spring-1.0.0.jar
14+
```
15+
16+
To build the project using gradle, run:
17+
```bash
18+
gradle build && java -jar build/libs/openapi-spring-1.0.0.jar
19+
```
20+
21+
If all builds successfully, the server should run on [http://localhost:8080/](http://localhost:8080/)
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
3+
group = "org.openapitools"
4+
version = "1.0.0"
5+
java.sourceCompatibility = JavaVersion.VERSION_17
6+
7+
repositories {
8+
mavenCentral()
9+
maven { url = uri("https://repo.spring.io/milestone") }
10+
}
11+
12+
tasks.withType<KotlinCompile> {
13+
kotlinOptions.jvmTarget = "17"
14+
}
15+
16+
tasks.bootJar {
17+
enabled = false
18+
}
19+
20+
plugins {
21+
val kotlinVersion = "1.9.25"
22+
id("org.jetbrains.kotlin.jvm") version kotlinVersion
23+
id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion
24+
id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion
25+
id("org.springframework.boot") version "3.0.2"
26+
id("io.spring.dependency-management") version "1.0.14.RELEASE"
27+
}
28+
29+
dependencies {
30+
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
31+
implementation("org.jetbrains.kotlin:kotlin-reflect")
32+
implementation("org.springframework.boot:spring-boot-starter-web")
33+
implementation("org.springdoc:springdoc-openapi-starter-webmvc-api:2.6.0")
34+
35+
implementation("com.google.code.findbugs:jsr305:3.0.2")
36+
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")
37+
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
38+
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
39+
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
40+
implementation("jakarta.validation:jakarta.validation-api")
41+
implementation("jakarta.annotation:jakarta.annotation-api:2.1.0")
42+
43+
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
44+
testImplementation("org.springframework.boot:spring-boot-starter-test") {
45+
exclude(module = "junit")
46+
}
47+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)