[Kotlin][client] Support gson and moshi as serialization libraries (#3734)

This commit is contained in:
prisoneroftech 2019-08-28 23:37:13 -04:00 committed by Jérémie Bresson
parent 1443f01709
commit 8f7e43b500
72 changed files with 224 additions and 217 deletions

View File

@ -26,7 +26,7 @@ then
fi
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -t modules/openapi-generator/src/main/resources/kotlin-client -g kotlin --artifact-id kotlin-petstore-client --additional-properties dateLibrary=java8 -o samples/openapi3/client/petstore/kotlin $@"
ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -t modules/openapi-generator/src/main/resources/kotlin-client -g kotlin --artifact-id kotlin-petstore-client --additional-properties dateLibrary=java8 -o samples/openapi3/client/petstore/kotlin $@"
echo "Cleaning previously generated files if any from samples/openapi3/client/petstore/kotlin"
rm -rf samples/openapi3/client/petstore/kotlin

View File

@ -14,6 +14,7 @@ sidebar_label: kotlin-server
|artifactId|Generated artifact id (name of jar).| |kotlin-server|
|artifactVersion|Generated artifact's package version.| |1.0.0|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase|
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi|
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|library|library template (sub-template)|<dl><dt>**ktor**</dt><dd>ktor framework</dd><dl>|ktor|
|featureAutoHead|Automatically provide responses to HEAD requests for existing routes that have the GET verb defined.| |true|

View File

@ -14,6 +14,7 @@ sidebar_label: kotlin-spring
|artifactId|Generated artifact id (name of jar).| |openapi-spring|
|artifactVersion|Generated artifact's package version.| |1.0.0|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase|
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi|
|parcelizeModels|toggle &quot;@Parcelize&quot; for generated models| |null|
|title|server title name or client service name| |OpenAPI Kotlin Spring|
|basePackage|base package (invokerPackage) for generated code| |org.openapitools|

View File

@ -14,6 +14,7 @@ sidebar_label: kotlin
|artifactId|Generated artifact id (name of jar).| |kotlin-client|
|artifactVersion|Generated artifact's package version.| |1.0.0|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase|
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson'| |moshi|
|parcelizeModels|toggle &quot;@Parcelize&quot; for generated models| |null|
|dateLibrary|Option. Date library to use|<dl><dt>**string**</dt><dd>String</dd><dt>**java8**</dt><dd>Java 8 native JSR310</dd><dt>**threetenbp**</dt><dd>Threetenbp</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|

View File

@ -202,6 +202,10 @@ public class CodegenConstants {
public static final String ENUM_PROPERTY_NAMING = "enumPropertyNaming";
public static final String ENUM_PROPERTY_NAMING_DESC = "Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'";
// Allow different language generators to offer an option of serialization library. Each language specific
// Codegen constants should define a description and provide proper input validation for the value of serializationLibrary
public static final String SERIALIZATION_LIBRARY = "serializationLibrary";
public static final String MODEL_NAME_PREFIX = "modelNamePrefix";
public static final String MODEL_NAME_PREFIX_DESC = "Prefix that will be prepended to all model names.";

View File

@ -35,6 +35,10 @@ import java.util.*;
import static org.openapitools.codegen.utils.StringUtils.*;
public abstract class AbstractKotlinCodegen extends DefaultCodegen implements CodegenConfig {
public static final String SERIALIZATION_LIBRARY_DESC = "What serialization library to use: 'moshi' (default), or 'gson'";
public enum SERIALIZATION_LIBRARY_TYPE {moshi, gson}
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractKotlinCodegen.class);
protected String artifactId;
@ -51,6 +55,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
protected boolean parcelizeModels = false;
protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.camelCase;
protected SERIALIZATION_LIBRARY_TYPE serializationLibrary = SERIALIZATION_LIBRARY_TYPE.moshi;
public AbstractKotlinCodegen() {
super();
@ -205,6 +210,10 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
CliOption enumPropertyNamingOpt = new CliOption(CodegenConstants.ENUM_PROPERTY_NAMING, CodegenConstants.ENUM_PROPERTY_NAMING_DESC);
cliOptions.add(enumPropertyNamingOpt.defaultValue(enumPropertyNaming.name()));
CliOption serializationLibraryOpt = new CliOption(CodegenConstants.SERIALIZATION_LIBRARY, SERIALIZATION_LIBRARY_DESC);
cliOptions.add(serializationLibraryOpt.defaultValue(serializationLibrary.name()));
cliOptions.add(new CliOption(CodegenConstants.PARCELIZE_MODELS, CodegenConstants.PARCELIZE_MODELS_DESC));
}
@ -244,6 +253,10 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
return this.enumPropertyNaming;
}
public SERIALIZATION_LIBRARY_TYPE getSerializationLibrary() {
return this.serializationLibrary;
}
/**
* Sets the naming convention for Kotlin enum properties
*
@ -261,6 +274,24 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
}
}
/**
* Sets the serialization engine for Kotlin
*
* @param enumSerializationLibrary The string representation of the serialization library as defined by
* {@link org.openapitools.codegen.languages.AbstractKotlinCodegen.SERIALIZATION_LIBRARY_TYPE}
*/
public void setSerializationLibrary(final String enumSerializationLibrary) {
try {
this.serializationLibrary = SERIALIZATION_LIBRARY_TYPE.valueOf(enumSerializationLibrary);
} catch (IllegalArgumentException ex) {
StringBuilder sb = new StringBuilder(enumSerializationLibrary + " is an invalid enum property naming option. Please choose from:");
for (SERIALIZATION_LIBRARY_TYPE t : SERIALIZATION_LIBRARY_TYPE.values()) {
sb.append("\n ").append(t.name());
}
throw new RuntimeException(sb.toString());
}
}
/**
* returns the swagger type for the property
*
@ -330,6 +361,14 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
setEnumPropertyNaming((String) additionalProperties.get(CodegenConstants.ENUM_PROPERTY_NAMING));
}
if (additionalProperties.containsKey(CodegenConstants.SERIALIZATION_LIBRARY)) {
setSerializationLibrary((String) additionalProperties.get(CodegenConstants.SERIALIZATION_LIBRARY));
additionalProperties.put(this.serializationLibrary.name(), true);
}
else {
additionalProperties.put(this.serializationLibrary.name(), true);
}
if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) {
this.setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER));
} else {

View File

@ -32,6 +32,9 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile "com.squareup.moshi:moshi-kotlin:1.8.0"
compile "com.squareup.moshi:moshi-adapters:1.8.0"
{{#gson}}
implementation "com.google.code.gson:gson:2.8.5"
{{/gson}}
compile "com.squareup.okhttp3:okhttp:4.0.1"
{{#threetenbp}}
compile "org.threeten:threetenbp:1.3.8"

View File

@ -1,4 +1,9 @@
{{#gson}}
import com.google.gson.annotations.SerializedName
{{/gson}}
{{#moshi}}
import com.squareup.moshi.Json
{{/moshi}}
{{#parcelizeModels}}
import android.os.Parcelable
import kotlinx.android.parcel.Parcelize
@ -19,17 +24,22 @@ data class {{classname}} (
{{/-last}}{{/requiredVars}}{{#hasRequired}}{{#hasOptional}},
{{/hasOptional}}{{/hasRequired}}{{#optionalVars}}{{>data_class_opt_var}}{{^-last}},
{{/-last}}{{/optionalVars}}
){{#parcelizeModels}} : Parcelable{{/parcelizeModels}} {
){{#parcelizeModels}} : Parcelable{{/parcelizeModels}}
{{#hasEnums}}{{#vars}}{{#isEnum}}
{
/**
* {{{description}}}
* Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
*/
enum class {{{nameInCamelCase}}}(val value: {{#isListContainer}}{{{ nestedType }}}{{/isListContainer}}{{^isListContainer}}{{{dataType}}}{{/isListContainer}}){
{{#allowableValues}}{{#enumVars}}
@Json(name = {{{value}}})
{{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}}
{{#moshi}}
@Json(name = {{{value}}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}}
{{/moshi}}
{{#gson}}
@SerializedName(value={{{value}}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}}
{{/gson}}
{{/enumVars}}{{/allowableValues}}
}
{{/isEnum}}{{/vars}}{{/hasEnums}}
}
{{/isEnum}}{{/vars}}{{/hasEnums}}

View File

@ -1,5 +1,10 @@
{{#description}}
/* {{{description}}} */
{{/description}}
{{#moshi}}
@Json(name = "{{{baseName}}}")
{{/moshi}}
{{#gson}}
@SerializedName("{{name}}")
{{/gson}}
val {{{name}}}: {{#isEnum}}{{#isListContainer}}{{#isList}}kotlin.collections.List{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{classname}}.{{{nameInCamelCase}}}>{{/isListContainer}}{{^isListContainer}}{{classname}}.{{{nameInCamelCase}}}{{/isListContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}}

View File

@ -1,5 +1,10 @@
{{#description}}
/* {{{description}}} */
{{/description}}
{{#moshi}}
@Json(name = "{{{baseName}}}")
{{/moshi}}
{{#gson}}
@SerializedName("{{name}}")
{{/gson}}
val {{{name}}}: {{#isEnum}}{{#isListContainer}}{{#isList}}kotlin.collections.List{{/isList}}{{^isList}}kotlin.Array{{/isList}}<{{classname}}.{{{nameInCamelCase}}}>{{/isListContainer}}{{^isListContainer}}{{classname}}.{{{nameInCamelCase}}}{{/isListContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}

View File

@ -1,4 +1,9 @@
{{#gson}}
import com.google.gson.annotations.SerializedName
{{/gson}}
{{#moshi}}
import com.squareup.moshi.Json
{{/moshi}}
/**
* {{{description}}}
@ -7,7 +12,12 @@ import com.squareup.moshi.Json
enum class {{classname}}(val value: {{{dataType}}}){
{{#allowableValues}}{{#enumVars}}
{{#moshi}}
@Json(name = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}})
{{/moshi}}
{{#gson}}
@SerializedName(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}})
{{/gson}}
{{#isListContainer}}
{{#isList}}
{{&name}}(listOf({{{value}}})){{^-last}},{{/-last}}{{#-last}};{{/-last}}

View File

@ -26,7 +26,6 @@ data class ApiResponse (
val type: kotlin.String? = null,
@Json(name = "message")
val message: kotlin.String? = null
) {
)
}

View File

@ -23,7 +23,6 @@ data class Category (
val id: kotlin.Long? = null,
@Json(name = "name")
val name: kotlin.String? = null
) {
)
}

View File

@ -36,24 +36,22 @@ data class Order (
val status: Order.Status? = null,
@Json(name = "complete")
val complete: kotlin.Boolean? = null
) {
)
{
/**
* Order Status
* Values: placed,approved,delivered
*/
enum class Status(val value: kotlin.String){
@Json(name = "placed")
placed("placed"),
@Json(name = "placed") placed("placed"),
@Json(name = "approved")
approved("approved"),
@Json(name = "approved") approved("approved"),
@Json(name = "delivered")
delivered("delivered");
@Json(name = "delivered") delivered("delivered");
}
}

View File

@ -38,24 +38,22 @@ data class Pet (
/* pet status in the store */
@Json(name = "status")
val status: Pet.Status? = null
) {
)
{
/**
* pet status in the store
* Values: available,pending,sold
*/
enum class Status(val value: kotlin.String){
@Json(name = "available")
available("available"),
@Json(name = "available") available("available"),
@Json(name = "pending")
pending("pending"),
@Json(name = "pending") pending("pending"),
@Json(name = "sold")
sold("sold");
@Json(name = "sold") sold("sold");
}
}

View File

@ -23,7 +23,6 @@ data class Tag (
val id: kotlin.Long? = null,
@Json(name = "name")
val name: kotlin.String? = null
) {
)
}

View File

@ -42,7 +42,6 @@ data class User (
/* User Status */
@Json(name = "userStatus")
val userStatus: kotlin.Int? = null
) {
)
}

View File

@ -26,7 +26,6 @@ data class ApiResponse (
val type: kotlin.String? = null,
@Json(name = "message")
val message: kotlin.String? = null
) {
)
}

View File

@ -23,7 +23,6 @@ data class Category (
val id: kotlin.Long? = null,
@Json(name = "name")
val name: kotlin.String? = null
) {
)
}

View File

@ -36,24 +36,22 @@ data class Order (
val status: Order.Status? = null,
@Json(name = "complete")
val complete: kotlin.Boolean? = null
) {
)
{
/**
* Order Status
* Values: placed,approved,delivered
*/
enum class Status(val value: kotlin.String){
@Json(name = "placed")
placed("placed"),
@Json(name = "placed") placed("placed"),
@Json(name = "approved")
approved("approved"),
@Json(name = "approved") approved("approved"),
@Json(name = "delivered")
delivered("delivered");
@Json(name = "delivered") delivered("delivered");
}
}

View File

@ -38,24 +38,22 @@ data class Pet (
/* pet status in the store */
@Json(name = "status")
val status: Pet.Status? = null
) {
)
{
/**
* pet status in the store
* Values: available,pending,sold
*/
enum class Status(val value: kotlin.String){
@Json(name = "available")
available("available"),
@Json(name = "available") available("available"),
@Json(name = "pending")
pending("pending"),
@Json(name = "pending") pending("pending"),
@Json(name = "sold")
sold("sold");
@Json(name = "sold") sold("sold");
}
}

View File

@ -23,7 +23,6 @@ data class Tag (
val id: kotlin.Long? = null,
@Json(name = "name")
val name: kotlin.String? = null
) {
)
}

View File

@ -42,7 +42,6 @@ data class User (
/* User Status */
@Json(name = "userStatus")
val userStatus: kotlin.Int? = null
) {
)
}

View File

@ -26,7 +26,6 @@ data class ApiResponse (
val type: kotlin.String? = null,
@Json(name = "message")
val message: kotlin.String? = null
) {
)
}

View File

@ -23,7 +23,6 @@ data class Category (
val id: kotlin.Long? = null,
@Json(name = "name")
val name: kotlin.String? = null
) {
)
}

View File

@ -36,24 +36,22 @@ data class Order (
val status: Order.Status? = null,
@Json(name = "complete")
val complete: kotlin.Boolean? = null
) {
)
{
/**
* Order Status
* Values: placed,approved,delivered
*/
enum class Status(val value: kotlin.String){
@Json(name = "placed")
placed("placed"),
@Json(name = "placed") placed("placed"),
@Json(name = "approved")
approved("approved"),
@Json(name = "approved") approved("approved"),
@Json(name = "delivered")
delivered("delivered");
@Json(name = "delivered") delivered("delivered");
}
}

View File

@ -38,24 +38,22 @@ data class Pet (
/* pet status in the store */
@Json(name = "status")
val status: Pet.Status? = null
) {
)
{
/**
* pet status in the store
* Values: available,pending,sold
*/
enum class Status(val value: kotlin.String){
@Json(name = "available")
available("available"),
@Json(name = "available") available("available"),
@Json(name = "pending")
pending("pending"),
@Json(name = "pending") pending("pending"),
@Json(name = "sold")
sold("sold");
@Json(name = "sold") sold("sold");
}
}

View File

@ -23,7 +23,6 @@ data class Tag (
val id: kotlin.Long? = null,
@Json(name = "name")
val name: kotlin.String? = null
) {
)
}

View File

@ -42,7 +42,6 @@ data class User (
/* User Status */
@Json(name = "userStatus")
val userStatus: kotlin.Int? = null
) {
)
}

View File

@ -23,7 +23,6 @@ data class AdditionalPropertiesClass (
val mapProperty: kotlin.collections.Map<kotlin.String, kotlin.String>? = null,
@Json(name = "map_of_map_property")
val mapOfMapProperty: kotlin.collections.Map<kotlin.String, kotlin.collections.Map<kotlin.String, kotlin.String>>? = null
) {
)
}

View File

@ -23,7 +23,6 @@ data class Animal (
val className: kotlin.String,
@Json(name = "color")
val color: kotlin.String? = null
) {
)
}

View File

@ -26,7 +26,6 @@ data class ApiResponse (
val type: kotlin.String? = null,
@Json(name = "message")
val message: kotlin.String? = null
) {
)
}

View File

@ -20,7 +20,6 @@ import com.squareup.moshi.Json
data class ArrayOfArrayOfNumberOnly (
@Json(name = "ArrayArrayNumber")
val arrayArrayNumber: kotlin.Array<kotlin.Array<java.math.BigDecimal>>? = null
) {
)
}

View File

@ -20,7 +20,6 @@ import com.squareup.moshi.Json
data class ArrayOfNumberOnly (
@Json(name = "ArrayNumber")
val arrayNumber: kotlin.Array<java.math.BigDecimal>? = null
) {
)
}

View File

@ -27,7 +27,6 @@ data class ArrayTest (
val arrayArrayOfInteger: kotlin.Array<kotlin.Array<kotlin.Long>>? = null,
@Json(name = "array_array_of_model")
val arrayArrayOfModel: kotlin.Array<kotlin.Array<ReadOnlyFirst>>? = null
) {
)
}

View File

@ -36,7 +36,6 @@ data class Capitalization (
/* Name of the pet */
@Json(name = "ATT_NAME")
val ATT_NAME: kotlin.String? = null
) {
)
}

View File

@ -26,7 +26,6 @@ data class Cat (
val declawed: kotlin.Boolean? = null,
@Json(name = "color")
val color: kotlin.String? = null
) {
)
}

View File

@ -20,7 +20,6 @@ import com.squareup.moshi.Json
data class CatAllOf (
@Json(name = "declawed")
val declawed: kotlin.Boolean? = null
) {
)
}

View File

@ -23,7 +23,6 @@ data class Category (
val name: kotlin.String,
@Json(name = "id")
val id: kotlin.Long? = null
) {
)
}

View File

@ -20,7 +20,6 @@ import com.squareup.moshi.Json
data class ClassModel (
@Json(name = "_class")
val propertyClass: kotlin.String? = null
) {
)
}

View File

@ -20,7 +20,6 @@ import com.squareup.moshi.Json
data class Client (
@Json(name = "client")
val client: kotlin.String? = null
) {
)
}

View File

@ -26,7 +26,6 @@ data class Dog (
val breed: kotlin.String? = null,
@Json(name = "color")
val color: kotlin.String? = null
) {
)
}

View File

@ -20,7 +20,6 @@ import com.squareup.moshi.Json
data class DogAllOf (
@Json(name = "breed")
val breed: kotlin.String? = null
) {
)
}

View File

@ -23,35 +23,34 @@ data class EnumArrays (
val justSymbol: EnumArrays.JustSymbol? = null,
@Json(name = "array_enum")
val arrayEnum: kotlin.Array<EnumArrays.ArrayEnum>? = null
) {
)
{
/**
*
* Values: greaterThanEqual,dollar
*/
enum class JustSymbol(val value: kotlin.String){
@Json(name = ">=")
greaterThanEqual(">="),
@Json(name = ">=") greaterThanEqual(">="),
@Json(name = "$")
dollar("$");
@Json(name = "$") dollar("$");
}
}
{
/**
*
* Values: fish,crab
*/
enum class ArrayEnum(val value: kotlin.String){
@Json(name = "fish")
fish("fish"),
@Json(name = "fish") fish("fish"),
@Json(name = "crab")
crab("crab");
@Json(name = "crab") crab("crab");
}
}

View File

@ -45,69 +45,66 @@ data class EnumTest (
val outerEnumDefaultValue: OuterEnumDefaultValue? = null,
@Json(name = "outerEnumIntegerDefaultValue")
val outerEnumIntegerDefaultValue: OuterEnumIntegerDefaultValue? = null
) {
)
{
/**
*
* Values: uPPER,lower,eMPTY
*/
enum class EnumString(val value: kotlin.String){
@Json(name = "UPPER")
uPPER("UPPER"),
@Json(name = "UPPER") uPPER("UPPER"),
@Json(name = "lower")
lower("lower"),
@Json(name = "lower") lower("lower"),
@Json(name = "")
eMPTY("");
@Json(name = "") eMPTY("");
}
}
{
/**
*
* Values: uPPER,lower,eMPTY
*/
enum class EnumStringRequired(val value: kotlin.String){
@Json(name = "UPPER")
uPPER("UPPER"),
@Json(name = "UPPER") uPPER("UPPER"),
@Json(name = "lower")
lower("lower"),
@Json(name = "lower") lower("lower"),
@Json(name = "")
eMPTY("");
@Json(name = "") eMPTY("");
}
}
{
/**
*
* Values: _1,minus1
*/
enum class EnumInteger(val value: kotlin.Int){
@Json(name = 1)
_1(1),
@Json(name = 1) _1(1),
@Json(name = -1)
minus1(-1);
@Json(name = -1) minus1(-1);
}
}
{
/**
*
* Values: _1period1,minus1Period2
*/
enum class EnumNumber(val value: kotlin.Double){
@Json(name = 1.1)
_1period1(1.1),
@Json(name = 1.1) _1period1(1.1),
@Json(name = -1.2)
minus1Period2(-1.2);
@Json(name = -1.2) minus1Period2(-1.2);
}
}

View File

@ -23,7 +23,6 @@ data class FileSchemaTestClass (
val file: java.io.File? = null,
@Json(name = "files")
val files: kotlin.Array<java.io.File>? = null
) {
)
}

View File

@ -20,7 +20,6 @@ import com.squareup.moshi.Json
data class Foo (
@Json(name = "bar")
val bar: kotlin.String? = null
) {
)
}

View File

@ -64,7 +64,6 @@ data class FormatTest (
/* A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. */
@Json(name = "pattern_with_digits_and_delimiter")
val patternWithDigitsAndDelimiter: kotlin.String? = null
) {
)
}

