From f02332755826de8faa6ce42b238fd89247cd66cc Mon Sep 17 00:00:00 2001 From: SergeyLyakhov Date: Tue, 20 Mar 2018 18:10:24 +0200 Subject: [PATCH] [JAVA] 4709: codegen with parcelableMode fails to build if using arrays in swagger. (#7867) --- .../src/main/resources/Java/pojo.mustache | 67 ++++++++++---- .../okhttp-gson-parcelableModel/README.md | 57 ++++++++---- .../docs/EnumTest.md | 10 +++ .../model/AdditionalPropertiesClass.java | 10 +-- .../java/io/swagger/client/model/Animal.java | 8 +- .../io/swagger/client/model/AnimalFarm.java | 15 ++-- .../model/ArrayOfArrayOfNumberOnly.java | 9 +- .../client/model/ArrayOfNumberOnly.java | 9 +- .../io/swagger/client/model/ArrayTest.java | 11 +-- .../swagger/client/model/Capitalization.java | 14 +-- .../java/io/swagger/client/model/Cat.java | 12 +-- .../io/swagger/client/model/Category.java | 10 +-- .../io/swagger/client/model/ClassModel.java | 9 +- .../java/io/swagger/client/model/Client.java | 9 +- .../java/io/swagger/client/model/Dog.java | 12 +-- .../io/swagger/client/model/EnumArrays.java | 10 +-- .../io/swagger/client/model/EnumTest.java | 88 ++++++++++++++++--- .../io/swagger/client/model/FormatTest.java | 21 +---- .../swagger/client/model/HasOnlyReadOnly.java | 10 +-- .../java/io/swagger/client/model/MapTest.java | 10 +-- ...ropertiesAndAdditionalPropertiesClass.java | 11 +-- .../client/model/Model200Response.java | 10 +-- .../client/model/ModelApiResponse.java | 11 +-- .../io/swagger/client/model/ModelReturn.java | 9 +- .../java/io/swagger/client/model/Name.java | 12 +-- .../io/swagger/client/model/NumberOnly.java | 9 +- .../java/io/swagger/client/model/Order.java | 14 +-- .../swagger/client/model/OuterComposite.java | 11 +-- .../java/io/swagger/client/model/Pet.java | 14 +-- .../swagger/client/model/ReadOnlyFirst.java | 10 +-- .../client/model/SpecialModelName.java | 9 +- .../java/io/swagger/client/model/Tag.java | 10 +-- .../java/io/swagger/client/model/User.java | 16 +--- .../io/swagger/client/api/FakeApiTest.java | 39 +++++++- .../api/FakeClassnameTags123ApiTest.java | 2 +- 35 files changed, 314 insertions(+), 274 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/pojo.mustache b/modules/swagger-codegen/src/main/resources/Java/pojo.mustache index 5bbeef075ba5..03b0f666d3e0 100644 --- a/modules/swagger-codegen/src/main/resources/Java/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/pojo.mustache @@ -67,6 +67,19 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela {{/isContainer}} {{/vars}} + {{#parcelableModel}} + public {{classname}}() { + {{#parent}} + super(); + {{/parent}} + {{#gson}} + {{#discriminator}} + this.{{discriminator}} = this.getClass().getSimpleName(); + {{/discriminator}} + {{/gson}} + } + {{/parcelableModel}} + {{^parcelableModel}} {{#gson}} {{#discriminator}} public {{classname}}() { @@ -74,6 +87,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela } {{/discriminator}} {{/gson}} + {{/parcelableModel}} {{#vars}} {{^isReadOnly}} public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { @@ -203,27 +217,41 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela return o.toString().replace("\n", "\n "); } - {{#parcelableModel}} +{{#parcelableModel}} + public void writeToParcel(Parcel out, int flags) { - {{#parent}} super.writeToParcel(out, flags); {{/parent}} {{#vars}} +{{#model}} +{{#isArrayModel}} + out.writeList(this); +{{/isArrayModel}} +{{^isArrayModel}} +{{#parent}} + super.writeToParcel(out, flags); +{{/parent}} +{{#vars}} out.writeValue({{name}}); - {{/vars}} - } - - public {{classname}}() { - super(); +{{/vars}} +{{/isArrayModel}} +{{/model}} } {{classname}}(Parcel in) { - {{#parent}} super(in); {{/parent}} - {{#vars}} - {{#isPrimitiveType}} +{{#isArrayModel}} + in.readTypedList(this, {{arrayModelType}}.CREATOR); +{{/isArrayModel}} +{{^isArrayModel}} +{{#parent}} + super(in); +{{/parent}} +{{#vars}} +{{#isPrimitiveType}} {{name}} = ({{{datatypeWithEnum}}})in.readValue(null); - {{/isPrimitiveType}} - {{^isPrimitiveType}} +{{/isPrimitiveType}} +{{^isPrimitiveType}} {{name}} = ({{{datatypeWithEnum}}})in.readValue({{complexType}}.class.getClassLoader()); - {{/isPrimitiveType}} - {{/vars}} +{{/isPrimitiveType}} +{{/vars}} +{{/isArrayModel}} } public int describeContents() { @@ -232,11 +260,20 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela public static final Parcelable.Creator<{{classname}}> CREATOR = new Parcelable.Creator<{{classname}}>() { public {{classname}} createFromParcel(Parcel in) { +{{#model}} +{{#isArrayModel}} + {{classname}} result = new {{classname}}(); + result.addAll(in.readArrayList({{arrayModelType}}.class.getClassLoader())); + return result; +{{/isArrayModel}} +{{^isArrayModel}} return new {{classname}}(in); +{{/isArrayModel}} +{{/model}} } public {{classname}}[] newArray(int size) { return new {{classname}}[size]; } }; - {{/parcelableModel}} +{{/parcelableModel}} } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md index 8e55bbc51a23..cb9aa7a4531b 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md @@ -1,24 +1,35 @@ # swagger-petstore-okhttp-gson +Swagger Petstore +- API version: 1.0.0 + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + +*Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen)* + + ## Requirements -Building the API client library requires [Maven](https://maven.apache.org/) to be installed. +Building the API client library requires: +1. Java 1.7+ +2. Maven/Gradle ## Installation To install the API client library to your local Maven repository, simply execute: ```shell -mvn install +mvn clean install ``` To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: ```shell -mvn deploy +mvn clean deploy ``` -Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. ### Maven users @@ -26,10 +37,10 @@ Add this dependency to your project's POM: ```xml - io.swagger - swagger-petstore-okhttp-gson - 1.0.0 - compile + io.swagger + swagger-petstore-okhttp-gson + 1.0.0 + compile ``` @@ -45,12 +56,14 @@ compile "io.swagger:swagger-petstore-okhttp-gson:1.0.0" At first generate the JAR by executing: - mvn package +```shell +mvn clean package +``` Then manually install the following JARs: -* target/swagger-petstore-okhttp-gson-1.0.0.jar -* target/lib/*.jar +* `target/swagger-petstore-okhttp-gson-1.0.0.jar` +* `target/lib/*.jar` ## Getting Started @@ -61,22 +74,22 @@ Please follow the [installation](#installation) instruction and execute the foll import io.swagger.client.*; import io.swagger.client.auth.*; import io.swagger.client.model.*; -import io.swagger.client.api.FakeApi; +import io.swagger.client.api.AnotherFakeApi; import java.io.File; import java.util.*; -public class FakeApiExample { +public class AnotherFakeApiExample { public static void main(String[] args) { - FakeApi apiInstance = new FakeApi(); - Boolean body = true; // Boolean | Input boolean as post body + AnotherFakeApi apiInstance = new AnotherFakeApi(); + Client body = new Client(); // Client | client model try { - Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + Client result = apiInstance.testSpecialTags(body); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Exception when calling AnotherFakeApi#testSpecialTags"); e.printStackTrace(); } } @@ -90,6 +103,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**testSpecialTags**](docs/AnotherFakeApi.md#testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags *FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | *FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | *FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | @@ -97,6 +111,9 @@ Class | Method | HTTP request | Description *FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters +*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status @@ -164,6 +181,12 @@ Authentication schemes defined for the API: - **API key parameter name**: api_key - **Location**: HTTP header +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + ### http_basic_test - **Type**: HTTP basic authentication diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/EnumTest.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/EnumTest.md index 08fee3448821..ca048bcc515b 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/EnumTest.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/EnumTest.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | **enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] **outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] @@ -19,6 +20,15 @@ LOWER | "lower" EMPTY | "" + +## Enum: EnumStringRequiredEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + ## Enum: EnumIntegerEnum Name | Value diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java index d6232b0766d6..7ce8204c39f9 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java @@ -40,6 +40,8 @@ public class AdditionalPropertiesClass implements Parcelable { @SerializedName("map_of_map_property") private Map> mapOfMapProperty = null; + public AdditionalPropertiesClass() { + } public AdditionalPropertiesClass mapProperty(Map mapProperty) { this.mapProperty = mapProperty; return this; @@ -134,19 +136,13 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(mapProperty); - out.writeValue(mapOfMapProperty); } - public AdditionalPropertiesClass() { - super(); - } - AdditionalPropertiesClass(Parcel in) { - mapProperty = (Map)in.readValue(null); mapOfMapProperty = (Map>)in.readValue(Map.class.getClassLoader()); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Animal.java index 07b8f0ec8d74..464660e8ab4d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Animal.java @@ -119,19 +119,13 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(className); - out.writeValue(color); } - public Animal() { - super(); - } - Animal(Parcel in) { - className = (String)in.readValue(null); color = (String)in.readValue(null); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/AnimalFarm.java index e8f3fe5a5352..636fd5f15fa6 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/AnimalFarm.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -26,6 +26,9 @@ */ public class AnimalFarm extends ArrayList implements Parcelable { + public AnimalFarm() { + super(); + } @Override public boolean equals(java.lang.Object o) { @@ -64,15 +67,13 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } - public void writeToParcel(Parcel out, int flags) { - super.writeToParcel(out, flags); } - public AnimalFarm() { - super(); + public void writeToParcel(Parcel out, int flags) { + out.writeList(this); } AnimalFarm(Parcel in) { - super(in); + in.readTypedList(this, Animal.CREATOR); } public int describeContents() { @@ -81,7 +82,9 @@ public int describeContents() { public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { public AnimalFarm createFromParcel(Parcel in) { - return new AnimalFarm(in); + AnimalFarm result = new AnimalFarm(); + result.addAll(in.readArrayList(Animal.class.getClassLoader())); + return result; } public AnimalFarm[] newArray(int size) { return new AnimalFarm[size]; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java index 8e1541bb0211..1faee2b42783 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java @@ -37,6 +37,8 @@ public class ArrayOfArrayOfNumberOnly implements Parcelable { @SerializedName("ArrayArrayNumber") private List> arrayArrayNumber = null; + public ArrayOfArrayOfNumberOnly() { + } public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArrayNumber) { this.arrayArrayNumber = arrayArrayNumber; return this; @@ -103,17 +105,12 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(arrayArrayNumber); } - public ArrayOfArrayOfNumberOnly() { - super(); - } - ArrayOfArrayOfNumberOnly(Parcel in) { - arrayArrayNumber = (List>)in.readValue(List.class.getClassLoader()); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java index 8f81852c594c..700c0804ca19 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java @@ -37,6 +37,8 @@ public class ArrayOfNumberOnly implements Parcelable { @SerializedName("ArrayNumber") private List arrayNumber = null; + public ArrayOfNumberOnly() { + } public ArrayOfNumberOnly arrayNumber(List arrayNumber) { this.arrayNumber = arrayNumber; return this; @@ -103,17 +105,12 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(arrayNumber); } - public ArrayOfNumberOnly() { - super(); - } - ArrayOfNumberOnly(Parcel in) { - arrayNumber = (List)in.readValue(BigDecimal.class.getClassLoader()); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ArrayTest.java index 5e1826abb582..81ff78192d51 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ArrayTest.java @@ -43,6 +43,8 @@ public class ArrayTest implements Parcelable { @SerializedName("array_array_of_model") private List> arrayArrayOfModel = null; + public ArrayTest() { + } public ArrayTest arrayOfString(List arrayOfString) { this.arrayOfString = arrayOfString; return this; @@ -165,21 +167,14 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(arrayOfString); - out.writeValue(arrayArrayOfInteger); - out.writeValue(arrayArrayOfModel); } - public ArrayTest() { - super(); - } - ArrayTest(Parcel in) { - arrayOfString = (List)in.readValue(null); arrayArrayOfInteger = (List>)in.readValue(List.class.getClassLoader()); arrayArrayOfModel = (List>)in.readValue(List.class.getClassLoader()); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Capitalization.java index 57bef2e24bf4..bbe57c622f33 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Capitalization.java @@ -49,6 +49,8 @@ public class Capitalization implements Parcelable { @SerializedName("ATT_NAME") private String ATT_NAME = null; + public Capitalization() { + } public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; return this; @@ -207,27 +209,17 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(smallCamel); - out.writeValue(capitalCamel); - out.writeValue(smallSnake); - out.writeValue(capitalSnake); - out.writeValue(scAETHFlowPoints); - out.writeValue(ATT_NAME); } - public Capitalization() { - super(); - } - Capitalization(Parcel in) { - smallCamel = (String)in.readValue(null); capitalCamel = (String)in.readValue(null); smallSnake = (String)in.readValue(null); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Cat.java index ad00926df65a..575377073f3e 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Cat.java @@ -35,6 +35,9 @@ public class Cat extends Animal implements Parcelable { @SerializedName("declawed") private Boolean declawed = null; + public Cat() { + super(); + } public Cat declawed(Boolean declawed) { this.declawed = declawed; return this; @@ -94,17 +97,14 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - super.writeToParcel(out, flags); + super.writeToParcel(out, flags); out.writeValue(declawed); } - public Cat() { - super(); - } - Cat(Parcel in) { - super(in); + super(in); declawed = (Boolean)in.readValue(null); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Category.java index 6d5eec8a0960..8fc091f1ab8a 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Category.java @@ -37,6 +37,8 @@ public class Category implements Parcelable { @SerializedName("name") private String name = null; + public Category() { + } public Category id(Long id) { this.id = id; return this; @@ -115,19 +117,13 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(id); - out.writeValue(name); } - public Category() { - super(); - } - Category(Parcel in) { - id = (Long)in.readValue(null); name = (String)in.readValue(null); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ClassModel.java index 6740f0f8ae4a..30338298321f 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ClassModel.java @@ -35,6 +35,8 @@ public class ClassModel implements Parcelable { @SerializedName("_class") private String propertyClass = null; + public ClassModel() { + } public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; return this; @@ -93,17 +95,12 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(propertyClass); } - public ClassModel() { - super(); - } - ClassModel(Parcel in) { - propertyClass = (String)in.readValue(null); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Client.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Client.java index 51e327d3e94d..8803507238f8 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Client.java @@ -34,6 +34,8 @@ public class Client implements Parcelable { @SerializedName("client") private String client = null; + public Client() { + } public Client client(String client) { this.client = client; return this; @@ -92,17 +94,12 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(client); } - public Client() { - super(); - } - Client(Parcel in) { - client = (String)in.readValue(null); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Dog.java index a25dc15265a3..68f4b76980d5 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Dog.java @@ -35,6 +35,9 @@ public class Dog extends Animal implements Parcelable { @SerializedName("breed") private String breed = null; + public Dog() { + super(); + } public Dog breed(String breed) { this.breed = breed; return this; @@ -94,17 +97,14 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - super.writeToParcel(out, flags); + super.writeToParcel(out, flags); out.writeValue(breed); } - public Dog() { - super(); - } - Dog(Parcel in) { - super(in); + super(in); breed = (String)in.readValue(null); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/EnumArrays.java index 4483b1066ee7..8bccde759a12 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/EnumArrays.java @@ -133,6 +133,8 @@ public ArrayEnumEnum read(final JsonReader jsonReader) throws IOException { @SerializedName("array_enum") private List arrayEnum = null; + public EnumArrays() { + } public EnumArrays justSymbol(JustSymbolEnum justSymbol) { this.justSymbol = justSymbol; return this; @@ -219,19 +221,13 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(justSymbol); - out.writeValue(arrayEnum); } - public EnumArrays() { - super(); - } - EnumArrays(Parcel in) { - justSymbol = (JustSymbolEnum)in.readValue(null); arrayEnum = (List)in.readValue(null); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/EnumTest.java index 3d70e61b69c4..4f102f4f1e4f 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/EnumTest.java @@ -84,6 +84,58 @@ public EnumStringEnum read(final JsonReader jsonReader) throws IOException { @SerializedName("enum_string") private EnumStringEnum enumString = null; + /** + * Gets or Sets enumStringRequired + */ + @JsonAdapter(EnumStringRequiredEnum.Adapter.class) + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumStringRequiredEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumStringRequiredEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EnumStringRequiredEnum.fromValue(String.valueOf(value)); + } + } + } + + @SerializedName("enum_string_required") + private EnumStringRequiredEnum enumStringRequired = null; + /** * Gets or Sets enumInteger */ @@ -187,6 +239,8 @@ public EnumNumberEnum read(final JsonReader jsonReader) throws IOException { @SerializedName("outerEnum") private OuterEnum outerEnum = null; + public EnumTest() { + } public EnumTest enumString(EnumStringEnum enumString) { this.enumString = enumString; return this; @@ -205,6 +259,24 @@ public void setEnumString(EnumStringEnum enumString) { this.enumString = enumString; } + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { this.enumInteger = enumInteger; return this; @@ -270,6 +342,7 @@ public boolean equals(java.lang.Object o) { } EnumTest enumTest = (EnumTest) o; return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && Objects.equals(this.enumInteger, enumTest.enumInteger) && Objects.equals(this.enumNumber, enumTest.enumNumber) && Objects.equals(this.outerEnum, enumTest.outerEnum); @@ -277,7 +350,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); } @@ -287,6 +360,7 @@ public String toString() { sb.append("class EnumTest {\n"); sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).append("\n"); sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); @@ -305,24 +379,18 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(enumString); - + out.writeValue(enumStringRequired); out.writeValue(enumInteger); - out.writeValue(enumNumber); - out.writeValue(outerEnum); } - public EnumTest() { - super(); - } - EnumTest(Parcel in) { - enumString = (EnumStringEnum)in.readValue(null); + enumStringRequired = (EnumStringRequiredEnum)in.readValue(null); enumInteger = (EnumIntegerEnum)in.readValue(null); enumNumber = (EnumNumberEnum)in.readValue(null); outerEnum = (OuterEnum)in.readValue(OuterEnum.class.getClassLoader()); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/FormatTest.java index fa648da36940..4363f4015fd6 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/FormatTest.java @@ -74,6 +74,8 @@ public class FormatTest implements Parcelable { @SerializedName("password") private String password = null; + public FormatTest() { + } public FormatTest integer(Integer integer) { this.integer = integer; return this; @@ -382,41 +384,24 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(integer); - out.writeValue(int32); - out.writeValue(int64); - out.writeValue(number); - out.writeValue(_float); - out.writeValue(_double); - out.writeValue(string); - out.writeValue(_byte); - out.writeValue(binary); - out.writeValue(date); - out.writeValue(dateTime); - out.writeValue(uuid); - out.writeValue(password); } - public FormatTest() { - super(); - } - FormatTest(Parcel in) { - integer = (Integer)in.readValue(null); int32 = (Integer)in.readValue(null); int64 = (Long)in.readValue(null); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java index e1c681dff37a..1f42bfddf3fc 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java @@ -37,6 +37,8 @@ public class HasOnlyReadOnly implements Parcelable { @SerializedName("foo") private String foo = null; + public HasOnlyReadOnly() { + } /** * Get bar * @return bar @@ -97,19 +99,13 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(bar); - out.writeValue(foo); } - public HasOnlyReadOnly() { - super(); - } - HasOnlyReadOnly(Parcel in) { - bar = (String)in.readValue(null); foo = (String)in.readValue(null); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/MapTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/MapTest.java index 0088eb96eeeb..97be941cffa4 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/MapTest.java @@ -87,6 +87,8 @@ public InnerEnum read(final JsonReader jsonReader) throws IOException { @SerializedName("map_of_enum_string") private Map mapOfEnumString = null; + public MapTest() { + } public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; return this; @@ -181,19 +183,13 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(mapMapOfString); - out.writeValue(mapOfEnumString); } - public MapTest() { - super(); - } - MapTest(Parcel in) { - mapMapOfString = (Map>)in.readValue(Map.class.getClassLoader()); mapOfEnumString = (Map)in.readValue(null); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 2ff2d8f2a3e6..3e401f9ae2d3 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -46,6 +46,8 @@ public class MixedPropertiesAndAdditionalPropertiesClass implements Parcelable { @SerializedName("map") private Map map = null; + public MixedPropertiesAndAdditionalPropertiesClass() { + } public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { this.uuid = uuid; return this; @@ -152,21 +154,14 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(uuid); - out.writeValue(dateTime); - out.writeValue(map); } - public MixedPropertiesAndAdditionalPropertiesClass() { - super(); - } - MixedPropertiesAndAdditionalPropertiesClass(Parcel in) { - uuid = (UUID)in.readValue(UUID.class.getClassLoader()); dateTime = (OffsetDateTime)in.readValue(OffsetDateTime.class.getClassLoader()); map = (Map)in.readValue(Animal.class.getClassLoader()); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Model200Response.java index d975c9e4b6a6..4ea40d8f1f25 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Model200Response.java @@ -38,6 +38,8 @@ public class Model200Response implements Parcelable { @SerializedName("class") private String propertyClass = null; + public Model200Response() { + } public Model200Response name(Integer name) { this.name = name; return this; @@ -116,19 +118,13 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(name); - out.writeValue(propertyClass); } - public Model200Response() { - super(); - } - Model200Response(Parcel in) { - name = (Integer)in.readValue(null); propertyClass = (String)in.readValue(null); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ModelApiResponse.java index 6b6d98de85e1..c37d9d6d5218 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -40,6 +40,8 @@ public class ModelApiResponse implements Parcelable { @SerializedName("message") private String message = null; + public ModelApiResponse() { + } public ModelApiResponse code(Integer code) { this.code = code; return this; @@ -138,21 +140,14 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(code); - out.writeValue(type); - out.writeValue(message); } - public ModelApiResponse() { - super(); - } - ModelApiResponse(Parcel in) { - code = (Integer)in.readValue(null); type = (String)in.readValue(null); message = (String)in.readValue(null); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ModelReturn.java index 6939dc5ee3dd..dd8b0ae4eb6e 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ModelReturn.java @@ -35,6 +35,8 @@ public class ModelReturn implements Parcelable { @SerializedName("return") private Integer _return = null; + public ModelReturn() { + } public ModelReturn _return(Integer _return) { this._return = _return; return this; @@ -93,17 +95,12 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(_return); } - public ModelReturn() { - super(); - } - ModelReturn(Parcel in) { - _return = (Integer)in.readValue(null); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Name.java index 13640af182b1..7c79b8abda45 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Name.java @@ -44,6 +44,8 @@ public class Name implements Parcelable { @SerializedName("123Number") private Integer _123Number = null; + public Name() { + } public Name name(Integer name) { this.name = name; return this; @@ -144,23 +146,15 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(name); - out.writeValue(snakeCase); - out.writeValue(property); - out.writeValue(_123Number); } - public Name() { - super(); - } - Name(Parcel in) { - name = (Integer)in.readValue(null); snakeCase = (Integer)in.readValue(null); property = (String)in.readValue(null); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/NumberOnly.java index be6d26ebfc6d..b646df644cfb 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/NumberOnly.java @@ -35,6 +35,8 @@ public class NumberOnly implements Parcelable { @SerializedName("JustNumber") private BigDecimal justNumber = null; + public NumberOnly() { + } public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; return this; @@ -93,17 +95,12 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(justNumber); } - public NumberOnly() { - super(); - } - NumberOnly(Parcel in) { - justNumber = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader()); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Order.java index 5d7e4dcd342a..afe88ba943e0 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Order.java @@ -99,6 +99,8 @@ public StatusEnum read(final JsonReader jsonReader) throws IOException { @SerializedName("complete") private Boolean complete = false; + public Order() { + } public Order id(Long id) { this.id = id; return this; @@ -257,27 +259,17 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(id); - out.writeValue(petId); - out.writeValue(quantity); - out.writeValue(shipDate); - out.writeValue(status); - out.writeValue(complete); } - public Order() { - super(); - } - Order(Parcel in) { - id = (Long)in.readValue(null); petId = (Long)in.readValue(null); quantity = (Integer)in.readValue(null); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/OuterComposite.java index 323c7df04862..c5f5c06a3bbf 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/OuterComposite.java @@ -41,6 +41,8 @@ public class OuterComposite implements Parcelable { @SerializedName("my_boolean") private Boolean myBoolean = null; + public OuterComposite() { + } public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; return this; @@ -139,21 +141,14 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(myNumber); - out.writeValue(myString); - out.writeValue(myBoolean); } - public OuterComposite() { - super(); - } - OuterComposite(Parcel in) { - myNumber = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader()); myString = (String)in.readValue(null); myBoolean = (Boolean)in.readValue(null); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Pet.java index 0e9fa7ee9a74..e4d4fdb4f7fc 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Pet.java @@ -102,6 +102,8 @@ public StatusEnum read(final JsonReader jsonReader) throws IOException { @SerializedName("status") private StatusEnum status = null; + public Pet() { + } public Pet id(Long id) { this.id = id; return this; @@ -273,27 +275,17 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(id); - out.writeValue(category); - out.writeValue(name); - out.writeValue(photoUrls); - out.writeValue(tags); - out.writeValue(status); } - public Pet() { - super(); - } - Pet(Parcel in) { - id = (Long)in.readValue(null); category = (Category)in.readValue(Category.class.getClassLoader()); name = (String)in.readValue(null); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ReadOnlyFirst.java index ddea1d71395e..d686c8055895 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ReadOnlyFirst.java @@ -37,6 +37,8 @@ public class ReadOnlyFirst implements Parcelable { @SerializedName("baz") private String baz = null; + public ReadOnlyFirst() { + } /** * Get bar * @return bar @@ -106,19 +108,13 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(bar); - out.writeValue(baz); } - public ReadOnlyFirst() { - super(); - } - ReadOnlyFirst(Parcel in) { - bar = (String)in.readValue(null); baz = (String)in.readValue(null); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/SpecialModelName.java index d72d0735926a..ea63befdee26 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -34,6 +34,8 @@ public class SpecialModelName implements Parcelable { @SerializedName("$special[property.name]") private Long specialPropertyName = null; + public SpecialModelName() { + } public SpecialModelName specialPropertyName(Long specialPropertyName) { this.specialPropertyName = specialPropertyName; return this; @@ -92,17 +94,12 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(specialPropertyName); } - public SpecialModelName() { - super(); - } - SpecialModelName(Parcel in) { - specialPropertyName = (Long)in.readValue(null); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Tag.java index 8fa924b834c5..e44ca7fb1848 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Tag.java @@ -37,6 +37,8 @@ public class Tag implements Parcelable { @SerializedName("name") private String name = null; + public Tag() { + } public Tag id(Long id) { this.id = id; return this; @@ -115,19 +117,13 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(id); - out.writeValue(name); } - public Tag() { - super(); - } - Tag(Parcel in) { - id = (Long)in.readValue(null); name = (String)in.readValue(null); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/User.java index 9de1dd0bc37d..894536904ea1 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/User.java @@ -55,6 +55,8 @@ public class User implements Parcelable { @SerializedName("userStatus") private Integer userStatus = null; + public User() { + } public User id(Long id) { this.id = id; return this; @@ -253,31 +255,19 @@ private String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public void writeToParcel(Parcel out, int flags) { - out.writeValue(id); - out.writeValue(username); - out.writeValue(firstName); - out.writeValue(lastName); - out.writeValue(email); - out.writeValue(password); - out.writeValue(phone); - out.writeValue(userStatus); } - public User() { - super(); - } - User(Parcel in) { - id = (Long)in.readValue(null); username = (String)in.readValue(null); firstName = (String)in.readValue(null); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/test/java/io/swagger/client/api/FakeApiTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/test/java/io/swagger/client/api/FakeApiTest.java index 169209bd418d..0e4979b29060 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/test/java/io/swagger/client/api/FakeApiTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/test/java/io/swagger/client/api/FakeApiTest.java @@ -16,8 +16,8 @@ import io.swagger.client.ApiException; import java.math.BigDecimal; import io.swagger.client.model.Client; -import org.joda.time.DateTime; -import org.joda.time.LocalDate; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; import io.swagger.client.model.OuterComposite; import org.junit.Test; import org.junit.Ignore; @@ -137,7 +137,7 @@ public void testEndpointParametersTest() throws ApiException { String string = null; byte[] binary = null; LocalDate date = null; - DateTime dateTime = null; + OffsetDateTime dateTime = null; String password = null; String paramCallback = null; api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); @@ -168,4 +168,37 @@ public void testEnumParametersTest() throws ApiException { // TODO: test validations } + /** + * test inline additionalProperties + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testInlineAdditionalPropertiesTest() throws ApiException { + Object param = null; + api.testInlineAdditionalProperties(param); + + // TODO: test validations + } + + /** + * test json serialization of form data + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testJsonFormDataTest() throws ApiException { + String param = null; + String param2 = null; + api.testJsonFormData(param, param2); + + // TODO: test validations + } + } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java index af5885aadddb..06147652aad6 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java @@ -35,7 +35,7 @@ public class FakeClassnameTags123ApiTest { /** * To test class name in snake case * - * + * To test class name in snake case * * @throws ApiException * if the Api call fails