forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/4.3.x' into 5.0.x
This commit is contained in:
commit
bad78a30c8
@ -136,10 +136,10 @@ script:
|
|||||||
- mvn --quiet --batch-mode --show-version clean install
|
- mvn --quiet --batch-mode --show-version clean install
|
||||||
- mvn --quiet --batch-mode --show-version verify -Psamples
|
- mvn --quiet --batch-mode --show-version verify -Psamples
|
||||||
# test maven plugin
|
# test maven plugin
|
||||||
- mvn clean compile -f modules/openapi-generator-maven-plugin/examples/java-client.xml
|
- mvn --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/java-client.xml
|
||||||
- mvn clean compile -f modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml
|
- mvn --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml
|
||||||
- mvn clean compile -f modules/openapi-generator-maven-plugin/examples/kotlin.xml
|
- mvn --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/kotlin.xml
|
||||||
- mvn clean compile -f modules/openapi-generator-maven-plugin/examples/spring.xml
|
- mvn --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/spring.xml
|
||||||
# test gradle plugin
|
# test gradle plugin
|
||||||
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew buildGoSdk)
|
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew buildGoSdk)
|
||||||
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew openApiGenerate)
|
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew openApiGenerate)
|
||||||
|
@ -5,6 +5,6 @@ If Not Exist %executable% (
|
|||||||
)
|
)
|
||||||
|
|
||||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||||
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g kotlin --artifact-id "kotlin-petstore-string" --additional-properties dateLibrary=string,serializableModel=true -o samples\client\petstore\kotlin-string
|
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g kotlin --artifact-id "kotlin-petstore-string" --additional-properties dateLibrary=string,serializableModel=true,sortParamsByRequiredFlag=false,sortModelPropertiesByRequiredFlag=false -o samples\client\petstore\kotlin-string
|
||||||
|
|
||||||
java %JAVA_OPTS% -jar %executable% %ags%
|
java %JAVA_OPTS% -jar %executable% %ags%
|
||||||
|
@ -18,7 +18,7 @@ sidebar_label: kotlin
|
|||||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |null|
|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |null|
|
||||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |null|
|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |null|
|
||||||
|modelMutable|Create mutable models| |false|
|
|modelMutable|Create mutable models| |false|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**string**</dt><dd>String</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (jvm only)</dd><dt>**threetenbp**</dt><dd>Threetenbp (jvm only)</dd><dl>|java8|
|
|dateLibrary|Option. Date library to use|<dl><dt>**threetenbp-localdatetime**</dt><dd>Threetenbp - Backport of JSR310 (jvm only, for legacy app only)</dd><dt>**string**</dt><dd>String</dd><dt>**java8-localdatetime**</dt><dd>Java 8 native JSR310 (jvm only, for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (jvm only, preferred for jdk 1.8+)</dd><dt>**threetenbp**</dt><dd>Threetenbp - Backport of JSR310 (jvm only, preferred for jdk < 1.8)</dd><dl>|java8|
|
||||||
|collectionType|Option. Collection type to use|<dl><dt>**array**</dt><dd>kotlin.Array</dd><dt>**list**</dt><dd>kotlin.collections.List</dd><dl>|array|
|
|collectionType|Option. Collection type to use|<dl><dt>**array**</dt><dd>kotlin.Array</dd><dt>**list**</dt><dd>kotlin.collections.List</dd><dl>|array|
|
||||||
|library|Library template (sub-template) to use|<dl><dt>**jvm-okhttp4**</dt><dd>[DEFAULT] Platform: Java Virtual Machine. HTTP client: OkHttp 4.2.0 (Android 5.0+ and Java 8+). JSON processing: Moshi 1.8.0.</dd><dt>**jvm-okhttp3**</dt><dd>Platform: Java Virtual Machine. HTTP client: OkHttp 3.12.4 (Android 2.3+ and Java 7+). JSON processing: Moshi 1.8.0.</dd><dt>**jvm-retrofit2**</dt><dd>Platform: Java Virtual Machine. HTTP client: Retrofit 2.6.2.</dd><dt>**multiplatform**</dt><dd>Platform: Kotlin multiplatform. HTTP client: Ktor 1.2.4. JSON processing: Kotlinx Serialization: 0.12.0.</dd><dl>|jvm-okhttp4|
|
|library|Library template (sub-template) to use|<dl><dt>**jvm-okhttp4**</dt><dd>[DEFAULT] Platform: Java Virtual Machine. HTTP client: OkHttp 4.2.0 (Android 5.0+ and Java 8+). JSON processing: Moshi 1.8.0.</dd><dt>**jvm-okhttp3**</dt><dd>Platform: Java Virtual Machine. HTTP client: OkHttp 3.12.4 (Android 2.3+ and Java 7+). JSON processing: Moshi 1.8.0.</dd><dt>**jvm-retrofit2**</dt><dd>Platform: Java Virtual Machine. HTTP client: Retrofit 2.6.2.</dd><dt>**multiplatform**</dt><dd>Platform: Kotlin multiplatform. HTTP client: Ktor 1.2.4. JSON processing: Kotlinx Serialization: 0.12.0.</dd><dl>|jvm-okhttp4|
|
||||||
|requestDateConverter|JVM-Option. Defines in how to handle date-time objects that are used for a request (as query or parameter)|<dl><dt>**toJson**</dt><dd>Date formater option using a json converter.</dd><dt>**toString**</dt><dd>[DEFAULT] Use the 'toString'-method of the date-time object to retrieve the related string representation.</dd><dl>|toString|
|
|requestDateConverter|JVM-Option. Defines in how to handle date-time objects that are used for a request (as query or parameter)|<dl><dt>**toJson**</dt><dd>Date formater option using a json converter.</dd><dt>**toString**</dt><dd>[DEFAULT] Use the 'toString'-method of the date-time object to retrieve the related string representation.</dd><dl>|toString|
|
||||||
|
@ -56,7 +56,9 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
|||||||
public enum DateLibrary {
|
public enum DateLibrary {
|
||||||
STRING("string"),
|
STRING("string"),
|
||||||
THREETENBP("threetenbp"),
|
THREETENBP("threetenbp"),
|
||||||
JAVA8("java8");
|
THREETENBP_LOCALDATETIME("threetenbp-localdatetime"),
|
||||||
|
JAVA8("java8"),
|
||||||
|
JAVA8_LOCALDATETIME("java8-localdatetime");
|
||||||
|
|
||||||
public final String value;
|
public final String value;
|
||||||
|
|
||||||
@ -111,9 +113,11 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
|||||||
|
|
||||||
CliOption dateLibrary = new CliOption(DATE_LIBRARY, "Option. Date library to use");
|
CliOption dateLibrary = new CliOption(DATE_LIBRARY, "Option. Date library to use");
|
||||||
Map<String, String> dateOptions = new HashMap<>();
|
Map<String, String> dateOptions = new HashMap<>();
|
||||||
dateOptions.put(DateLibrary.THREETENBP.value, "Threetenbp (jvm only)");
|
dateOptions.put(DateLibrary.THREETENBP.value, "Threetenbp - Backport of JSR310 (jvm only, preferred for jdk < 1.8)");
|
||||||
|
dateOptions.put(DateLibrary.THREETENBP_LOCALDATETIME.value, "Threetenbp - Backport of JSR310 (jvm only, for legacy app only)");
|
||||||
dateOptions.put(DateLibrary.STRING.value, "String");
|
dateOptions.put(DateLibrary.STRING.value, "String");
|
||||||
dateOptions.put(DateLibrary.JAVA8.value, "Java 8 native JSR310 (jvm only)");
|
dateOptions.put(DateLibrary.JAVA8.value, "Java 8 native JSR310 (jvm only, preferred for jdk 1.8+)");
|
||||||
|
dateOptions.put(DateLibrary.JAVA8_LOCALDATETIME.value, "Java 8 native JSR310 (jvm only, for legacy app only)");
|
||||||
dateLibrary.setEnum(dateOptions);
|
dateLibrary.setEnum(dateOptions);
|
||||||
dateLibrary.setDefault(this.dateLibrary);
|
dateLibrary.setDefault(this.dateLibrary);
|
||||||
cliOptions.add(dateLibrary);
|
cliOptions.add(dateLibrary);
|
||||||
@ -222,19 +226,12 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void processDateLibrary() {
|
private void processDateLibrary() {
|
||||||
DateLibrary dateLibraryEnum = DateLibrary.valueOf(dateLibrary.toUpperCase(Locale.ROOT));
|
if (DateLibrary.THREETENBP.value.equals(dateLibrary) || DateLibrary.THREETENBP_LOCALDATETIME.value.equals(dateLibrary)) {
|
||||||
switch (dateLibraryEnum) {
|
processThreeTeBpDate(dateLibrary);
|
||||||
case THREETENBP:
|
} else if (DateLibrary.STRING.value.equals(dateLibrary)) {
|
||||||
processThreeTeBpDate();
|
processStringDate();
|
||||||
break;
|
} else if (DateLibrary.JAVA8.value.equals(dateLibrary) || DateLibrary.JAVA8_LOCALDATETIME.value.equals(dateLibrary)) {
|
||||||
case STRING:
|
processJava8Date(dateLibrary);
|
||||||
processStringDate();
|
|
||||||
break;
|
|
||||||
case JAVA8:
|
|
||||||
processJava8Date();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,14 +243,23 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processThreeTeBpDate() {
|
private void processThreeTeBpDate(String dateLibrary) {
|
||||||
additionalProperties.put(DateLibrary.THREETENBP.value, true);
|
additionalProperties.put(DateLibrary.THREETENBP.value, true);
|
||||||
typeMapping.put("date", "LocalDate");
|
typeMapping.put("date", "LocalDate");
|
||||||
typeMapping.put("DateTime", "LocalDateTime");
|
|
||||||
importMapping.put("LocalDate", "org.threeten.bp.LocalDate");
|
importMapping.put("LocalDate", "org.threeten.bp.LocalDate");
|
||||||
importMapping.put("LocalDateTime", "org.threeten.bp.LocalDateTime");
|
|
||||||
defaultIncludes.add("org.threeten.bp.LocalDate");
|
defaultIncludes.add("org.threeten.bp.LocalDate");
|
||||||
defaultIncludes.add("org.threeten.bp.LocalDateTime");
|
|
||||||
|
if (dateLibrary.equals(DateLibrary.THREETENBP.value)) {
|
||||||
|
typeMapping.put("date-time", "org.threeten.bp.OffsetDateTime");
|
||||||
|
typeMapping.put("DateTime", "OffsetDateTime");
|
||||||
|
importMapping.put("OffsetDateTime", "org.threeten.bp.OffsetDateTime");
|
||||||
|
defaultIncludes.add("org.threeten.bp.OffsetDateTime");
|
||||||
|
} else if (dateLibrary.equals(DateLibrary.THREETENBP_LOCALDATETIME.value)) {
|
||||||
|
typeMapping.put("date-time", "org.threeten.bp.LocalDateTime");
|
||||||
|
typeMapping.put("DateTime", "LocalDateTime");
|
||||||
|
importMapping.put("LocalDateTime", "org.threeten.bp.LocalDateTime");
|
||||||
|
defaultIncludes.add("org.threeten.bp.LocalDateTime");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processStringDate() {
|
private void processStringDate() {
|
||||||
@ -263,8 +269,18 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
|||||||
typeMapping.put("DateTime", "kotlin.String");
|
typeMapping.put("DateTime", "kotlin.String");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processJava8Date() {
|
private void processJava8Date(String dateLibrary) {
|
||||||
additionalProperties.put(DateLibrary.JAVA8.value, true);
|
additionalProperties.put(DateLibrary.JAVA8.value, true);
|
||||||
|
|
||||||
|
if (dateLibrary.equals(DateLibrary.JAVA8.value)) {
|
||||||
|
typeMapping.put("date-time", "java.time.OffsetDateTime");
|
||||||
|
typeMapping.put("DateTime", "OffsetDateTime");
|
||||||
|
importMapping.put("OffsetDateTime", "java.time.OffsetDateTime");
|
||||||
|
} else if (dateLibrary.equals(DateLibrary.JAVA8_LOCALDATETIME.value)) {
|
||||||
|
typeMapping.put("date-time", "java.time.LocalDateTime");
|
||||||
|
typeMapping.put("DateTime", "LocalDateTime");
|
||||||
|
importMapping.put("LocalDateTime", "java.time.LocalDateTime");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processJVMRetrofit2Library(String infrastructureFolder) {
|
private void processJVMRetrofit2Library(String infrastructureFolder) {
|
||||||
@ -280,6 +296,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
|
|||||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/ByteArrayAdapter.kt.mustache", infrastructureFolder, "ByteArrayAdapter.kt"));
|
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/ByteArrayAdapter.kt.mustache", infrastructureFolder, "ByteArrayAdapter.kt"));
|
||||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/LocalDateAdapter.kt.mustache", infrastructureFolder, "LocalDateAdapter.kt"));
|
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/LocalDateAdapter.kt.mustache", infrastructureFolder, "LocalDateAdapter.kt"));
|
||||||
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/LocalDateTimeAdapter.kt.mustache", infrastructureFolder, "LocalDateTimeAdapter.kt"));
|
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/LocalDateTimeAdapter.kt.mustache", infrastructureFolder, "LocalDateTimeAdapter.kt"));
|
||||||
|
supportingFiles.add(new SupportingFile("jvm-common/infrastructure/OffsetDateTimeAdapter.kt.mustache", infrastructureFolder, "OffsetDateTimeAdapter.kt"));
|
||||||
|
|
||||||
switch (getSerializationLibrary()) {
|
switch (getSerializationLibrary()) {
|
||||||
case moshi:
|
case moshi:
|
||||||
|
@ -138,7 +138,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10.1"
|
jackson_databind_version = "2.9.10.1"
|
||||||
jackson_databind_nullable_version = "0.2.0"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
jersey_version = "1.19.4"
|
jersey_version = "1.19.4"
|
||||||
jodatime_version = "2.9.9"
|
jodatime_version = "2.9.9"
|
||||||
junit_version = "4.12"
|
junit_version = "4.12"
|
||||||
|
@ -122,7 +122,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10.1"
|
jackson_databind_version = "2.9.10.1"
|
||||||
jackson_databind_nullable_version = "0.2.0"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
jackson_threetenbp_version = "2.9.10"
|
jackson_threetenbp_version = "2.9.10"
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
|
@ -315,7 +315,7 @@
|
|||||||
<feign-version>{{#useFeign10}}10.2.3{{/useFeign10}}{{^useFeign10}}9.7.0{{/useFeign10}}</feign-version>
|
<feign-version>{{#useFeign10}}10.2.3{{/useFeign10}}{{^useFeign10}}9.7.0{{/useFeign10}}</feign-version>
|
||||||
<feign-form-version>2.1.0</feign-form-version>
|
<feign-form-version>2.1.0</feign-form-version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||||
|
@ -122,7 +122,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10.1"
|
jackson_databind_version = "2.9.10.1"
|
||||||
jackson_databind_nullable_version = "0.2.0"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
google_api_client_version = "1.23.0"
|
google_api_client_version = "1.23.0"
|
||||||
jersey_common_version = "2.25.1"
|
jersey_common_version = "2.25.1"
|
||||||
jodatime_version = "2.9.9"
|
jodatime_version = "2.9.9"
|
||||||
|
@ -308,7 +308,7 @@
|
|||||||
<jersey-common-version>2.25.1</jersey-common-version>
|
<jersey-common-version>2.25.1</jersey-common-version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
{{#joda}}
|
{{#joda}}
|
||||||
<jodatime-version>2.9.9</jodatime-version>
|
<jodatime-version>2.9.9</jodatime-version>
|
||||||
{{/joda}}
|
{{/joda}}
|
||||||
|
@ -121,7 +121,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10.1"
|
jackson_databind_version = "2.9.10.1"
|
||||||
jackson_databind_nullable_version = "0.2.0"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
{{#supportJava6}}
|
{{#supportJava6}}
|
||||||
jersey_version = "2.6"
|
jersey_version = "2.6"
|
||||||
commons_io_version=2.5
|
commons_io_version=2.5
|
||||||
|
@ -362,7 +362,7 @@
|
|||||||
{{/supportJava6}}
|
{{/supportJava6}}
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
<threetenbp-version>2.9.10</threetenbp-version>
|
<threetenbp-version>2.9.10</threetenbp-version>
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
|
@ -215,7 +215,7 @@
|
|||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
<jackson-version>2.9.9</jackson-version>
|
<jackson-version>2.9.9</jackson-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<junit-version>4.12</junit-version>
|
<junit-version>4.12</junit-version>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
@ -101,7 +101,7 @@ ext {
|
|||||||
{{#jackson}}
|
{{#jackson}}
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10"
|
jackson_databind_version = "2.9.10"
|
||||||
jackson_databind_nullable_version = 0.2.0
|
jackson_databind_nullable_version = 0.2.1
|
||||||
{{/jackson}}
|
{{/jackson}}
|
||||||
{{#gson}}
|
{{#gson}}
|
||||||
gson_version = "2.8.5"
|
gson_version = "2.8.5"
|
||||||
|
@ -325,7 +325,7 @@
|
|||||||
{{#jackson}}
|
{{#jackson}}
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind-version>2.9.10</jackson-databind-version>
|
<jackson-databind-version>2.9.10</jackson-databind-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
|
@ -121,7 +121,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10.1"
|
jackson_databind_version = "2.9.10.1"
|
||||||
jackson_databind_nullable_version = "0.2.0"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
threetenbp_version = "2.9.10"
|
threetenbp_version = "2.9.10"
|
||||||
resteasy_version = "3.1.3.Final"
|
resteasy_version = "3.1.3.Final"
|
||||||
{{^java8}}
|
{{^java8}}
|
||||||
|
@ -296,7 +296,7 @@
|
|||||||
<resteasy-version>3.1.3.Final</resteasy-version>
|
<resteasy-version>3.1.3.Final</resteasy-version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<threetenbp-version>2.9.10</threetenbp-version>
|
<threetenbp-version>2.9.10</threetenbp-version>
|
||||||
{{^java8}}
|
{{^java8}}
|
||||||
<jodatime-version>2.9.9</jodatime-version>
|
<jodatime-version>2.9.9</jodatime-version>
|
||||||
|
@ -122,7 +122,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10.1"
|
jackson_databind_version = "2.9.10.1"
|
||||||
jackson_databind_nullable_version = "0.2.0"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
spring_web_version = "4.3.9.RELEASE"
|
spring_web_version = "4.3.9.RELEASE"
|
||||||
jodatime_version = "2.9.9"
|
jodatime_version = "2.9.9"
|
||||||
junit_version = "4.12"
|
junit_version = "4.12"
|
||||||
|
@ -311,7 +311,7 @@
|
|||||||
<spring-web-version>4.3.9.RELEASE</spring-web-version>
|
<spring-web-version>4.3.9.RELEASE</spring-web-version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
{{#joda}}
|
{{#joda}}
|
||||||
<jodatime-version>2.9.9</jodatime-version>
|
<jodatime-version>2.9.9</jodatime-version>
|
||||||
{{/joda}}
|
{{/joda}}
|
||||||
|
@ -133,7 +133,7 @@ ext {
|
|||||||
{{#play26}}
|
{{#play26}}
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10.1"
|
jackson_databind_version = "2.9.10.1"
|
||||||
jackson_databind_nullable_version = "0.2.0"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
play_version = "2.6.7"
|
play_version = "2.6.7"
|
||||||
{{/play26}}
|
{{/play26}}
|
||||||
{{/usePlayWS}}
|
{{/usePlayWS}}
|
||||||
|
@ -388,7 +388,7 @@
|
|||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<play-version>2.6.7</play-version>
|
<play-version>2.6.7</play-version>
|
||||||
{{/play26}}
|
{{/play26}}
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
{{/usePlayWS}}
|
{{/usePlayWS}}
|
||||||
<retrofit-version>2.5.0</retrofit-version>
|
<retrofit-version>2.5.0</retrofit-version>
|
||||||
{{#useRxJava}}
|
{{#useRxJava}}
|
||||||
|
@ -291,7 +291,7 @@
|
|||||||
<swagger-annotations-version>1.5.22</swagger-annotations-version>
|
<swagger-annotations-version>1.5.22</swagger-annotations-version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind>2.9.10.1</jackson-databind>
|
<jackson-databind>2.9.10.1</jackson-databind>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<junit-version>4.12</junit-version>
|
<junit-version>4.12</junit-version>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
@ -145,7 +145,7 @@
|
|||||||
<spring-web-version>5.0.8.RELEASE</spring-web-version>
|
<spring-web-version>5.0.8.RELEASE</spring-web-version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<junit-version>4.12</junit-version>
|
<junit-version>4.12</junit-version>
|
||||||
<reactor-version>3.1.8.RELEASE</reactor-version>
|
<reactor-version>3.1.8.RELEASE</reactor-version>
|
||||||
<reactor-netty-version>0.7.8.RELEASE</reactor-netty-version>
|
<reactor-netty-version>0.7.8.RELEASE</reactor-netty-version>
|
||||||
|
@ -0,0 +1,63 @@
|
|||||||
|
package {{packageName}}.infrastructure
|
||||||
|
|
||||||
|
{{#moshi}}
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
{{/moshi}}
|
||||||
|
{{#gson}}
|
||||||
|
import com.google.gson.TypeAdapter
|
||||||
|
import com.google.gson.stream.JsonReader
|
||||||
|
import com.google.gson.stream.JsonWriter
|
||||||
|
import com.google.gson.stream.JsonToken.NULL
|
||||||
|
import java.io.IOException
|
||||||
|
{{/gson}}
|
||||||
|
{{^threetenbp}}
|
||||||
|
import java.time.OffsetDateTime
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
{{/threetenbp}}
|
||||||
|
{{#threetenbp}}
|
||||||
|
import org.threeten.bp.OffsetDateTime
|
||||||
|
import org.threeten.bp.format.DateTimeFormatter
|
||||||
|
{{/threetenbp}}
|
||||||
|
|
||||||
|
{{#moshi}}
|
||||||
|
{{#nonPublicApi}}internal {{/nonPublicApi}}class OffsetDateTimeAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: OffsetDateTime): String {
|
||||||
|
return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): OffsetDateTime {
|
||||||
|
return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
{{/moshi}}
|
||||||
|
{{#gson}}
|
||||||
|
{{#nonPublicApi}}internal {{/nonPublicApi}}class OffsetDateTimeAdapter(private val formatter: DateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME) : TypeAdapter<OffsetDateTime>() {
|
||||||
|
@Throws(IOException::class)
|
||||||
|
override fun write(out: JsonWriter?, value: OffsetDateTime?) {
|
||||||
|
if (value == null) {
|
||||||
|
out?.nullValue()
|
||||||
|
} else {
|
||||||
|
out?.value(formatter.format(value))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Throws(IOException::class)
|
||||||
|
override fun read(out: JsonReader?): OffsetDateTime? {
|
||||||
|
out ?: return null
|
||||||
|
|
||||||
|
when (out.peek()) {
|
||||||
|
NULL -> {
|
||||||
|
out.nextNull()
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
return OffsetDateTime.parse(out.nextString(), formatter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{{/gson}}
|
@ -13,10 +13,12 @@ import com.google.gson.GsonBuilder
|
|||||||
{{^threetenbp}}
|
{{^threetenbp}}
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
|
import java.time.OffsetDateTime
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
{{#threetenbp}}
|
{{#threetenbp}}
|
||||||
import org.threeten.bp.LocalDate
|
import org.threeten.bp.LocalDate
|
||||||
import org.threeten.bp.LocalDateTime
|
import org.threeten.bp.LocalDateTime
|
||||||
|
import org.threeten.bp.OffsetDateTime
|
||||||
{{/threetenbp}}
|
{{/threetenbp}}
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
{{/gson}}
|
{{/gson}}
|
||||||
@ -27,6 +29,7 @@ import java.util.Date
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||||
|
.add(OffsetDateTimeAdapter())
|
||||||
.add(LocalDateTimeAdapter())
|
.add(LocalDateTimeAdapter())
|
||||||
.add(LocalDateAdapter())
|
.add(LocalDateAdapter())
|
||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
@ -44,6 +47,7 @@ import java.util.Date
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
val gsonBuilder: GsonBuilder = GsonBuilder()
|
val gsonBuilder: GsonBuilder = GsonBuilder()
|
||||||
.registerTypeAdapter(Date::class.java, DateAdapter())
|
.registerTypeAdapter(Date::class.java, DateAdapter())
|
||||||
|
.registerTypeAdapter(OffsetDateTime::class.java, OffsetDateTimeAdapter())
|
||||||
.registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeAdapter())
|
.registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeAdapter())
|
||||||
.registerTypeAdapter(LocalDate::class.java, LocalDateAdapter())
|
.registerTypeAdapter(LocalDate::class.java, LocalDateAdapter())
|
||||||
.registerTypeAdapter(ByteArray::class.java, ByteArrayAdapter())
|
.registerTypeAdapter(ByteArray::class.java, ByteArrayAdapter())
|
||||||
|
@ -66,6 +66,7 @@ public class KotlinClientCodegenModelTest {
|
|||||||
public void simpleModelTest() {
|
public void simpleModelTest() {
|
||||||
final Schema schema = getSimpleSchema();
|
final Schema schema = getSimpleSchema();
|
||||||
final DefaultCodegen codegen = new KotlinClientCodegen();
|
final DefaultCodegen codegen = new KotlinClientCodegen();
|
||||||
|
codegen.processOpts();
|
||||||
|
|
||||||
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", schema);
|
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", schema);
|
||||||
codegen.setOpenAPI(openAPI);
|
codegen.setOpenAPI(openAPI);
|
||||||
@ -100,10 +101,10 @@ public class KotlinClientCodegenModelTest {
|
|||||||
|
|
||||||
final CodegenProperty property3 = cm.vars.get(2);
|
final CodegenProperty property3 = cm.vars.get(2);
|
||||||
Assert.assertEquals(property3.baseName, "createdAt");
|
Assert.assertEquals(property3.baseName, "createdAt");
|
||||||
Assert.assertEquals(property3.dataType, "java.time.LocalDateTime");
|
Assert.assertEquals(property3.dataType, "java.time.OffsetDateTime");
|
||||||
Assert.assertEquals(property3.name, "createdAt");
|
Assert.assertEquals(property3.name, "createdAt");
|
||||||
Assert.assertEquals(property3.defaultValue, null);
|
Assert.assertEquals(property3.defaultValue, null);
|
||||||
Assert.assertEquals(property3.baseType, "java.time.LocalDateTime");
|
Assert.assertEquals(property3.baseType, "java.time.OffsetDateTime");
|
||||||
Assert.assertFalse(property3.hasMore);
|
Assert.assertFalse(property3.hasMore);
|
||||||
Assert.assertFalse(property3.required);
|
Assert.assertFalse(property3.required);
|
||||||
Assert.assertFalse(property3.isContainer);
|
Assert.assertFalse(property3.isContainer);
|
||||||
@ -120,6 +121,30 @@ public class KotlinClientCodegenModelTest {
|
|||||||
codegen.setOpenAPI(openAPI);
|
codegen.setOpenAPI(openAPI);
|
||||||
final CodegenModel cm = codegen.fromModel("sample", schema);
|
final CodegenModel cm = codegen.fromModel("sample", schema);
|
||||||
|
|
||||||
|
final CodegenProperty property3 = cm.vars.get(2);
|
||||||
|
Assert.assertEquals(property3.baseName, "createdAt");
|
||||||
|
Assert.assertEquals(property3.dataType, "org.threeten.bp.OffsetDateTime");
|
||||||
|
Assert.assertEquals(property3.name, "createdAt");
|
||||||
|
Assert.assertEquals(property3.defaultValue, null);
|
||||||
|
Assert.assertEquals(property3.baseType, "org.threeten.bp.OffsetDateTime");
|
||||||
|
Assert.assertFalse(property3.hasMore);
|
||||||
|
Assert.assertFalse(property3.required);
|
||||||
|
Assert.assertFalse(property3.isContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(description = "convert a simple model: threetenbp-localdatetime")
|
||||||
|
public void selectDateLibraryAsThreetenbpLocalDateTime() {
|
||||||
|
final Schema schema = getSimpleSchema();
|
||||||
|
final KotlinClientCodegen codegen = new KotlinClientCodegen();
|
||||||
|
String value = KotlinClientCodegen.DateLibrary.THREETENBP_LOCALDATETIME.value;
|
||||||
|
Assert.assertEquals(value, "threetenbp-localdatetime");
|
||||||
|
codegen.setDateLibrary(KotlinClientCodegen.DateLibrary.THREETENBP_LOCALDATETIME.value);
|
||||||
|
codegen.processOpts();
|
||||||
|
|
||||||
|
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", schema);
|
||||||
|
codegen.setOpenAPI(openAPI);
|
||||||
|
final CodegenModel cm = codegen.fromModel("sample", schema);
|
||||||
|
|
||||||
final CodegenProperty property3 = cm.vars.get(2);
|
final CodegenProperty property3 = cm.vars.get(2);
|
||||||
Assert.assertEquals(property3.baseName, "createdAt");
|
Assert.assertEquals(property3.baseName, "createdAt");
|
||||||
Assert.assertEquals(property3.dataType, "org.threeten.bp.LocalDateTime");
|
Assert.assertEquals(property3.dataType, "org.threeten.bp.LocalDateTime");
|
||||||
@ -164,6 +189,30 @@ public class KotlinClientCodegenModelTest {
|
|||||||
codegen.setOpenAPI(openAPI);
|
codegen.setOpenAPI(openAPI);
|
||||||
final CodegenModel cm = codegen.fromModel("sample", schema);
|
final CodegenModel cm = codegen.fromModel("sample", schema);
|
||||||
|
|
||||||
|
final CodegenProperty property3 = cm.vars.get(2);
|
||||||
|
Assert.assertEquals(property3.baseName, "createdAt");
|
||||||
|
Assert.assertEquals(property3.dataType, "java.time.OffsetDateTime");
|
||||||
|
Assert.assertEquals(property3.name, "createdAt");
|
||||||
|
Assert.assertEquals(property3.defaultValue, null);
|
||||||
|
Assert.assertEquals(property3.baseType, "java.time.OffsetDateTime");
|
||||||
|
Assert.assertFalse(property3.hasMore);
|
||||||
|
Assert.assertFalse(property3.required);
|
||||||
|
Assert.assertFalse(property3.isContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(description = "convert a simple model: date java8-localdatetime")
|
||||||
|
public void selectDateLibraryAsJava8LocalDateTime() {
|
||||||
|
final Schema schema = getSimpleSchema();
|
||||||
|
final KotlinClientCodegen codegen = new KotlinClientCodegen();
|
||||||
|
String value = KotlinClientCodegen.DateLibrary.JAVA8_LOCALDATETIME.value;
|
||||||
|
Assert.assertEquals(value, "java8-localdatetime");
|
||||||
|
codegen.setDateLibrary(KotlinClientCodegen.DateLibrary.JAVA8_LOCALDATETIME.value);
|
||||||
|
codegen.processOpts();
|
||||||
|
|
||||||
|
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", schema);
|
||||||
|
codegen.setOpenAPI(openAPI);
|
||||||
|
final CodegenModel cm = codegen.fromModel("sample", schema);
|
||||||
|
|
||||||
final CodegenProperty property3 = cm.vars.get(2);
|
final CodegenProperty property3 = cm.vars.get(2);
|
||||||
Assert.assertEquals(property3.baseName, "createdAt");
|
Assert.assertEquals(property3.baseName, "createdAt");
|
||||||
Assert.assertEquals(property3.dataType, "java.time.LocalDateTime");
|
Assert.assertEquals(property3.dataType, "java.time.LocalDateTime");
|
||||||
|
@ -98,7 +98,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10.1"
|
jackson_databind_version = "2.9.10.1"
|
||||||
jackson_databind_nullable_version = "0.2.0"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
jackson_threetenbp_version = "2.9.10"
|
jackson_threetenbp_version = "2.9.10"
|
||||||
feign_version = "9.7.0"
|
feign_version = "9.7.0"
|
||||||
feign_form_version = "2.1.0"
|
feign_form_version = "2.1.0"
|
||||||
|
@ -282,7 +282,7 @@
|
|||||||
<feign-version>9.7.0</feign-version>
|
<feign-version>9.7.0</feign-version>
|
||||||
<feign-form-version>2.1.0</feign-form-version>
|
<feign-form-version>2.1.0</feign-form-version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||||
<junit-version>4.12</junit-version>
|
<junit-version>4.12</junit-version>
|
||||||
|
@ -98,7 +98,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10.1"
|
jackson_databind_version = "2.9.10.1"
|
||||||
jackson_databind_nullable_version = "0.2.0"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
jackson_threetenbp_version = "2.9.10"
|
jackson_threetenbp_version = "2.9.10"
|
||||||
feign_version = "10.2.3"
|
feign_version = "10.2.3"
|
||||||
feign_form_version = "2.1.0"
|
feign_form_version = "2.1.0"
|
||||||
|
@ -282,7 +282,7 @@
|
|||||||
<feign-version>10.2.3</feign-version>
|
<feign-version>10.2.3</feign-version>
|
||||||
<feign-form-version>2.1.0</feign-form-version>
|
<feign-form-version>2.1.0</feign-form-version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||||
<junit-version>4.12</junit-version>
|
<junit-version>4.12</junit-version>
|
||||||
|
@ -98,7 +98,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10.1"
|
jackson_databind_version = "2.9.10.1"
|
||||||
jackson_databind_nullable_version = "0.2.0"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
google_api_client_version = "1.23.0"
|
google_api_client_version = "1.23.0"
|
||||||
jersey_common_version = "2.25.1"
|
jersey_common_version = "2.25.1"
|
||||||
jodatime_version = "2.9.9"
|
jodatime_version = "2.9.9"
|
||||||
|
@ -260,7 +260,7 @@
|
|||||||
<jersey-common-version>2.25.1</jersey-common-version>
|
<jersey-common-version>2.25.1</jersey-common-version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||||
<junit-version>4.12</junit-version>
|
<junit-version>4.12</junit-version>
|
||||||
|
@ -114,7 +114,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10.1"
|
jackson_databind_version = "2.9.10.1"
|
||||||
jackson_databind_nullable_version = "0.2.0"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
jersey_version = "1.19.4"
|
jersey_version = "1.19.4"
|
||||||
jodatime_version = "2.9.9"
|
jodatime_version = "2.9.9"
|
||||||
junit_version = "4.12"
|
junit_version = "4.12"
|
||||||
|
@ -292,7 +292,7 @@
|
|||||||
<commons_lang3_version>3.6</commons_lang3_version>
|
<commons_lang3_version>3.6</commons_lang3_version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<threetenbp-version>2.9.10</threetenbp-version>
|
<threetenbp-version>2.9.10</threetenbp-version>
|
||||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||||
<junit-version>4.12</junit-version>
|
<junit-version>4.12</junit-version>
|
||||||
|
@ -97,7 +97,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10.1"
|
jackson_databind_version = "2.9.10.1"
|
||||||
jackson_databind_nullable_version = "0.2.0"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
jersey_version = "2.27"
|
jersey_version = "2.27"
|
||||||
junit_version = "4.12"
|
junit_version = "4.12"
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,7 @@
|
|||||||
<jersey-version>2.27</jersey-version>
|
<jersey-version>2.27</jersey-version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||||
<junit-version>4.12</junit-version>
|
<junit-version>4.12</junit-version>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -97,7 +97,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10.1"
|
jackson_databind_version = "2.9.10.1"
|
||||||
jackson_databind_nullable_version = "0.2.0"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
jersey_version = "2.27"
|
jersey_version = "2.27"
|
||||||
junit_version = "4.12"
|
junit_version = "4.12"
|
||||||
threetenbp_version = "2.9.10"
|
threetenbp_version = "2.9.10"
|
||||||
|
@ -285,7 +285,7 @@
|
|||||||
<jersey-version>2.27</jersey-version>
|
<jersey-version>2.27</jersey-version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<threetenbp-version>2.9.10</threetenbp-version>
|
<threetenbp-version>2.9.10</threetenbp-version>
|
||||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||||
<junit-version>4.12</junit-version>
|
<junit-version>4.12</junit-version>
|
||||||
|
@ -208,7 +208,7 @@
|
|||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
<jackson-version>2.9.9</jackson-version>
|
<jackson-version>2.9.9</jackson-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<junit-version>4.12</junit-version>
|
<junit-version>4.12</junit-version>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
@ -97,7 +97,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10.1"
|
jackson_databind_version = "2.9.10.1"
|
||||||
jackson_databind_nullable_version = "0.2.0"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
threetenbp_version = "2.9.10"
|
threetenbp_version = "2.9.10"
|
||||||
resteasy_version = "3.1.3.Final"
|
resteasy_version = "3.1.3.Final"
|
||||||
jodatime_version = "2.9.9"
|
jodatime_version = "2.9.9"
|
||||||
|
@ -245,7 +245,7 @@
|
|||||||
<resteasy-version>3.1.3.Final</resteasy-version>
|
<resteasy-version>3.1.3.Final</resteasy-version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<threetenbp-version>2.9.10</threetenbp-version>
|
<threetenbp-version>2.9.10</threetenbp-version>
|
||||||
<jodatime-version>2.9.9</jodatime-version>
|
<jodatime-version>2.9.9</jodatime-version>
|
||||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||||
|
@ -98,7 +98,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10.1"
|
jackson_databind_version = "2.9.10.1"
|
||||||
jackson_databind_nullable_version = "0.2.0"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
spring_web_version = "4.3.9.RELEASE"
|
spring_web_version = "4.3.9.RELEASE"
|
||||||
jodatime_version = "2.9.9"
|
jodatime_version = "2.9.9"
|
||||||
junit_version = "4.12"
|
junit_version = "4.12"
|
||||||
|
@ -269,7 +269,7 @@
|
|||||||
<spring-web-version>4.3.9.RELEASE</spring-web-version>
|
<spring-web-version>4.3.9.RELEASE</spring-web-version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||||
<junit-version>4.12</junit-version>
|
<junit-version>4.12</junit-version>
|
||||||
|
@ -98,7 +98,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10.1"
|
jackson_databind_version = "2.9.10.1"
|
||||||
jackson_databind_nullable_version = "0.2.0"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
spring_web_version = "4.3.9.RELEASE"
|
spring_web_version = "4.3.9.RELEASE"
|
||||||
jodatime_version = "2.9.9"
|
jodatime_version = "2.9.9"
|
||||||
junit_version = "4.12"
|
junit_version = "4.12"
|
||||||
|
@ -261,7 +261,7 @@
|
|||||||
<spring-web-version>4.3.9.RELEASE</spring-web-version>
|
<spring-web-version>4.3.9.RELEASE</spring-web-version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
|
||||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||||
<junit-version>4.12</junit-version>
|
<junit-version>4.12</junit-version>
|
||||||
|
@ -282,7 +282,7 @@
|
|||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
<jackson-version>2.6.6</jackson-version>
|
<jackson-version>2.6.6</jackson-version>
|
||||||
<play-version>2.4.11</play-version>
|
<play-version>2.4.11</play-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<retrofit-version>2.5.0</retrofit-version>
|
<retrofit-version>2.5.0</retrofit-version>
|
||||||
<oltu-version>1.0.1</oltu-version>
|
<oltu-version>1.0.1</oltu-version>
|
||||||
<junit-version>4.12</junit-version>
|
<junit-version>4.12</junit-version>
|
||||||
|
@ -287,7 +287,7 @@
|
|||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<play-version>2.5.15</play-version>
|
<play-version>2.5.15</play-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<retrofit-version>2.5.0</retrofit-version>
|
<retrofit-version>2.5.0</retrofit-version>
|
||||||
<threetenbp-version>1.4.0</threetenbp-version>
|
<threetenbp-version>1.4.0</threetenbp-version>
|
||||||
<oltu-version>1.0.1</oltu-version>
|
<oltu-version>1.0.1</oltu-version>
|
||||||
|
@ -99,7 +99,7 @@ ext {
|
|||||||
retrofit_version = "2.3.0"
|
retrofit_version = "2.3.0"
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10.1"
|
jackson_databind_version = "2.9.10.1"
|
||||||
jackson_databind_nullable_version = "0.2.0"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
play_version = "2.6.7"
|
play_version = "2.6.7"
|
||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
junit_version = "4.12"
|
junit_version = "4.12"
|
||||||
|
@ -292,7 +292,7 @@
|
|||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<play-version>2.6.7</play-version>
|
<play-version>2.6.7</play-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<retrofit-version>2.5.0</retrofit-version>
|
<retrofit-version>2.5.0</retrofit-version>
|
||||||
<threetenbp-version>1.4.0</threetenbp-version>
|
<threetenbp-version>1.4.0</threetenbp-version>
|
||||||
<oltu-version>1.0.1</oltu-version>
|
<oltu-version>1.0.1</oltu-version>
|
||||||
|
@ -268,7 +268,7 @@
|
|||||||
<swagger-annotations-version>1.5.22</swagger-annotations-version>
|
<swagger-annotations-version>1.5.22</swagger-annotations-version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind>2.9.10.1</jackson-databind>
|
<jackson-databind>2.9.10.1</jackson-databind>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<junit-version>4.12</junit-version>
|
<junit-version>4.12</junit-version>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
@ -114,7 +114,7 @@ ext {
|
|||||||
swagger_annotations_version = "1.5.22"
|
swagger_annotations_version = "1.5.22"
|
||||||
jackson_version = "2.9.10"
|
jackson_version = "2.9.10"
|
||||||
jackson_databind_version = "2.9.10.1"
|
jackson_databind_version = "2.9.10.1"
|
||||||
jackson_databind_nullable_version = "0.2.0"
|
jackson_databind_nullable_version = "0.2.1"
|
||||||
jersey_version = "1.19.4"
|
jersey_version = "1.19.4"
|
||||||
jodatime_version = "2.9.9"
|
jodatime_version = "2.9.9"
|
||||||
junit_version = "4.12"
|
junit_version = "4.12"
|
||||||
|
@ -124,7 +124,7 @@
|
|||||||
<spring-web-version>5.0.8.RELEASE</spring-web-version>
|
<spring-web-version>5.0.8.RELEASE</spring-web-version>
|
||||||
<jackson-version>2.9.10</jackson-version>
|
<jackson-version>2.9.10</jackson-version>
|
||||||
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
<jackson-databind-version>2.9.10.1</jackson-databind-version>
|
||||||
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
|
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||||
<junit-version>4.12</junit-version>
|
<junit-version>4.12</junit-version>
|
||||||
<reactor-version>3.1.8.RELEASE</reactor-version>
|
<reactor-version>3.1.8.RELEASE</reactor-version>
|
||||||
<reactor-netty-version>0.7.8.RELEASE</reactor-netty-version>
|
<reactor-netty-version>0.7.8.RELEASE</reactor-netty-version>
|
||||||
|
@ -7,7 +7,7 @@ Name | Type | Description | Notes
|
|||||||
**id** | **kotlin.Long** | | [optional]
|
**id** | **kotlin.Long** | | [optional]
|
||||||
**petId** | **kotlin.Long** | | [optional]
|
**petId** | **kotlin.Long** | | [optional]
|
||||||
**quantity** | **kotlin.Int** | | [optional]
|
**quantity** | **kotlin.Int** | | [optional]
|
||||||
**shipDate** | [**java.time.LocalDateTime**](java.time.LocalDateTime.md) | | [optional]
|
**shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional]
|
||||||
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
||||||
**complete** | **kotlin.Boolean** | | [optional]
|
**complete** | **kotlin.Boolean** | | [optional]
|
||||||
|
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.google.gson.TypeAdapter
|
||||||
|
import com.google.gson.stream.JsonReader
|
||||||
|
import com.google.gson.stream.JsonWriter
|
||||||
|
import com.google.gson.stream.JsonToken.NULL
|
||||||
|
import java.io.IOException
|
||||||
|
import java.time.OffsetDateTime
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
|
class OffsetDateTimeAdapter(private val formatter: DateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME) : TypeAdapter<OffsetDateTime>() {
|
||||||
|
@Throws(IOException::class)
|
||||||
|
override fun write(out: JsonWriter?, value: OffsetDateTime?) {
|
||||||
|
if (value == null) {
|
||||||
|
out?.nullValue()
|
||||||
|
} else {
|
||||||
|
out?.value(formatter.format(value))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Throws(IOException::class)
|
||||||
|
override fun read(out: JsonReader?): OffsetDateTime? {
|
||||||
|
out ?: return null
|
||||||
|
|
||||||
|
when (out.peek()) {
|
||||||
|
NULL -> {
|
||||||
|
out.nextNull()
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
return OffsetDateTime.parse(out.nextString(), formatter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,7 @@ import com.google.gson.Gson
|
|||||||
import com.google.gson.GsonBuilder
|
import com.google.gson.GsonBuilder
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
|
import java.time.OffsetDateTime
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
||||||
@ -11,6 +12,7 @@ object Serializer {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
val gsonBuilder: GsonBuilder = GsonBuilder()
|
val gsonBuilder: GsonBuilder = GsonBuilder()
|
||||||
.registerTypeAdapter(Date::class.java, DateAdapter())
|
.registerTypeAdapter(Date::class.java, DateAdapter())
|
||||||
|
.registerTypeAdapter(OffsetDateTime::class.java, OffsetDateTimeAdapter())
|
||||||
.registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeAdapter())
|
.registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeAdapter())
|
||||||
.registerTypeAdapter(LocalDate::class.java, LocalDateAdapter())
|
.registerTypeAdapter(LocalDate::class.java, LocalDateAdapter())
|
||||||
.registerTypeAdapter(ByteArray::class.java, ByteArrayAdapter())
|
.registerTypeAdapter(ByteArray::class.java, ByteArrayAdapter())
|
||||||
|
@ -31,7 +31,7 @@ data class Order (
|
|||||||
@SerializedName("quantity")
|
@SerializedName("quantity")
|
||||||
val quantity: kotlin.Int? = null,
|
val quantity: kotlin.Int? = null,
|
||||||
@SerializedName("shipDate")
|
@SerializedName("shipDate")
|
||||||
val shipDate: java.time.LocalDateTime? = null,
|
val shipDate: java.time.OffsetDateTime? = null,
|
||||||
/* Order Status */
|
/* Order Status */
|
||||||
@SerializedName("status")
|
@SerializedName("status")
|
||||||
val status: Order.Status? = null,
|
val status: Order.Status? = null,
|
||||||
|
@ -7,7 +7,7 @@ Name | Type | Description | Notes
|
|||||||
**id** | **kotlin.Long** | | [optional]
|
**id** | **kotlin.Long** | | [optional]
|
||||||
**petId** | **kotlin.Long** | | [optional]
|
**petId** | **kotlin.Long** | | [optional]
|
||||||
**quantity** | **kotlin.Int** | | [optional]
|
**quantity** | **kotlin.Int** | | [optional]
|
||||||
**shipDate** | [**java.time.LocalDateTime**](java.time.LocalDateTime.md) | | [optional]
|
**shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional]
|
||||||
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
||||||
**complete** | **kotlin.Boolean** | | [optional]
|
**complete** | **kotlin.Boolean** | | [optional]
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ Get all pets
|
|||||||
//import org.openapitools.client.models.*
|
//import org.openapitools.client.models.*
|
||||||
|
|
||||||
val apiInstance = PetApi()
|
val apiInstance = PetApi()
|
||||||
val lastUpdated : java.time.LocalDateTime = 2013-10-20T19:20:30+01:00 // java.time.LocalDateTime | When this endpoint was hit last to help indentify if the client already has the latest copy.
|
val lastUpdated : java.time.OffsetDateTime = 2013-10-20T19:20:30+01:00 // java.time.OffsetDateTime | When this endpoint was hit last to help indentify if the client already has the latest copy.
|
||||||
try {
|
try {
|
||||||
val result : kotlin.Array<Pet> = apiInstance.getAllPets(lastUpdated)
|
val result : kotlin.Array<Pet> = apiInstance.getAllPets(lastUpdated)
|
||||||
println(result)
|
println(result)
|
||||||
@ -187,7 +187,7 @@ try {
|
|||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**lastUpdated** | **java.time.LocalDateTime**| When this endpoint was hit last to help indentify if the client already has the latest copy. | [optional]
|
**lastUpdated** | **java.time.OffsetDateTime**| When this endpoint was hit last to help indentify if the client already has the latest copy. | [optional]
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCli
|
|||||||
*/
|
*/
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
|
||||||
fun getAllPets(lastUpdated: java.time.LocalDateTime?) : kotlin.Array<Pet> {
|
fun getAllPets(lastUpdated: java.time.OffsetDateTime?) : kotlin.Array<Pet> {
|
||||||
val localVariableBody: kotlin.Any? = null
|
val localVariableBody: kotlin.Any? = null
|
||||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||||
.apply {
|
.apply {
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.time.OffsetDateTime
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
|
class OffsetDateTimeAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: OffsetDateTime): String {
|
||||||
|
return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): OffsetDateTime {
|
||||||
|
return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,6 +9,7 @@ object Serializer {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||||
|
.add(OffsetDateTimeAdapter())
|
||||||
.add(LocalDateTimeAdapter())
|
.add(LocalDateTimeAdapter())
|
||||||
.add(LocalDateAdapter())
|
.add(LocalDateAdapter())
|
||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
|
@ -31,7 +31,7 @@ data class Order (
|
|||||||
@Json(name = "quantity")
|
@Json(name = "quantity")
|
||||||
val quantity: kotlin.Int? = null,
|
val quantity: kotlin.Int? = null,
|
||||||
@Json(name = "shipDate")
|
@Json(name = "shipDate")
|
||||||
val shipDate: java.time.LocalDateTime? = null,
|
val shipDate: java.time.OffsetDateTime? = null,
|
||||||
/* Order Status */
|
/* Order Status */
|
||||||
@Json(name = "status")
|
@Json(name = "status")
|
||||||
val status: Order.Status? = null,
|
val status: Order.Status? = null,
|
||||||
|
@ -7,7 +7,7 @@ Name | Type | Description | Notes
|
|||||||
**id** | **kotlin.Long** | | [optional]
|
**id** | **kotlin.Long** | | [optional]
|
||||||
**petId** | **kotlin.Long** | | [optional]
|
**petId** | **kotlin.Long** | | [optional]
|
||||||
**quantity** | **kotlin.Int** | | [optional]
|
**quantity** | **kotlin.Int** | | [optional]
|
||||||
**shipDate** | [**java.time.LocalDateTime**](java.time.LocalDateTime.md) | | [optional]
|
**shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional]
|
||||||
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
||||||
**complete** | **kotlin.Boolean** | | [optional]
|
**complete** | **kotlin.Boolean** | | [optional]
|
||||||
|
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.time.OffsetDateTime
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
|
class OffsetDateTimeAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: OffsetDateTime): String {
|
||||||
|
return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): OffsetDateTime {
|
||||||
|
return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -8,6 +8,7 @@ object Serializer {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||||
|
.add(OffsetDateTimeAdapter())
|
||||||
.add(LocalDateTimeAdapter())
|
.add(LocalDateTimeAdapter())
|
||||||
.add(LocalDateAdapter())
|
.add(LocalDateAdapter())
|
||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
|
@ -32,7 +32,7 @@ data class Order (
|
|||||||
@Json(name = "quantity")
|
@Json(name = "quantity")
|
||||||
val quantity: kotlin.Int? = null,
|
val quantity: kotlin.Int? = null,
|
||||||
@Json(name = "shipDate")
|
@Json(name = "shipDate")
|
||||||
val shipDate: java.time.LocalDateTime? = null,
|
val shipDate: java.time.OffsetDateTime? = null,
|
||||||
/* Order Status */
|
/* Order Status */
|
||||||
@Json(name = "status")
|
@Json(name = "status")
|
||||||
val status: Order.Status? = null,
|
val status: Order.Status? = null,
|
||||||
|
@ -7,7 +7,7 @@ Name | Type | Description | Notes
|
|||||||
**id** | **kotlin.Long** | | [optional]
|
**id** | **kotlin.Long** | | [optional]
|
||||||
**petId** | **kotlin.Long** | | [optional]
|
**petId** | **kotlin.Long** | | [optional]
|
||||||
**quantity** | **kotlin.Int** | | [optional]
|
**quantity** | **kotlin.Int** | | [optional]
|
||||||
**shipDate** | [**java.time.LocalDateTime**](java.time.LocalDateTime.md) | | [optional]
|
**shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional]
|
||||||
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
||||||
**complete** | **kotlin.Boolean** | | [optional]
|
**complete** | **kotlin.Boolean** | | [optional]
|
||||||
|
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.time.OffsetDateTime
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
|
internal class OffsetDateTimeAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: OffsetDateTime): String {
|
||||||
|
return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): OffsetDateTime {
|
||||||
|
return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,6 +9,7 @@ internal object Serializer {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||||
|
.add(OffsetDateTimeAdapter())
|
||||||
.add(LocalDateTimeAdapter())
|
.add(LocalDateTimeAdapter())
|
||||||
.add(LocalDateAdapter())
|
.add(LocalDateAdapter())
|
||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
|
@ -31,7 +31,7 @@ internal data class Order (
|
|||||||
@Json(name = "quantity")
|
@Json(name = "quantity")
|
||||||
val quantity: kotlin.Int? = null,
|
val quantity: kotlin.Int? = null,
|
||||||
@Json(name = "shipDate")
|
@Json(name = "shipDate")
|
||||||
val shipDate: java.time.LocalDateTime? = null,
|
val shipDate: java.time.OffsetDateTime? = null,
|
||||||
/* Order Status */
|
/* Order Status */
|
||||||
@Json(name = "status")
|
@Json(name = "status")
|
||||||
val status: Order.Status? = null,
|
val status: Order.Status? = null,
|
||||||
|
@ -7,7 +7,7 @@ Name | Type | Description | Notes
|
|||||||
**id** | **kotlin.Long** | | [optional]
|
**id** | **kotlin.Long** | | [optional]
|
||||||
**petId** | **kotlin.Long** | | [optional]
|
**petId** | **kotlin.Long** | | [optional]
|
||||||
**quantity** | **kotlin.Int** | | [optional]
|
**quantity** | **kotlin.Int** | | [optional]
|
||||||
**shipDate** | [**java.time.LocalDateTime**](java.time.LocalDateTime.md) | | [optional]
|
**shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional]
|
||||||
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
||||||
**complete** | **kotlin.Boolean** | | [optional]
|
**complete** | **kotlin.Boolean** | | [optional]
|
||||||
|
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.time.OffsetDateTime
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
|
class OffsetDateTimeAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: OffsetDateTime): String {
|
||||||
|
return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): OffsetDateTime {
|
||||||
|
return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,6 +9,7 @@ object Serializer {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||||
|
.add(OffsetDateTimeAdapter())
|
||||||
.add(LocalDateTimeAdapter())
|
.add(LocalDateTimeAdapter())
|
||||||
.add(LocalDateAdapter())
|
.add(LocalDateAdapter())
|
||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
|
@ -32,7 +32,7 @@ data class Order (
|
|||||||
@Json(name = "quantity")
|
@Json(name = "quantity")
|
||||||
val quantity: kotlin.Int? = null,
|
val quantity: kotlin.Int? = null,
|
||||||
@Json(name = "shipDate")
|
@Json(name = "shipDate")
|
||||||
val shipDate: java.time.LocalDateTime? = null,
|
val shipDate: java.time.OffsetDateTime? = null,
|
||||||
/* Order Status */
|
/* Order Status */
|
||||||
@Json(name = "status")
|
@Json(name = "status")
|
||||||
val status: Order.Status? = null,
|
val status: Order.Status? = null,
|
||||||
|
@ -7,7 +7,7 @@ Name | Type | Description | Notes
|
|||||||
**id** | **kotlin.Long** | | [optional]
|
**id** | **kotlin.Long** | | [optional]
|
||||||
**petId** | **kotlin.Long** | | [optional]
|
**petId** | **kotlin.Long** | | [optional]
|
||||||
**quantity** | **kotlin.Int** | | [optional]
|
**quantity** | **kotlin.Int** | | [optional]
|
||||||
**shipDate** | [**java.time.LocalDateTime**](java.time.LocalDateTime.md) | | [optional]
|
**shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional]
|
||||||
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
||||||
**complete** | **kotlin.Boolean** | | [optional]
|
**complete** | **kotlin.Boolean** | | [optional]
|
||||||
|
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.time.OffsetDateTime
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
|
class OffsetDateTimeAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: OffsetDateTime): String {
|
||||||
|
return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): OffsetDateTime {
|
||||||
|
return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,6 +9,7 @@ object Serializer {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||||
|
.add(OffsetDateTimeAdapter())
|
||||||
.add(LocalDateTimeAdapter())
|
.add(LocalDateTimeAdapter())
|
||||||
.add(LocalDateAdapter())
|
.add(LocalDateAdapter())
|
||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
|
@ -31,7 +31,7 @@ data class Order (
|
|||||||
@Json(name = "quantity")
|
@Json(name = "quantity")
|
||||||
val quantity: kotlin.Int? = null,
|
val quantity: kotlin.Int? = null,
|
||||||
@Json(name = "shipDate")
|
@Json(name = "shipDate")
|
||||||
val shipDate: java.time.LocalDateTime? = null,
|
val shipDate: java.time.OffsetDateTime? = null,
|
||||||
/* Order Status */
|
/* Order Status */
|
||||||
@Json(name = "status")
|
@Json(name = "status")
|
||||||
val status: Order.Status? = null,
|
val status: Order.Status? = null,
|
||||||
|
@ -7,7 +7,7 @@ Name | Type | Description | Notes
|
|||||||
**id** | **kotlin.Long** | | [optional]
|
**id** | **kotlin.Long** | | [optional]
|
||||||
**petId** | **kotlin.Long** | | [optional]
|
**petId** | **kotlin.Long** | | [optional]
|
||||||
**quantity** | **kotlin.Int** | | [optional]
|
**quantity** | **kotlin.Int** | | [optional]
|
||||||
**shipDate** | [**java.time.LocalDateTime**](java.time.LocalDateTime.md) | | [optional]
|
**shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional]
|
||||||
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
||||||
**complete** | **kotlin.Boolean** | | [optional]
|
**complete** | **kotlin.Boolean** | | [optional]
|
||||||
|
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.time.OffsetDateTime
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
|
class OffsetDateTimeAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: OffsetDateTime): String {
|
||||||
|
return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): OffsetDateTime {
|
||||||
|
return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,6 +9,7 @@ object Serializer {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||||
|
.add(OffsetDateTimeAdapter())
|
||||||
.add(LocalDateTimeAdapter())
|
.add(LocalDateTimeAdapter())
|
||||||
.add(LocalDateAdapter())
|
.add(LocalDateAdapter())
|
||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
|
@ -31,7 +31,7 @@ data class Order (
|
|||||||
@Json(name = "quantity")
|
@Json(name = "quantity")
|
||||||
val quantity: kotlin.Int? = null,
|
val quantity: kotlin.Int? = null,
|
||||||
@Json(name = "shipDate")
|
@Json(name = "shipDate")
|
||||||
val shipDate: java.time.LocalDateTime? = null,
|
val shipDate: java.time.OffsetDateTime? = null,
|
||||||
/* Order Status */
|
/* Order Status */
|
||||||
@Json(name = "status")
|
@Json(name = "status")
|
||||||
val status: Order.Status? = null,
|
val status: Order.Status? = null,
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.time.OffsetDateTime
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
|
class OffsetDateTimeAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: OffsetDateTime): String {
|
||||||
|
return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): OffsetDateTime {
|
||||||
|
return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,6 +9,7 @@ object Serializer {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||||
|
.add(OffsetDateTimeAdapter())
|
||||||
.add(LocalDateTimeAdapter())
|
.add(LocalDateTimeAdapter())
|
||||||
.add(LocalDateAdapter())
|
.add(LocalDateAdapter())
|
||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
|
@ -7,7 +7,7 @@ Name | Type | Description | Notes
|
|||||||
**id** | **kotlin.Long** | | [optional]
|
**id** | **kotlin.Long** | | [optional]
|
||||||
**petId** | **kotlin.Long** | | [optional]
|
**petId** | **kotlin.Long** | | [optional]
|
||||||
**quantity** | **kotlin.Int** | | [optional]
|
**quantity** | **kotlin.Int** | | [optional]
|
||||||
**shipDate** | [**org.threeten.bp.LocalDateTime**](org.threeten.bp.LocalDateTime.md) | | [optional]
|
**shipDate** | [**org.threeten.bp.OffsetDateTime**](org.threeten.bp.OffsetDateTime.md) | | [optional]
|
||||||
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
||||||
**complete** | **kotlin.Boolean** | | [optional]
|
**complete** | **kotlin.Boolean** | | [optional]
|
||||||
|
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import org.threeten.bp.OffsetDateTime
|
||||||
|
import org.threeten.bp.format.DateTimeFormatter
|
||||||
|
|
||||||
|
class OffsetDateTimeAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: OffsetDateTime): String {
|
||||||
|
return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): OffsetDateTime {
|
||||||
|
return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,6 +9,7 @@ object Serializer {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||||
|
.add(OffsetDateTimeAdapter())
|
||||||
.add(LocalDateTimeAdapter())
|
.add(LocalDateTimeAdapter())
|
||||||
.add(LocalDateAdapter())
|
.add(LocalDateAdapter())
|
||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
|
@ -31,7 +31,7 @@ data class Order (
|
|||||||
@Json(name = "quantity")
|
@Json(name = "quantity")
|
||||||
val quantity: kotlin.Int? = null,
|
val quantity: kotlin.Int? = null,
|
||||||
@Json(name = "shipDate")
|
@Json(name = "shipDate")
|
||||||
val shipDate: org.threeten.bp.LocalDateTime? = null,
|
val shipDate: org.threeten.bp.OffsetDateTime? = null,
|
||||||
/* Order Status */
|
/* Order Status */
|
||||||
@Json(name = "status")
|
@Json(name = "status")
|
||||||
val status: Order.Status? = null,
|
val status: Order.Status? = null,
|
||||||
|
@ -7,7 +7,7 @@ Name | Type | Description | Notes
|
|||||||
**id** | **kotlin.Long** | | [optional]
|
**id** | **kotlin.Long** | | [optional]
|
||||||
**petId** | **kotlin.Long** | | [optional]
|
**petId** | **kotlin.Long** | | [optional]
|
||||||
**quantity** | **kotlin.Int** | | [optional]
|
**quantity** | **kotlin.Int** | | [optional]
|
||||||
**shipDate** | [**java.time.LocalDateTime**](java.time.LocalDateTime.md) | | [optional]
|
**shipDate** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional]
|
||||||
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
**status** | [**inline**](#StatusEnum) | Order Status | [optional]
|
||||||
**complete** | **kotlin.Boolean** | | [optional]
|
**complete** | **kotlin.Boolean** | | [optional]
|
||||||
|
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.openapitools.client.infrastructure
|
||||||
|
|
||||||
|
import com.squareup.moshi.FromJson
|
||||||
|
import com.squareup.moshi.ToJson
|
||||||
|
import java.time.OffsetDateTime
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
|
class OffsetDateTimeAdapter {
|
||||||
|
@ToJson
|
||||||
|
fun toJson(value: OffsetDateTime): String {
|
||||||
|
return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
@FromJson
|
||||||
|
fun fromJson(value: String): OffsetDateTime {
|
||||||
|
return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,6 +9,7 @@ object Serializer {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
val moshiBuilder: Moshi.Builder = Moshi.Builder()
|
||||||
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
.add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
|
||||||
|
.add(OffsetDateTimeAdapter())
|
||||||
.add(LocalDateTimeAdapter())
|
.add(LocalDateTimeAdapter())
|
||||||
.add(LocalDateAdapter())
|
.add(LocalDateAdapter())
|
||||||
.add(UUIDAdapter())
|
.add(UUIDAdapter())
|
||||||
|
@ -32,7 +32,7 @@ data class Order (
|
|||||||
@Json(name = "quantity")
|
@Json(name = "quantity")
|
||||||
val quantity: kotlin.Int? = null,
|
val quantity: kotlin.Int? = null,
|
||||||
@Json(name = "shipDate")
|
@Json(name = "shipDate")
|
||||||
val shipDate: java.time.LocalDateTime? = null,
|
val shipDate: java.time.OffsetDateTime? = null,
|
||||||
/* Order Status */
|
/* Order Status */
|
||||||
@Json(name = "status")
|
@Json(name = "status")
|
||||||
val status: Order.Status? = null,
|
val status: Order.Status? = null,
|
||||||
|
@ -6,7 +6,7 @@ import org.openapitools.client.apis.PetApi
|
|||||||
import org.openapitools.client.apis.StoreApi
|
import org.openapitools.client.apis.StoreApi
|
||||||
import org.openapitools.client.models.Order
|
import org.openapitools.client.models.Order
|
||||||
import org.openapitools.client.models.Pet
|
import org.openapitools.client.models.Pet
|
||||||
import java.time.LocalDateTime.now
|
import java.time.OffsetDateTime.now
|
||||||
|
|
||||||
class StoreApiTest : ShouldSpec() {
|
class StoreApiTest : ShouldSpec() {
|
||||||
init {
|
init {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user