View File

@ -23,7 +23,6 @@ data class HasOnlyReadOnly (
val bar: kotlin.String? = null,
@Json(name = "foo")
val foo: kotlin.String? = null
) {
)
}

View File

@ -20,7 +20,6 @@ import com.squareup.moshi.Json
data class HealthCheckResult (
@Json(name = "NullableMessage")
val nullableMessage: kotlin.String? = null
) {
)
}

View File

@ -25,7 +25,6 @@ data class InlineObject (
/* Updated status of the pet */
@Json(name = "status")
val status: kotlin.String? = null
) {
)
}

View File

@ -25,7 +25,6 @@ data class InlineObject1 (
/* file to upload */
@Json(name = "file")
val file: java.io.File? = null
) {
)
}

View File

@ -25,38 +25,36 @@ data class InlineObject2 (
/* Form parameter enum test (string) */
@Json(name = "enum_form_string")
val enumFormString: InlineObject2.EnumFormString? = null
) {
)
{
/**
* Form parameter enum test (string array)
* Values: greaterThan,dollar
*/
enum class EnumFormStringArray(val value: kotlin.String){
@Json(name = ">")
greaterThan(">"),
@Json(name = ">") greaterThan(">"),
@Json(name = "$")
dollar("$");
@Json(name = "$") dollar("$");
}
}
{
/**
* Form parameter enum test (string)
* Values: abc,minusEfg,leftParenthesisXyzRightParenthesis
*/
enum class EnumFormString(val value: kotlin.String){
@Json(name = "_abc")
abc("_abc"),
@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)");
}
}

