diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java index f1bf1da7301..ba566c39e8f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java @@ -597,10 +597,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co private String sanitizeKotlinSpecificNames(final String name) { String word = name; for (Map.Entry specialCharacters : specialCharReplacements.entrySet()) { - // Underscore is the only special character we'll allow - if (!specialCharacters.getKey().equals("_")) { - word = word.replaceAll("\\Q" + specialCharacters.getKey() + "\\E", specialCharacters.getValue()); - } + word = replaceSpecialCharacters(word, specialCharacters); } // Fallback, replace unknowns with underscore. @@ -617,6 +614,38 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co return word; } + private String replaceSpecialCharacters(String word, Map.Entry specialCharacters) { + String specialChar = specialCharacters.getKey(); + String replacementChar = specialCharacters.getValue(); + // Underscore is the only special character we'll allow + if (!specialChar.equals("_") && word.contains(specialChar)) { + return replaceCharacters(word, specialChar, replacementChar); + } + return word; + } + + private String replaceCharacters(String word, String oldValue, String newValue) { + if (!word.contains(oldValue)) { + return word; + } + if ( word.equals(oldValue)) { + return newValue; + } + int i = word.indexOf(oldValue); + String start = word.substring(0, i); + String end = recurseOnEndOfWord(word, oldValue, newValue, i); + return start + newValue + end; + } + + private String recurseOnEndOfWord(String word, String oldValue, String newValue, int lastReplacedValue) { + String end = word.substring(lastReplacedValue + 1); + if (!end.isEmpty()) { + end = titleCase(end); + end = replaceCharacters(end, oldValue, newValue); + } + return end; + } + private String titleCase(final String input) { return input.substring(0, 1).toUpperCase(Locale.ROOT) + input.substring(1); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/StringUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/StringUtils.java index 47679a6f8f2..c3035fabc21 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/StringUtils.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/StringUtils.java @@ -15,22 +15,22 @@ public class StringUtils { * @param word The word * @return The underscored version of the word */ - public static String underscore(String word) { + public static String underscore(final String word) { String firstPattern = "([A-Z]+)([A-Z][a-z])"; String secondPattern = "([a-z\\d])([A-Z])"; String replacementPattern = "$1_$2"; // Replace package separator with slash. - word = word.replaceAll("\\.", "/"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. + String result = word.replaceAll("\\.", "/"); // Replace $ with two underscores for inner classes. - word = word.replaceAll("\\$", "__"); + result = result.replaceAll("\\$", "__"); // Replace capital letter with _ plus lowercase letter. - word = word.replaceAll(firstPattern, replacementPattern); - word = word.replaceAll(secondPattern, replacementPattern); - word = word.replace('-', '_'); + result = result.replaceAll(firstPattern, replacementPattern); + result = result.replaceAll(secondPattern, replacementPattern); + result = result.replace('-', '_'); // replace space with underscore - word = word.replace(' ', '_'); - word = word.toLowerCase(Locale.ROOT); - return word; + result = result.replace(' ', '_'); + result = result.toLowerCase(Locale.ROOT); + return result; } /** diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/AbstractKotlinCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/AbstractKotlinCodegenTest.java index 6b1690ed7f3..d746d2707fc 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/AbstractKotlinCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/AbstractKotlinCodegenTest.java @@ -85,17 +85,24 @@ public class AbstractKotlinCodegenTest { } @Test - public void toModelNameShouldUseProvidedMapping() throws Exception { + public void toModelNameShouldUseProvidedMapping() { codegen.importMapping().put("json_myclass", "com.test.MyClass"); assertEquals("com.test.MyClass", codegen.toModelName("json_myclass")); } @Test - public void convertModelName() throws Exception { + public void convertModelNameTitleCase() { assertEquals(codegen.toModelName("name"), "Name"); - assertEquals(codegen.toModelName("$name"), "Dollarname"); - assertEquals(codegen.toModelName("nam#e"), "NamHashe"); - assertEquals(codegen.toModelName("$another-fake?"), "DollaranotherMinusfakeQuestionMark"); } + @Test + public void escapeSpecialCharactersCamelize() { + assertEquals(codegen.toModelName("$"), "Dollar"); + assertEquals(codegen.toModelName("$$"), "DollarDollar"); + assertEquals(codegen.toModelName("Pony?"), "PonyQuestionMark"); + assertEquals(codegen.toModelName("$name"), "DollarName"); + assertEquals(codegen.toModelName("nam#e"), "NamHashE"); + assertEquals(codegen.toModelName("$another-fake?"), "DollarAnotherMinusFakeQuestionMark"); + assertEquals(codegen.toModelName("Pony>=>="), "PonyGreaterThanEqualGreaterThanEqual"); + } } \ No newline at end of file diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/StringUtilsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/StringUtilsTest.java index 83a8264f730..6b78990080c 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/StringUtilsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/StringUtilsTest.java @@ -5,9 +5,15 @@ import org.testng.annotations.Test; import static org.openapitools.codegen.utils.StringUtils.camelize; import static org.openapitools.codegen.utils.StringUtils.dashize; +import static org.openapitools.codegen.utils.StringUtils.underscore; public class StringUtilsTest { // we'll assume that underscore (Twitter elephant bird) works fine + @Test + public void testUnderscore() { + Assert.assertEquals(underscore("abcd"), "abcd"); + Assert.assertEquals(underscore("abCd"), "ab_cd"); + } @Test public void testCamelize() throws Exception { diff --git a/samples/openapi3/client/petstore/kotlin/README.md b/samples/openapi3/client/petstore/kotlin/README.md index daacb0a7c9e..d4d33f303f1 100644 --- a/samples/openapi3/client/petstore/kotlin/README.md +++ b/samples/openapi3/client/petstore/kotlin/README.md @@ -37,6 +37,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags *DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooget) | **GET** /foo | +*FakeApi* | [**fakeHealthGet**](docs/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint *FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | *FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | *FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | @@ -95,6 +96,7 @@ Class | Method | HTTP request | Description - [org.openapitools.client.models.Foo](docs/Foo.md) - [org.openapitools.client.models.FormatTest](docs/FormatTest.md) - [org.openapitools.client.models.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [org.openapitools.client.models.HealthCheckResult](docs/HealthCheckResult.md) - [org.openapitools.client.models.InlineObject](docs/InlineObject.md) - [org.openapitools.client.models.InlineObject1](docs/InlineObject1.md) - [org.openapitools.client.models.InlineObject2](docs/InlineObject2.md) @@ -111,6 +113,9 @@ Class | Method | HTTP request | Description - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.OuterComposite](docs/OuterComposite.md) - [org.openapitools.client.models.OuterEnum](docs/OuterEnum.md) + - [org.openapitools.client.models.OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md) + - [org.openapitools.client.models.OuterEnumInteger](docs/OuterEnumInteger.md) + - [org.openapitools.client.models.OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md) - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.ReadOnlyFirst](docs/ReadOnlyFirst.md) - [org.openapitools.client.models.Return](docs/Return.md) @@ -136,6 +141,11 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key_query - **Location**: URL query string + +### bearer_test + +- **Type**: HTTP basic authentication + ### http_basic_test diff --git a/samples/openapi3/client/petstore/kotlin/docs/200_response.md b/samples/openapi3/client/petstore/kotlin/docs/200Response.md similarity index 100% rename from samples/openapi3/client/petstore/kotlin/docs/200_response.md rename to samples/openapi3/client/petstore/kotlin/docs/200Response.md diff --git a/samples/openapi3/client/petstore/kotlin/docs/EnumClass.md b/samples/openapi3/client/petstore/kotlin/docs/EnumClass.md index 2e0d71dd32a..5ddb262871f 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/EnumClass.md +++ b/samples/openapi3/client/petstore/kotlin/docs/EnumClass.md @@ -6,9 +6,9 @@ * `abc` (value: `"_abc"`) - * `minusefg` (value: `"-efg"`) + * `minusEfg` (value: `"-efg"`) - * `leftParenthesisxyzRightParenthesis` (value: `"(xyz)"`) + * `leftParenthesisXyzRightParenthesis` (value: `"(xyz)"`) diff --git a/samples/openapi3/client/petstore/kotlin/docs/Enum_Test.md b/samples/openapi3/client/petstore/kotlin/docs/EnumTest.md similarity index 74% rename from samples/openapi3/client/petstore/kotlin/docs/Enum_Test.md rename to samples/openapi3/client/petstore/kotlin/docs/EnumTest.md index 2a6f786342e..bdef500a433 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/Enum_Test.md +++ b/samples/openapi3/client/petstore/kotlin/docs/EnumTest.md @@ -9,6 +9,9 @@ Name | Type | Description | Notes **enumInteger** | [**inline**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**inline**](#EnumNumberEnum) | | [optional] **outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] +**outerEnumInteger** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] +**outerEnumDefaultValue** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] +**outerEnumIntegerDefaultValue** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] diff --git a/samples/openapi3/client/petstore/kotlin/docs/FakeApi.md b/samples/openapi3/client/petstore/kotlin/docs/FakeApi.md index 5c438004a9a..52d0b1f0fb9 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/kotlin/docs/FakeApi.md @@ -4,6 +4,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | @@ -18,6 +19,47 @@ Method | HTTP request | Description [**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data + +# **fakeHealthGet** +> HealthCheckResult fakeHealthGet() + +Health check endpoint + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = FakeApi() +try { + val result : HealthCheckResult = apiInstance.fakeHealthGet() + println(result) +} catch (e: ClientException) { + println("4xx response calling FakeApi#fakeHealthGet") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling FakeApi#fakeHealthGet") + e.printStackTrace() +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + # **fakeOuterBooleanSerialize** > kotlin.Boolean fakeOuterBooleanSerialize(body) @@ -127,7 +169,7 @@ Test serialization of outer number types //import org.openapitools.client.models.* val apiInstance = FakeApi() -val body : java.math.BigDecimal = 1.2 // java.math.BigDecimal | Input number as post body +val body : java.math.BigDecimal = 8.14 // java.math.BigDecimal | Input number as post body try { val result : java.math.BigDecimal = apiInstance.fakeOuterNumberSerialize(body) println(result) @@ -360,7 +402,7 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン //import org.openapitools.client.models.* val apiInstance = FakeApi() -val number : java.math.BigDecimal = 1.2 // java.math.BigDecimal | None +val number : java.math.BigDecimal = 8.14 // java.math.BigDecimal | None val double : kotlin.Double = 1.2 // kotlin.Double | None val patternWithoutDelimiter : kotlin.String = patternWithoutDelimiter_example // kotlin.String | None val byte : kotlin.ByteArray = BYTE_ARRAY_DATA_HERE // kotlin.ByteArray | None @@ -526,7 +568,7 @@ null (empty response body) ### Authorization -No authorization required +[bearer_test](../README.md#bearer_test) ### HTTP request headers diff --git a/samples/openapi3/client/petstore/kotlin/docs/Format_test.md b/samples/openapi3/client/petstore/kotlin/docs/FormatTest.md similarity index 100% rename from samples/openapi3/client/petstore/kotlin/docs/Format_test.md rename to samples/openapi3/client/petstore/kotlin/docs/FormatTest.md diff --git a/samples/openapi3/client/petstore/kotlin/docs/HealthCheckResult.md b/samples/openapi3/client/petstore/kotlin/docs/HealthCheckResult.md new file mode 100644 index 00000000000..472dc310457 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/docs/HealthCheckResult.md @@ -0,0 +1,10 @@ + +# HealthCheckResult + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nullableMessage** | **kotlin.String** | | [optional] + + + diff --git a/samples/openapi3/client/petstore/kotlin/docs/Inline_object.md b/samples/openapi3/client/petstore/kotlin/docs/InlineObject.md similarity index 100% rename from samples/openapi3/client/petstore/kotlin/docs/Inline_object.md rename to samples/openapi3/client/petstore/kotlin/docs/InlineObject.md diff --git a/samples/openapi3/client/petstore/kotlin/docs/Inline_object_1.md b/samples/openapi3/client/petstore/kotlin/docs/InlineObject1.md similarity index 100% rename from samples/openapi3/client/petstore/kotlin/docs/Inline_object_1.md rename to samples/openapi3/client/petstore/kotlin/docs/InlineObject1.md diff --git a/samples/openapi3/client/petstore/kotlin/docs/Inline_object_2.md b/samples/openapi3/client/petstore/kotlin/docs/InlineObject2.md similarity index 100% rename from samples/openapi3/client/petstore/kotlin/docs/Inline_object_2.md rename to samples/openapi3/client/petstore/kotlin/docs/InlineObject2.md diff --git a/samples/openapi3/client/petstore/kotlin/docs/Inline_object_3.md b/samples/openapi3/client/petstore/kotlin/docs/InlineObject3.md similarity index 100% rename from samples/openapi3/client/petstore/kotlin/docs/Inline_object_3.md rename to samples/openapi3/client/petstore/kotlin/docs/InlineObject3.md diff --git a/samples/openapi3/client/petstore/kotlin/docs/Inline_object_4.md b/samples/openapi3/client/petstore/kotlin/docs/InlineObject4.md similarity index 100% rename from samples/openapi3/client/petstore/kotlin/docs/Inline_object_4.md rename to samples/openapi3/client/petstore/kotlin/docs/InlineObject4.md diff --git a/samples/openapi3/client/petstore/kotlin/docs/Inline_object_5.md b/samples/openapi3/client/petstore/kotlin/docs/InlineObject5.md similarity index 100% rename from samples/openapi3/client/petstore/kotlin/docs/Inline_object_5.md rename to samples/openapi3/client/petstore/kotlin/docs/InlineObject5.md diff --git a/samples/openapi3/client/petstore/kotlin/docs/Inline_response_default.md b/samples/openapi3/client/petstore/kotlin/docs/InlineResponseDefault.md similarity index 100% rename from samples/openapi3/client/petstore/kotlin/docs/Inline_response_default.md rename to samples/openapi3/client/petstore/kotlin/docs/InlineResponseDefault.md diff --git a/samples/openapi3/client/petstore/kotlin/docs/OuterEnumDefaultValue.md b/samples/openapi3/client/petstore/kotlin/docs/OuterEnumDefaultValue.md new file mode 100644 index 00000000000..821d297a001 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/docs/OuterEnumDefaultValue.md @@ -0,0 +1,14 @@ + +# OuterEnumDefaultValue + +## Enum + + + * `placed` (value: `"placed"`) + + * `approved` (value: `"approved"`) + + * `delivered` (value: `"delivered"`) + + + diff --git a/samples/openapi3/client/petstore/kotlin/docs/OuterEnumInteger.md b/samples/openapi3/client/petstore/kotlin/docs/OuterEnumInteger.md new file mode 100644 index 00000000000..b40f6e4b7ef --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/docs/OuterEnumInteger.md @@ -0,0 +1,14 @@ + +# OuterEnumInteger + +## Enum + + + * `_0` (value: `0`) + + * `_1` (value: `1`) + + * `_2` (value: `2`) + + + diff --git a/samples/openapi3/client/petstore/kotlin/docs/OuterEnumIntegerDefaultValue.md b/samples/openapi3/client/petstore/kotlin/docs/OuterEnumIntegerDefaultValue.md new file mode 100644 index 00000000000..c2fb3ee41d7 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/docs/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,14 @@ + +# OuterEnumIntegerDefaultValue + +## Enum + + + * `_0` (value: `0`) + + * `_1` (value: `1`) + + * `_2` (value: `2`) + + + diff --git a/samples/openapi3/client/petstore/kotlin/docs/_special_model.name_.md b/samples/openapi3/client/petstore/kotlin/docs/SpecialModelName.md similarity index 100% rename from samples/openapi3/client/petstore/kotlin/docs/_special_model.name_.md rename to samples/openapi3/client/petstore/kotlin/docs/SpecialModelName.md diff --git a/samples/openapi3/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.jar b/samples/openapi3/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 1948b9074f1..00000000000 Binary files a/samples/openapi3/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/samples/openapi3/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.properties b/samples/openapi3/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 687a5966702..00000000000 --- a/samples/openapi3/client/petstore/kotlin/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/samples/openapi3/client/petstore/kotlin/gradlew b/samples/openapi3/client/petstore/kotlin/gradlew deleted file mode 100755 index cccdd3d517f..00000000000 --- a/samples/openapi3/client/petstore/kotlin/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/samples/openapi3/client/petstore/kotlin/gradlew.bat b/samples/openapi3/client/petstore/kotlin/gradlew.bat deleted file mode 100644 index e95643d6a2c..00000000000 --- a/samples/openapi3/client/petstore/kotlin/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt index 4d41d10c221..89785dfbbee 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt @@ -13,6 +13,7 @@ package org.openapitools.client.apis import org.openapitools.client.models.Client import org.openapitools.client.models.FileSchemaTestClass +import org.openapitools.client.models.HealthCheckResult import org.openapitools.client.models.OuterComposite import org.openapitools.client.models.User @@ -20,6 +21,37 @@ import org.openapitools.client.infrastructure.* class FakeApi(basePath: kotlin.String = "http://petstore.swagger.io:80/v2") : ApiClient(basePath) { + /** + * Health check endpoint + * + * @return HealthCheckResult + */ + @Suppress("UNCHECKED_CAST") + fun fakeHealthGet() : HealthCheckResult { + val localVariableBody: kotlin.Any? = null + val localVariableQuery: MultiValueMap = mapOf() + val localVariableHeaders: kotlin.collections.Map = mapOf() + val localVariableConfig = RequestConfig( + RequestMethod.GET, + "/fake/health", + query = localVariableQuery, + headers = localVariableHeaders + ) + val response = request( + localVariableConfig, + localVariableBody + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as HealthCheckResult + ResponseType.Informational -> TODO() + ResponseType.Redirection -> TODO() + ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") + ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") + else -> throw kotlin.IllegalStateException("Undefined ResponseType.") + } + } + /** * * Test serialization of outer boolean types diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index fa6f15fbd05..9e79028a90b 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -60,7 +60,9 @@ open class ApiClient(val baseUrl: String) { fun toJson(uuid: UUID) = uuid.toString() @FromJson fun fromJson(s: String) = UUID.fromString(s) - }).build().adapter(T::class.java).fromJson(body.source()) + }) + .add(ByteArrayAdapter()) + .build().adapter(T::class.java).fromJson(body.source()) else -> TODO() } } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt new file mode 100644 index 00000000000..617ac3fe906 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -0,0 +1,12 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson + +class ByteArrayAdapter { + @ToJson + fun toJson(data: ByteArray): String = String(data) + + @FromJson + fun fromJson(data: String): ByteArray = data.toByteArray() +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumClass.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumClass.kt index 55ef4cb64d5..64030e0d539 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumClass.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumClass.kt @@ -16,15 +16,15 @@ import com.squareup.moshi.Json /** * -* Values: abc,minusefg,leftParenthesisxyzRightParenthesis +* Values: abc,minusEfg,leftParenthesisXyzRightParenthesis */ enum class EnumClass(val value: kotlin.String){ @Json(name = "_abc") abc("_abc"), - @Json(name = "-efg") minusefg("-efg"), + @Json(name = "-efg") minusEfg("-efg"), - @Json(name = "(xyz)") leftParenthesisxyzRightParenthesis("(xyz)"); + @Json(name = "(xyz)") leftParenthesisXyzRightParenthesis("(xyz)"); } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumTest.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumTest.kt index 5d0599c4cf7..a124fce0669 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumTest.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/EnumTest.kt @@ -12,6 +12,9 @@ package org.openapitools.client.models import org.openapitools.client.models.OuterEnum +import org.openapitools.client.models.OuterEnumDefaultValue +import org.openapitools.client.models.OuterEnumInteger +import org.openapitools.client.models.OuterEnumIntegerDefaultValue import com.squareup.moshi.Json /** @@ -21,13 +24,19 @@ import com.squareup.moshi.Json * @param enumInteger * @param enumNumber * @param outerEnum + * @param outerEnumInteger + * @param outerEnumDefaultValue + * @param outerEnumIntegerDefaultValue */ data class EnumTest ( val enumStringRequired: EnumTest.EnumStringRequired, val enumString: EnumTest.EnumString? = null, val enumInteger: EnumTest.EnumInteger? = null, val enumNumber: EnumTest.EnumNumber? = null, - val outerEnum: OuterEnum? = null + val outerEnum: OuterEnum? = null, + val outerEnumInteger: OuterEnumInteger? = null, + val outerEnumDefaultValue: OuterEnumDefaultValue? = null, + val outerEnumIntegerDefaultValue: OuterEnumIntegerDefaultValue? = null ) { /** diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt new file mode 100644 index 00000000000..d8f7ec1fb8a --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt @@ -0,0 +1,24 @@ +/** +* OpenAPI Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 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.client.models + + +/** + * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + * @param nullableMessage + */ +data class HealthCheckResult ( + val nullableMessage: kotlin.String? = null +) { + +} + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject2.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject2.kt index 4db5fcee75a..1e08e601172 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject2.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/InlineObject2.kt @@ -39,15 +39,15 @@ data class InlineObject2 ( /** * Form parameter enum test (string) - * Values: abc,minusefg,leftParenthesisxyzRightParenthesis + * Values: abc,minusEfg,leftParenthesisXyzRightParenthesis */ enum class EnumFormString(val value: kotlin.String){ @Json(name = "_abc") abc("_abc"), - @Json(name = "-efg") minusefg("-efg"), + @Json(name = "-efg") minusEfg("-efg"), - @Json(name = "(xyz)") leftParenthesisxyzRightParenthesis("(xyz)"); + @Json(name = "(xyz)") leftParenthesisXyzRightParenthesis("(xyz)"); } diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumDefaultValue.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumDefaultValue.kt new file mode 100644 index 00000000000..12a37749139 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumDefaultValue.kt @@ -0,0 +1,30 @@ +/** +* OpenAPI Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 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.client.models + + +import com.squareup.moshi.Json + +/** +* +* Values: placed,approved,delivered +*/ +enum class OuterEnumDefaultValue(val value: kotlin.String){ + + @Json(name = "placed") placed("placed"), + + @Json(name = "approved") approved("approved"), + + @Json(name = "delivered") delivered("delivered"); + +} + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumInteger.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumInteger.kt new file mode 100644 index 00000000000..0e61152c6d9 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumInteger.kt @@ -0,0 +1,30 @@ +/** +* OpenAPI Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 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.client.models + + +import com.squareup.moshi.Json + +/** +* +* Values: _0,_1,_2 +*/ +enum class OuterEnumInteger(val value: kotlin.Int){ + + @Json(name = "0") _0(0), + + @Json(name = "1") _1(1), + + @Json(name = "2") _2(2); + +} + diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumIntegerDefaultValue.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumIntegerDefaultValue.kt new file mode 100644 index 00000000000..b5592bd8570 --- /dev/null +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/OuterEnumIntegerDefaultValue.kt @@ -0,0 +1,30 @@ +/** +* OpenAPI Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 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.client.models + + +import com.squareup.moshi.Json + +/** +* +* Values: _0,_1,_2 +*/ +enum class OuterEnumIntegerDefaultValue(val value: kotlin.Int){ + + @Json(name = "0") _0(0), + + @Json(name = "1") _1(1), + + @Json(name = "2") _2(2); + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/DefaultApi.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/DefaultApi.kt deleted file mode 100644 index 4ca16d903e4..00000000000 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/DefaultApi.kt +++ /dev/null @@ -1,46 +0,0 @@ -package org.openapitools.api - -import org.openapitools.model.SysMailFormData -import io.swagger.annotations.* -import org.springframework.http.HttpStatus -import org.springframework.http.MediaType -import org.springframework.http.ResponseEntity -import org.springframework.stereotype.Controller -import org.springframework.web.bind.annotation.RequestBody -import org.springframework.web.bind.annotation.RequestPart -import org.springframework.web.bind.annotation.RequestParam -import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.RequestHeader -import org.springframework.web.bind.annotation.RequestMethod -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.validation.annotation.Validated -import org.springframework.web.context.request.NativeWebRequest -import org.springframework.web.multipart.MultipartFile -import org.springframework.beans.factory.annotation.Autowired - -import javax.validation.Valid -import javax.validation.constraints.* - -import kotlin.collections.List -import kotlin.collections.Map - -@Controller -@Validated -@Api(value = "Default", description = "The Default API") -@RequestMapping("\${api.base-path:/v2}") -class DefaultApiController(@Autowired(required = true) val service: DefaultApiService) { - - @ApiOperation( - value = "", - nickname = "updateSysMailAtKey", - notes = "Update SysMail template") - @ApiResponses( - value = [ApiResponse(code = 200, message = "OK")]) - @RequestMapping( - value = ["/sysmails/{key}"], - consumes = ["application/json"], - method = [RequestMethod.PUT]) - fun updateSysMailAtKey(@ApiParam(value = "", required=true, defaultValue="null") @PathVariable("key") key: String,@ApiParam(value = "" ,required=true ) @Valid @RequestBody sysMailFormData: SysMailFormData): ResponseEntity { - return ResponseEntity(service.updateSysMailAtKey(key, sysMailFormData), HttpStatus.OK) - } -} diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/DefaultApiService.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/DefaultApiService.kt deleted file mode 100644 index 3fe465cfcb0..00000000000 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/DefaultApiService.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.api - -import org.openapitools.model.SysMailFormData - -interface DefaultApiService { - - fun updateSysMailAtKey(key: String,sysMailFormData: SysMailFormData): Unit -} diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/DefaultApiServiceImpl.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/DefaultApiServiceImpl.kt deleted file mode 100644 index a8dffc14777..00000000000 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/DefaultApiServiceImpl.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.api - -import org.openapitools.model.SysMailFormData -import org.springframework.stereotype.Service - -@Service -class DefaultApiServiceImpl : DefaultApiService { - - override fun updateSysMailAtKey(key: String,sysMailFormData: SysMailFormData): Unit { - TODO("Implement me") - } -} diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt index aff695572ad..71d5afca249 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -33,7 +33,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @ApiOperation( value = "Create user", nickname = "createUser", - notes = "This can only be done by the logged in user.") + notes = "This can only be done by the logged in user.", + authorizations = [Authorization(value = "auth_cookie")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) @RequestMapping( @@ -47,7 +48,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @ApiOperation( value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", - notes = "") + notes = "", + authorizations = [Authorization(value = "auth_cookie")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) @RequestMapping( @@ -61,7 +63,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @ApiOperation( value = "Creates list of users with given input array", nickname = "createUsersWithListInput", - notes = "") + notes = "", + authorizations = [Authorization(value = "auth_cookie")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) @RequestMapping( @@ -75,7 +78,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @ApiOperation( value = "Delete user", nickname = "deleteUser", - notes = "This can only be done by the logged in user.") + notes = "This can only be done by the logged in user.", + authorizations = [Authorization(value = "auth_cookie")]) @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) @RequestMapping( @@ -111,14 +115,15 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/login"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true, defaultValue = "null") @Valid @RequestParam(value = "username", required = true, defaultValue="null") username: String,@NotNull @ApiParam(value = "The password for login in clear text", required = true, defaultValue = "null") @Valid @RequestParam(value = "password", required = true, defaultValue="null") password: String): ResponseEntity { + fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiParam(value = "The user name for login", required = true, defaultValue = "null") @Valid @RequestParam(value = "username", required = true, defaultValue="null") username: String,@NotNull @ApiParam(value = "The password for login in clear text", required = true, defaultValue = "null") @Valid @RequestParam(value = "password", required = true, defaultValue="null") password: String): ResponseEntity { return ResponseEntity(service.loginUser(username, password), HttpStatus.OK) } @ApiOperation( value = "Logs out current logged in user session", nickname = "logoutUser", - notes = "") + notes = "", + authorizations = [Authorization(value = "auth_cookie")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) @RequestMapping( @@ -131,7 +136,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @ApiOperation( value = "Updated user", nickname = "updateUser", - notes = "This can only be done by the logged in user.") + notes = "This can only be done by the logged in user.", + authorizations = [Authorization(value = "auth_cookie")]) @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid user supplied"),ApiResponse(code = 404, message = "User not found")]) @RequestMapping( diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt index c34cec48df1..499ed4743e1 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt @@ -15,7 +15,7 @@ data class Category ( @ApiModelProperty(example = "null", value = "") @JsonProperty("id") val id: Long? = null, - +@get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiModelProperty(example = "null", value = "") @JsonProperty("name") val name: String? = null ) { diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/SysMailFormData.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/SysMailFormData.kt deleted file mode 100644 index 456a5ac13c3..00000000000 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/SysMailFormData.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.model - -import java.util.Objects -import com.fasterxml.jackson.annotation.JsonProperty -import javax.validation.Valid -import javax.validation.constraints.* -import io.swagger.annotations.ApiModelProperty - -/** - * Data to update a SysMail template. - * @param subject - * @param body - */ -data class SysMailFormData ( - - @ApiModelProperty(example = "null", value = "") - @JsonProperty("subject") val subject: String? = null, - - @ApiModelProperty(example = "null", value = "") - @JsonProperty("body") val body: String? = null -) { - -} - diff --git a/samples/server/petstore/kotlin-springboot/.openapi-generator/VERSION b/samples/server/petstore/kotlin-springboot/.openapi-generator/VERSION index 6d94c9c2e12..afa63656064 100644 --- a/samples/server/petstore/kotlin-springboot/.openapi-generator/VERSION +++ b/samples/server/petstore/kotlin-springboot/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.0-SNAPSHOT \ No newline at end of file +4.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt index 17b87c74fdf..3b23aa1d370 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -42,8 +42,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet"], consumes = ["application/json", "application/xml"], method = [RequestMethod.POST]) - fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet): ResponseEntity { - return ResponseEntity(service.addPet(pet), HttpStatus.OK) + fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet): ResponseEntity { + return ResponseEntity(service.addPet(body), HttpStatus.OK) } @ApiOperation( @@ -56,7 +56,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @RequestMapping( value = ["/pet/{petId}"], method = [RequestMethod.DELETE]) - fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: Long,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: String?): ResponseEntity { + fun deletePet(@ApiParam(value = "Pet id to delete", required=true, defaultValue="null") @PathVariable("petId") petId: Long,@ApiParam(value = "" , defaultValue="null") @RequestHeader(value="api_key", required=false) apiKey: String): ResponseEntity { return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.OK) } @@ -73,7 +73,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByStatus"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: List): ResponseEntity> { + fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "null") @Valid @RequestParam(value = "status", required = true, defaultValue="null") status: List): ResponseEntity> { return ResponseEntity(service.findPetsByStatus(status), HttpStatus.OK) } @@ -90,7 +90,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByTags"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: List): ResponseEntity> { + fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "null") @Valid @RequestParam(value = "tags", required = true, defaultValue="null") tags: List): ResponseEntity> { return ResponseEntity(service.findPetsByTags(tags), HttpStatus.OK) } @@ -106,7 +106,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/{petId}"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: Long): ResponseEntity { + fun getPetById(@ApiParam(value = "ID of pet to return", required=true, defaultValue="null") @PathVariable("petId") petId: Long): ResponseEntity { return ResponseEntity(service.getPetById(petId), HttpStatus.OK) } @@ -121,8 +121,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet"], consumes = ["application/json", "application/xml"], method = [RequestMethod.PUT]) - fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet): ResponseEntity { - return ResponseEntity(service.updatePet(pet), HttpStatus.OK) + fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet): ResponseEntity { + return ResponseEntity(service.updatePet(body), HttpStatus.OK) } @ApiOperation( @@ -136,7 +136,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/{petId}"], consumes = ["application/x-www-form-urlencoded"], method = [RequestMethod.POST]) - fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: Long,@ApiParam(value = "Updated name of the pet", defaultValue="null") @RequestParam(value="name", required=false) name: String ,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) status: String ): ResponseEntity { + fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true, defaultValue="null") @PathVariable("petId") petId: Long,@ApiParam(value = "Updated name of the pet", defaultValue="null") @RequestParam(value="name", required=false) name: String ,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) status: String ): ResponseEntity { return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.OK) } @@ -153,7 +153,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { produces = ["application/json"], consumes = ["multipart/form-data"], method = [RequestMethod.POST]) - fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: Long,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: String ,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: MultipartFile): ResponseEntity { + fun uploadFile(@ApiParam(value = "ID of pet to update", required=true, defaultValue="null") @PathVariable("petId") petId: Long,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: String ,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: MultipartFile): ResponseEntity { return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.OK) } } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt index b31d96e91b7..484b99c2fc5 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -5,9 +5,9 @@ import org.openapitools.model.Pet interface PetApiService { - fun addPet(pet: Pet): Unit + fun addPet(body: Pet): Unit - fun deletePet(petId: Long,apiKey: String?): Unit + fun deletePet(petId: Long,apiKey: String): Unit fun findPetsByStatus(status: List): List @@ -15,7 +15,7 @@ interface PetApiService { fun getPetById(petId: Long): Pet - fun updatePet(pet: Pet): Unit + fun updatePet(body: Pet): Unit fun updatePetWithForm(petId: Long,name: String,status: String): Unit diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt index 80b7d6e8fe1..f86feff4f5d 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt @@ -7,11 +7,11 @@ import org.springframework.stereotype.Service @Service class PetApiServiceImpl : PetApiService { - override fun addPet(pet: Pet): Unit { + override fun addPet(body: Pet): Unit { TODO("Implement me") } - override fun deletePet(petId: Long,apiKey: String?): Unit { + override fun deletePet(petId: Long,apiKey: String): Unit { TODO("Implement me") } @@ -27,7 +27,7 @@ class PetApiServiceImpl : PetApiService { TODO("Implement me") } - override fun updatePet(pet: Pet): Unit { + override fun updatePet(body: Pet): Unit { TODO("Implement me") } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt index 01c64e66ccf..4e0a88706c3 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -39,7 +39,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic @RequestMapping( value = ["/store/order/{orderId}"], method = [RequestMethod.DELETE]) - fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: String): ResponseEntity { + fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true, defaultValue="null") @PathVariable("orderId") orderId: String): ResponseEntity { return ResponseEntity(service.deleteOrder(orderId), HttpStatus.OK) } @@ -71,7 +71,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic value = ["/store/order/{orderId}"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: Long): ResponseEntity { + fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true, defaultValue="null") @PathVariable("orderId") orderId: Long): ResponseEntity { return ResponseEntity(service.getOrderById(orderId), HttpStatus.OK) } @@ -86,7 +86,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic value = ["/store/order"], produces = ["application/xml", "application/json"], method = [RequestMethod.POST]) - fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody order: Order): ResponseEntity { - return ResponseEntity(service.placeOrder(order), HttpStatus.OK) + fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody body: Order): ResponseEntity { + return ResponseEntity(service.placeOrder(body), HttpStatus.OK) } } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt index 7767fa87a8a..cf479e2c8a7 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt @@ -10,5 +10,5 @@ interface StoreApiService { fun getOrderById(orderId: Long): Order - fun placeOrder(order: Order): Order + fun placeOrder(body: Order): Order } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt index 850853758fe..ec26e074ac6 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt @@ -18,7 +18,7 @@ class StoreApiServiceImpl : StoreApiService { TODO("Implement me") } - override fun placeOrder(order: Order): Order { + override fun placeOrder(body: Order): Order { TODO("Implement me") } } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt index b68773524a2..97d1151e704 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -39,8 +39,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @RequestMapping( value = ["/user"], method = [RequestMethod.POST]) - fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody user: User): ResponseEntity { - return ResponseEntity(service.createUser(user), HttpStatus.OK) + fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody body: User): ResponseEntity { + return ResponseEntity(service.createUser(body), HttpStatus.OK) } @ApiOperation( @@ -52,8 +52,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @RequestMapping( value = ["/user/createWithArray"], method = [RequestMethod.POST]) - fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: List): ResponseEntity { - return ResponseEntity(service.createUsersWithArrayInput(user), HttpStatus.OK) + fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: List): ResponseEntity { + return ResponseEntity(service.createUsersWithArrayInput(body), HttpStatus.OK) } @ApiOperation( @@ -65,8 +65,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @RequestMapping( value = ["/user/createWithList"], method = [RequestMethod.POST]) - fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: List): ResponseEntity { - return ResponseEntity(service.createUsersWithListInput(user), HttpStatus.OK) + fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: List): ResponseEntity { + return ResponseEntity(service.createUsersWithListInput(body), HttpStatus.OK) } @ApiOperation( @@ -78,7 +78,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @RequestMapping( value = ["/user/{username}"], method = [RequestMethod.DELETE]) - fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: String): ResponseEntity { + fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true, defaultValue="null") @PathVariable("username") username: String): ResponseEntity { return ResponseEntity(service.deleteUser(username), HttpStatus.OK) } @@ -93,7 +93,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/{username}"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: String): ResponseEntity { + fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true, defaultValue="null") @PathVariable("username") username: String): ResponseEntity { return ResponseEntity(service.getUserByName(username), HttpStatus.OK) } @@ -108,7 +108,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/login"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: String,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: String): ResponseEntity { + fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true, defaultValue = "null") @Valid @RequestParam(value = "username", required = true, defaultValue="null") username: String,@NotNull @ApiParam(value = "The password for login in clear text", required = true, defaultValue = "null") @Valid @RequestParam(value = "password", required = true, defaultValue="null") password: String): ResponseEntity { return ResponseEntity(service.loginUser(username, password), HttpStatus.OK) } @@ -134,7 +134,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @RequestMapping( value = ["/user/{username}"], method = [RequestMethod.PUT]) - fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: String,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody user: User): ResponseEntity { - return ResponseEntity(service.updateUser(username, user), HttpStatus.OK) + fun updateUser(@ApiParam(value = "name that need to be deleted", required=true, defaultValue="null") @PathVariable("username") username: String,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody body: User): ResponseEntity { + return ResponseEntity(service.updateUser(username, body), HttpStatus.OK) } } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt index b8a3d7ebae1..bdf37d33dc5 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt @@ -4,11 +4,11 @@ import org.openapitools.model.User interface UserApiService { - fun createUser(user: User): Unit + fun createUser(body: User): Unit - fun createUsersWithArrayInput(user: List): Unit + fun createUsersWithArrayInput(body: List): Unit - fun createUsersWithListInput(user: List): Unit + fun createUsersWithListInput(body: List): Unit fun deleteUser(username: String): Unit @@ -18,5 +18,5 @@ interface UserApiService { fun logoutUser(): Unit - fun updateUser(username: String,user: User): Unit + fun updateUser(username: String,body: User): Unit } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt index 62b365a6d82..cb579c2c16f 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt @@ -6,15 +6,15 @@ import org.springframework.stereotype.Service @Service class UserApiServiceImpl : UserApiService { - override fun createUser(user: User): Unit { + override fun createUser(body: User): Unit { TODO("Implement me") } - override fun createUsersWithArrayInput(user: List): Unit { + override fun createUsersWithArrayInput(body: List): Unit { TODO("Implement me") } - override fun createUsersWithListInput(user: List): Unit { + override fun createUsersWithListInput(body: List): Unit { TODO("Implement me") } @@ -34,7 +34,7 @@ class UserApiServiceImpl : UserApiService { TODO("Implement me") } - override fun updateUser(username: String,user: User): Unit { + override fun updateUser(username: String,body: User): Unit { TODO("Implement me") } } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt index da259e87b8e..c34cec48df1 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt @@ -13,10 +13,10 @@ import io.swagger.annotations.ApiModelProperty */ data class Category ( - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("id") val id: Long? = null, - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("name") val name: String? = null ) { diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index e933f2436a4..17697fdfe8d 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -14,13 +14,13 @@ import io.swagger.annotations.ApiModelProperty */ data class ModelApiResponse ( - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("code") val code: Int? = null, - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("type") val type: String? = null, - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("message") val message: String? = null ) { diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt index e1065f56bd3..be8e2f33fb3 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt @@ -18,22 +18,22 @@ import io.swagger.annotations.ApiModelProperty */ data class Order ( - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("id") val id: Long? = null, - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("petId") val petId: Long? = null, - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("quantity") val quantity: Int? = null, - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, - @ApiModelProperty(value = "Order Status") + @ApiModelProperty(example = "null", value = "Order Status") @JsonProperty("status") val status: Order.Status? = null, - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("complete") val complete: Boolean? = null ) { diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt index 967bd0846b6..80af728b7e4 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt @@ -25,19 +25,19 @@ data class Pet ( @JsonProperty("name") val name: String, @get:NotNull - @ApiModelProperty(required = true, value = "") + @ApiModelProperty(example = "null", required = true, value = "") @JsonProperty("photoUrls") val photoUrls: List, - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("id") val id: Long? = null, - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("category") val category: Category? = null, - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("tags") val tags: List? = null, - @ApiModelProperty(value = "pet status in the store") + @ApiModelProperty(example = "null", value = "pet status in the store") @JsonProperty("status") val status: Pet.Status? = null ) { diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt index e40833c55fd..70c706d00a6 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt @@ -13,10 +13,10 @@ import io.swagger.annotations.ApiModelProperty */ data class Tag ( - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("id") val id: Long? = null, - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("name") val name: String? = null ) { diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt index b9cc2886ea0..4cfaf098874 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt @@ -19,28 +19,28 @@ import io.swagger.annotations.ApiModelProperty */ data class User ( - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("id") val id: Long? = null, - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("username") val username: String? = null, - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("firstName") val firstName: String? = null, - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("lastName") val lastName: String? = null, - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("email") val email: String? = null, - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("password") val password: String? = null, - @ApiModelProperty(value = "") + @ApiModelProperty(example = "null", value = "") @JsonProperty("phone") val phone: String? = null, - @ApiModelProperty(value = "User Status") + @ApiModelProperty(example = "null", value = "User Status") @JsonProperty("userStatus") val userStatus: Int? = null ) {