Skip to content
This repository was archived by the owner on Feb 9, 2021. It is now read-only.

Commit a00261d

Browse files
jminiwing328
authored andcommittedMay 9, 2018
Change default package name value for kotlin server (OpenAPITools#387)
* Update default package * Regenerate samples/server/petstore/kotlin-server/ktor * Update git ignore * Add CI
1 parent 5fb1660 commit a00261d

File tree

28 files changed

+363
-267
lines changed

28 files changed

+363
-267
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ effective.pom
176176
samples/client/petstore/kotlin/src/main/kotlin/test/
177177
samples/client/petstore/kotlin-threetenbp/build
178178
samples/client/petstore/kotlin-string/build
179+
samples/server/petstore/kotlin-server/ktor/build
179180
\?
180181

181182
# haskell

‎bin/kotlin-server-petstore.sh

+2
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/
3030
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-server -l kotlin-server --library=ktor -o samples/server/petstore/kotlin-server/ktor $@"
3131

3232
java ${JAVA_OPTS} -jar ${executable} ${ags}
33+
34+
cp samples.ci/server/petstore/kotlin-server/ktor/pom.xml samples/server/petstore/kotlin-server/ktor/pom.xml

‎modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinServerCodegen.java

+7-8
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,17 @@
1919

2020
import com.google.common.collect.ImmutableMap;
2121
import com.samskivert.mustache.Mustache;
22+
2223
import org.apache.commons.lang3.StringUtils;
2324
import org.openapitools.codegen.CliOption;
2425
import org.openapitools.codegen.CodegenConstants;
2526
import org.openapitools.codegen.CodegenType;
2627
import org.openapitools.codegen.SupportingFile;
27-
import org.openapitools.codegen.mustache.*;
28-
29-
import io.swagger.v3.oas.models.OpenAPI;
30-
import io.swagger.v3.oas.models.Operation;
31-
import io.swagger.v3.oas.models.media.*;
32-
import io.swagger.v3.oas.models.responses.ApiResponse;
33-
28+
import org.openapitools.codegen.mustache.CamelCaseLambda;
29+
import org.openapitools.codegen.mustache.IndentedLambda;
30+
import org.openapitools.codegen.mustache.LowercaseLambda;
31+
import org.openapitools.codegen.mustache.TitlecaseLambda;
32+
import org.openapitools.codegen.mustache.UppercaseLambda;
3433
import org.slf4j.Logger;
3534
import org.slf4j.LoggerFactory;
3635

@@ -67,7 +66,7 @@ public KotlinServerCodegen() {
6766
super();
6867

6968
artifactId = "kotlin-server";
70-
packageName = "io.swagger.server";
69+
packageName = "org.openapitools.server";
7170
outputFolder = "generated-code" + File.separator + "kotlin-server";
7271
modelTemplateFiles.put("model.mustache", ".kt");
7372
apiTemplateFiles.put("api.mustache", ".kt");

‎pom.xml.circleci

+1
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,7 @@
905905
<module>samples/server/petstore/jaxrs-resteasy/eap-joda</module>
906906
<module>samples/server/petstore/jaxrs-resteasy/eap-java8</module>
907907
<module>samples/server/petstore/jaxrs-resteasy/joda</module>
908+
<module>samples/server/petstore/kotlin-server/ktor</module>
908909
<module>samples/server/petstore/spring-mvc</module>
909910
<module>samples/server/petstore/spring-mvc-j8-async</module>
910911
<module>samples/server/petstore/spring-mvc-j8-localdatetime</module>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<project>
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>org.openapitools</groupId>
4+
<artifactId>KotlinPetstoreKtorTests</artifactId>
5+
<packaging>pom</packaging>
6+
<version>1.0-SNAPSHOT</version>
7+
<name>kotlin-server-ktor</name>
8+
<build>
9+
<plugins>
10+
<plugin>
11+
<artifactId>maven-dependency-plugin</artifactId>
12+
<executions>
13+
<execution>
14+
<phase>package</phase>
15+
<goals>
16+
<goal>copy-dependencies</goal>
17+
</goals>
18+
<configuration>
19+
<outputDirectory>${project.build.directory}</outputDirectory>
20+
</configuration>
21+
</execution>
22+
</executions>
23+
</plugin>
24+
<plugin>
25+
<groupId>org.codehaus.mojo</groupId>
26+
<artifactId>exec-maven-plugin</artifactId>
27+
<version>1.2.1</version>
28+
<executions>
29+
<execution>
30+
<id>bundle-test</id>
31+
<phase>integration-test</phase>
32+
<goals>
33+
<goal>exec</goal>
34+
</goals>
35+
<configuration>
36+
<executable>gradle</executable>
37+
<arguments>
38+
<argument>test</argument>
39+
</arguments>
40+
</configuration>
41+
</execution>
42+
</executions>
43+
</plugin>
44+
</plugins>
45+
</build>
46+
</project>

‎samples/server/petstore/kotlin-server/ktor/.gitignore

-4
This file was deleted.

‎samples/server/petstore/kotlin-server/ktor/.openapi-generator-ignore

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Swagger Codegen Ignore
2-
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
33

44
# Use this file to prevent files from being overwritten by the generator.
55
# The patterns follow closely to .gitignore or .dockerignore.
66

77
# As an example, the C# client generator defines ApiClient.cs.
8-
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
99
#ApiClient.cs
1010

1111
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0
1+
3.0.0-SNAPSHOT

‎samples/server/petstore/kotlin-server/ktor/README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# io.swagger.server - Kotlin Server library for Swagger Petstore
1+
# org.openapitools.server - Kotlin Server library for OpenAPI Petstore
22

3-
This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key &#x60;special-key&#x60; to test the authorization filters.
3+
This is a sample server Petstore server. For this sample, you can use the api key &#x60;special-key&#x60; to test the authorization filters.
44

5-
Generated by Swagger Codegen 2.3.0 (2018-01-21T22:11:17.518-05:00).
5+
Generated by OpenAPI Generator 3.0.0-SNAPSHOT (2018-05-09T05:00:11.354+02:00[Europe/Zurich]).
66

77
## Requires
88

@@ -40,7 +40,7 @@ docker run -p 8080:8080 kotlin-server
4040

4141
* Supports JSON inputs/outputs, File inputs, and Form inputs (see ktor documentation for more info).
4242
* ~Supports collection formats for query parameters: csv, tsv, ssv, pipes.~
43-
* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in Swagger definitions.
43+
* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions.
4444

4545
<a name="documentation-for-api-endpoints"></a>
4646
## Documentation for API Endpoints
@@ -74,12 +74,12 @@ Class | Method | HTTP request | Description
7474
<a name="documentation-for-models"></a>
7575
## Documentation for Models
7676

77-
- [io.swagger.server.models.ApiResponse](docs/ApiResponse.md)
78-
- [io.swagger.server.models.Category](docs/Category.md)
79-
- [io.swagger.server.models.Order](docs/Order.md)
80-
- [io.swagger.server.models.Pet](docs/Pet.md)
81-
- [io.swagger.server.models.Tag](docs/Tag.md)
82-
- [io.swagger.server.models.User](docs/User.md)
77+
- [org.openapitools.server.models.ApiResponse](docs/ApiResponse.md)
78+
- [org.openapitools.server.models.Category](docs/Category.md)
79+
- [org.openapitools.server.models.Order](docs/Order.md)
80+
- [org.openapitools.server.models.Pet](docs/Pet.md)
81+
- [org.openapitools.server.models.Tag](docs/Tag.md)
82+
- [org.openapitools.server.models.User](docs/User.md)
8383

8484

8585
<a name="documentation-for-authorization"></a>

‎samples/server/petstore/kotlin-server/ktor/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
group 'io.swagger'
1+
group 'org.openapitools'
22
version '1.0.0'
33

44
task wrapper(type: Wrapper) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<project>
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>org.openapitools</groupId>
4+
<artifactId>KotlinPetstoreKtorTests</artifactId>
5+
<packaging>pom</packaging>
6+
<version>1.0-SNAPSHOT</version>
7+
<name>kotlin-server-ktor</name>
8+
<build>
9+
<plugins>
10+
<plugin>
11+
<artifactId>maven-dependency-plugin</artifactId>
12+
<executions>
13+
<execution>
14+
<phase>package</phase>
15+
<goals>
16+
<goal>copy-dependencies</goal>
17+
</goals>
18+
<configuration>
19+
<outputDirectory>${project.build.directory}</outputDirectory>
20+
</configuration>
21+
</execution>
22+
</executions>
23+
</plugin>
24+
<plugin>
25+
<groupId>org.codehaus.mojo</groupId>
26+
<artifactId>exec-maven-plugin</artifactId>
27+
<version>1.2.1</version>
28+
<executions>
29+
<execution>
30+
<id>bundle-test</id>
31+
<phase>integration-test</phase>
32+
<goals>
33+
<goal>exec</goal>
34+
</goals>
35+
<configuration>
36+
<executable>gradle</executable>
37+
<arguments>
38+
<argument>test</argument>
39+
</arguments>
40+
</configuration>
41+
</execution>
42+
</executions>
43+
</plugin>
44+
</plugins>
45+
</build>
46+
</project>

‎samples/server/petstore/kotlin-server/ktor/src/main/kotlin/io/swagger/server/models/ApiResponse.kt

-28
This file was deleted.

‎samples/server/petstore/kotlin-server/ktor/src/main/kotlin/io/swagger/server/models/Category.kt

-26
This file was deleted.

‎samples/server/petstore/kotlin-server/ktor/src/main/kotlin/io/swagger/server/models/Tag.kt

-26
This file was deleted.

‎samples/server/petstore/kotlin-server/ktor/src/main/kotlin/io/swagger/server/AppMain.kt ‎samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/AppMain.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.swagger.server
1+
package org.openapitools.server
22

33
import com.codahale.metrics.*
44
import com.typesafe.config.ConfigFactory
@@ -13,7 +13,7 @@ import io.ktor.locations.*
1313
import io.ktor.metrics.*
1414
import io.ktor.routing.*
1515
import java.util.concurrent.*
16-
import io.swagger.server.apis.*
16+
import org.openapitools.server.apis.*
1717

1818

1919
internal val settings = HoconApplicationConfig(ConfigFactory.defaultApplication(HTTP::class.java.classLoader))

‎samples/server/petstore/kotlin-server/ktor/src/main/kotlin/io/swagger/server/Configuration.kt ‎samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/Configuration.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.swagger.server
1+
package org.openapitools.server
22

33
// Use this file to hold package-level internal functions that return receiver object passed to the `install` method.
44
import io.ktor.auth.OAuthServerSettings
@@ -7,13 +7,13 @@ import io.ktor.http.*
77
import java.time.Duration
88
import java.util.concurrent.Executors
99

10-
import io.swagger.server.settings
10+
import org.openapitools.server.settings
1111

1212

1313
/**
1414
* Application block for [HSTS] configuration.
1515
*
16-
* This file may be excluded in .swagger-codegen-ignore,
16+
* This file may be excluded in .openapi-generator-ignore,
1717
* and application specific configuration can be applied in this function.
1818
*
1919
* See http://ktor.io/features/hsts.html
@@ -32,7 +32,7 @@ internal fun ApplicationHstsConfiguration(): HSTS.Configuration.() -> Unit {
3232
/**
3333
* Application block for [Compression] configuration.
3434
*
35-
* This file may be excluded in .swagger-codegen-ignore,
35+
* This file may be excluded in .openapi-generator-ignore,
3636
* and application specific configuration can be applied in this function.
3737
*
3838
* See http://ktor.io/features/compression.html

‎samples/server/petstore/kotlin-server/ktor/src/main/kotlin/io/swagger/server/Paths.kt ‎samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/Paths.kt

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
/**
2-
* Swagger Petstore
3-
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
2+
* OpenAPI Petstore
3+
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
44
*
55
* OpenAPI spec version: 1.0.0
6-
* Contact: apiteam@swagger.io
6+
*
77
*
8-
* NOTE: This class is auto generated by the swagger code generator program.
9-
* https://github.com/swagger-api/swagger-codegen.git
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
1010
* Do not edit the class manually.
1111
*/
12-
package io.swagger.server
12+
package org.openapitools.server
1313

1414
import io.ktor.application.ApplicationCall
1515
import io.ktor.http.HttpMethod
1616
import io.ktor.locations.*
1717
import io.ktor.pipeline.PipelineContext
1818
import io.ktor.routing.Route
1919
import io.ktor.routing.method
20-
import io.swagger.server.models.*
20+
import org.openapitools.server.models.*
2121

2222

2323
// NOTE: ktor-location@0.9.0 is missing extension for Route.delete. This includes it.
@@ -89,7 +89,7 @@ object Paths {
8989
/**
9090
* Get user by user name
9191
*
92-
* @param username The name that needs to be fetched. Use user1 for testing.
92+
* @param username The name that needs to be fetched. Use user1 for testing.
9393
*/
9494
@Location("/user/{username}") class getUserByName(val username: kotlin.String)
9595

0 commit comments

Comments
 (0)
This repository has been archived.