View File

@ -73,7 +73,6 @@ data class InlineObject3 (
/* None */
@Json(name = "callback")
val callback: kotlin.String? = null
) {
)
}

View File

@ -25,7 +25,6 @@ data class InlineObject4 (
/* field2 */
@Json(name = "param2")
val param2: kotlin.String
) {
)
}

View File

@ -25,7 +25,6 @@ data class InlineObject5 (
/* Additional data to pass to server */
@Json(name = "additionalMetadata")
val additionalMetadata: kotlin.String? = null
) {
)
}

View File

@ -21,7 +21,6 @@ import com.squareup.moshi.Json
data class InlineResponseDefault (
@Json(name = "string")
val string: Foo? = null
) {
)
}

View File

@ -20,7 +20,6 @@ import com.squareup.moshi.Json
data class List (
@Json(name = "123-list")
val `123minusList`: kotlin.String? = null
) {
)
}

View File

@ -29,21 +29,20 @@ data class MapTest (
val directMap: kotlin.collections.Map<kotlin.String, kotlin.Boolean>? = null,
@Json(name = "indirect_map")
val indirectMap: kotlin.collections.Map<kotlin.String, kotlin.Boolean>? = null
) {
)
{
/**
*
* Values: uPPER,lower
*/
enum class MapOfEnumString(val value: kotlin.collections.Map<kotlin.String, kotlin.String>){
@Json(name = "UPPER")
uPPER("UPPER"),
@Json(name = "UPPER") uPPER("UPPER"),
@Json(name = "lower")
lower("lower");
@Json(name = "lower") lower("lower");
}
}

View File

@ -27,7 +27,6 @@ data class MixedPropertiesAndAdditionalPropertiesClass (
val dateTime: java.time.LocalDateTime? = null,
@Json(name = "map")
val map: kotlin.collections.Map<kotlin.String, Animal>? = null
) {
)
}

View File

@ -23,7 +23,6 @@ data class Model200Response (
val name: kotlin.Int? = null,
@Json(name = "class")
val propertyClass: kotlin.String? = null
) {
)
}

View File

@ -29,7 +29,6 @@ data class Name (
val property: kotlin.String? = null,
@Json(name = "123Number")
val `123number`: kotlin.Int? = null
) {
)
}

View File

@ -53,7 +53,6 @@ data class NullableClass (
val objectAndItemsNullableProp: kotlin.collections.Map<kotlin.String, kotlin.Any>? = null,
@Json(name = "object_items_nullable")
val objectItemsNullable: kotlin.collections.Map<kotlin.String, kotlin.Any>? = null
) {
)
}

View File

@ -20,7 +20,6 @@ import com.squareup.moshi.Json
data class NumberOnly (
@Json(name = "JustNumber")
val justNumber: java.math.BigDecimal? = null
) {
)
}

View File

@ -36,24 +36,22 @@ data class Order (
val status: Order.Status? = null,
@Json(name = "complete")
val complete: kotlin.Boolean? = null
) {
)
{
/**
* Order Status
* Values: placed,approved,delivered
*/
enum class Status(val value: kotlin.String){
@Json(name = "placed")
placed("placed"),
@Json(name = "placed") placed("placed"),
@Json(name = "approved")
approved("approved"),
@Json(name = "approved") approved("approved"),
@Json(name = "delivered")
delivered("delivered");
@Json(name = "delivered") delivered("delivered");
}
}

View File

@ -26,7 +26,6 @@ data class OuterComposite (
val myString: kotlin.String? = null,
@Json(name = "my_boolean")
val myBoolean: kotlin.Boolean? = null
) {
)
}

View File

@ -38,24 +38,22 @@ data class Pet (
/* pet status in the store */
@Json(name = "status")
val status: Pet.Status? = null
) {
)
{
/**
* pet status in the store
* Values: available,pending,sold
*/
enum class Status(val value: kotlin.String){
@Json(name = "available")
available("available"),
@Json(name = "available") available("available"),
@Json(name = "pending")
pending("pending"),
@Json(name = "pending") pending("pending"),
@Json(name = "sold")
sold("sold");
@Json(name = "sold") sold("sold");
}
}

View File

@ -23,7 +23,6 @@ data class ReadOnlyFirst (
val bar: kotlin.String? = null,
@Json(name = "baz")
val baz: kotlin.String? = null
) {
)
}

View File

@ -20,7 +20,6 @@ import com.squareup.moshi.Json
data class Return (
@Json(name = "return")
val `return`: kotlin.Int? = null
) {
)
}

View File

@ -20,7 +20,6 @@ import com.squareup.moshi.Json
data class SpecialModelname (
@Json(name = "$special[property.name]")
val dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket: kotlin.Long? = null
) {
)
}

View File

@ -23,7 +23,6 @@ data class Tag (
val id: kotlin.Long? = null,
@Json(name = "name")
val name: kotlin.String? = null
) {
)
}

View File

@ -42,7 +42,6 @@ data class User (
/* User Status */
@Json(name = "userStatus")
val userStatus: kotlin.Int? = null
) {
)
}