[Java][okhttp-gson] better support for additional properties (#11964)

* add support for additiional properties in okhttp-gson java client

* deserialize with additional properties

* better handling of non-primitive type

* use entry set instead

* support disallowAdditionalPropertiesIfNotPresent

* remove additional properties in serialization
This commit is contained in:
William Cheng
2022-03-27 16:56:25 +08:00
committed by GitHub
parent efefbaf7d8
commit 6c1b68da91
158 changed files with 4630 additions and 677 deletions

View File

@@ -7,3 +7,4 @@ additionalProperties:
artifactId: petstore-okhttp-gson
hideGenerationTimestamp: "true"
useOneOfDiscriminatorLookup: "true"
disallowAdditionalPropertiesIfNotPresent: false

View File

@@ -446,6 +446,14 @@ public class JavaClientCodegen extends AbstractJavaCodegen
//supportingFiles.add(new SupportingFile("auth/OAuthOkHttpClient.mustache", authFolder, "OAuthOkHttpClient.java"));
//supportingFiles.add(new SupportingFile("auth/RetryingOAuth.mustache", authFolder, "RetryingOAuth.java"));
forceSerializationLibrary(SERIALIZATION_LIBRARY_GSON);
// Composed schemas can have the 'additionalProperties' keyword, as specified in JSON schema.
// In principle, this should be enabled by default for all code generators. However due to limitations
// in other code generators, support needs to be enabled on a case-by-case basis.
// The flag below should be set for all Java libraries, but the templates need to be ported
// one by one for each library.
supportsAdditionalPropertiesWithComposedSchema = true;
} else if (RETROFIT_2.equals(getLibrary())) {
supportingFiles.add(new SupportingFile("auth/OAuthOkHttpClient.mustache", authFolder, "OAuthOkHttpClient.java"));
supportingFiles.add(new SupportingFile("CollectionFormats.mustache", invokerFolder, "CollectionFormats.java"));

View File

@@ -0,0 +1,37 @@
{{#isAdditionalPropertiesTrue}}
/**
* A container for additional, undeclared properties.
* This is a holder for any undeclared properties as specified with
* the 'additionalProperties' keyword in the OAS document.
*/
private Map<String, Object> additionalProperties;
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
*/
public {{classname}} putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Object>();
}
this.additionalProperties.put(key, value);
return this;
}
/**
* Return the additional (undeclared) property.
*/
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
}
/**
* Return the additional (undeclared) property with the specified name.
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}
{{/isAdditionalPropertiesTrue}}

View File

@@ -10,6 +10,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -264,6 +265,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{/isReadOnly}}
{{/vars}}
{{>libraries/okhttp-gson/additional_properties}}
@Override
public boolean equals(Object o) {
@@ -279,7 +281,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
}{{#hasVars}}
{{classname}} {{classVarName}} = ({{classname}}) o;
return {{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}equalsNullable(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}} &&
{{/-last}}{{/vars}}{{#parent}} &&
{{/-last}}{{/vars}}{{#isAdditionalPropertiesTrue}}&&
Objects.equals(this.additionalProperties, {{classVarName}}.additionalProperties){{/isAdditionalPropertiesTrue}}{{#parent}} &&
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}}
{{/useReflectionEqualsHashCode}}
@@ -295,7 +298,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
return HashCodeBuilder.reflectionHashCode(this);
{{/useReflectionEqualsHashCode}}
{{^useReflectionEqualsHashCode}}
return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}{{#isAdditionalPropertiesTrue}}{{#hasVars}}, {{/hasVars}}{{^hasVars}}{{#parent}}, {{/parent}}{{/hasVars}}additionalProperties{{/isAdditionalPropertiesTrue}});
{{/useReflectionEqualsHashCode}}
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
@@ -316,6 +319,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{#vars}}
sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n");
{{/vars}}
{{#isAdditionalPropertiesTrue}}
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
{{/isAdditionalPropertiesTrue}}
sb.append("}");
return sb.toString();
}
@@ -423,6 +429,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
}
}
{{^hasChildren}}
{{^isAdditionalPropertiesTrue}}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
@@ -430,6 +438,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `{{classname}}` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
{{/isAdditionalPropertiesTrue}}
{{#requiredVars}}
{{#-first}}
@@ -512,6 +521,25 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
@Override
public void write(JsonWriter out, {{classname}} value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
{{#isAdditionalPropertiesTrue}}
obj.remove("additionalProperties");
// serialize additonal properties
if (value.getAdditionalProperties() != null) {
for (Map.Entry<String, Object> entry : value.getAdditionalProperties().entrySet()) {
if (entry.getValue() instanceof String)
obj.addProperty(entry.getKey(), (String) entry.getValue());
else if (entry.getValue() instanceof Number)
obj.addProperty(entry.getKey(), (Number) entry.getValue());
else if (entry.getValue() instanceof Boolean)
obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
else if (entry.getValue() instanceof Character)
obj.addProperty(entry.getKey(), (Character) entry.getValue());
else {
obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject());
}
}
}
{{/isAdditionalPropertiesTrue}}
elementAdapter.write(out, obj);
}
@@ -519,7 +547,30 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
public {{classname}} read(JsonReader in) throws IOException {
JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
validateJsonObject(jsonObj);
{{#isAdditionalPropertiesTrue}}
// store additional fields in the deserialized instance
{{classname}} instance = thisAdapter.fromJsonTree(jsonObj);
for (Map.Entry<String, JsonElement> entry : jsonObj.entrySet()) {
if (!openapiFields.contains(entry.getKey())) {
if (entry.getValue().isJsonPrimitive()) { // primitive type
if (entry.getValue().getAsJsonPrimitive().isString())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
else if (entry.getValue().getAsJsonPrimitive().isNumber())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
else if (entry.getValue().getAsJsonPrimitive().isBoolean())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
else
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
} else { // non-primitive type
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
}
}
}
return instance;
{{/isAdditionalPropertiesTrue}}
{{^isAdditionalPropertiesTrue}}
return thisAdapter.fromJsonTree(jsonObj);
{{/isAdditionalPropertiesTrue}}
}
}.nullSafe();

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -231,6 +232,7 @@ public class SomeObj {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -307,6 +309,7 @@ public class SomeObj {
throw new IllegalArgumentException(String.format("The required field(s) %s in SomeObj is not found in the empty JSON string", SomeObj.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -23,8 +23,6 @@ import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -38,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -49,7 +48,7 @@ import org.openapitools.client.JSON;
* AdditionalPropertiesAnyType
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AdditionalPropertiesAnyType extends HashMap<String, Object> {
public class AdditionalPropertiesAnyType {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
@@ -80,6 +79,7 @@ public class AdditionalPropertiesAnyType extends HashMap<String, Object> {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -89,20 +89,18 @@ public class AdditionalPropertiesAnyType extends HashMap<String, Object> {
return false;
}
AdditionalPropertiesAnyType additionalPropertiesAnyType = (AdditionalPropertiesAnyType) o;
return Objects.equals(this.name, additionalPropertiesAnyType.name) &&
super.equals(o);
return Objects.equals(this.name, additionalPropertiesAnyType.name);
}
@Override
public int hashCode() {
return Objects.hash(name, super.hashCode());
return Objects.hash(name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesAnyType {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
@@ -146,6 +144,7 @@ public class AdditionalPropertiesAnyType extends HashMap<String, Object> {
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesAnyType is not found in the empty JSON string", AdditionalPropertiesAnyType.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -23,9 +23,7 @@ import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -39,6 +37,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -50,7 +49,7 @@ import org.openapitools.client.JSON;
* AdditionalPropertiesArray
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AdditionalPropertiesArray extends HashMap<String, List> {
public class AdditionalPropertiesArray {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
@@ -81,6 +80,7 @@ public class AdditionalPropertiesArray extends HashMap<String, List> {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -90,20 +90,18 @@ public class AdditionalPropertiesArray extends HashMap<String, List> {
return false;
}
AdditionalPropertiesArray additionalPropertiesArray = (AdditionalPropertiesArray) o;
return Objects.equals(this.name, additionalPropertiesArray.name) &&
super.equals(o);
return Objects.equals(this.name, additionalPropertiesArray.name);
}
@Override
public int hashCode() {
return Objects.hash(name, super.hashCode());
return Objects.hash(name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesArray {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
@@ -147,6 +145,7 @@ public class AdditionalPropertiesArray extends HashMap<String, List> {
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesArray is not found in the empty JSON string", AdditionalPropertiesArray.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -23,8 +23,6 @@ import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -38,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -49,7 +48,7 @@ import org.openapitools.client.JSON;
* AdditionalPropertiesBoolean
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> {
public class AdditionalPropertiesBoolean {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
@@ -80,6 +79,7 @@ public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -89,20 +89,18 @@ public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> {
return false;
}
AdditionalPropertiesBoolean additionalPropertiesBoolean = (AdditionalPropertiesBoolean) o;
return Objects.equals(this.name, additionalPropertiesBoolean.name) &&
super.equals(o);
return Objects.equals(this.name, additionalPropertiesBoolean.name);
}
@Override
public int hashCode() {
return Objects.hash(name, super.hashCode());
return Objects.hash(name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesBoolean {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
@@ -146,6 +144,7 @@ public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> {
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesBoolean is not found in the empty JSON string", AdditionalPropertiesBoolean.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -40,6 +40,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -416,6 +417,7 @@ public class AdditionalPropertiesClass {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -510,6 +512,7 @@ public class AdditionalPropertiesClass {
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesClass is not found in the empty JSON string", AdditionalPropertiesClass.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -23,8 +23,6 @@ import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -38,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -49,7 +48,7 @@ import org.openapitools.client.JSON;
* AdditionalPropertiesInteger
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AdditionalPropertiesInteger extends HashMap<String, Integer> {
public class AdditionalPropertiesInteger {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
@@ -80,6 +79,7 @@ public class AdditionalPropertiesInteger extends HashMap<String, Integer> {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -89,20 +89,18 @@ public class AdditionalPropertiesInteger extends HashMap<String, Integer> {
return false;
}
AdditionalPropertiesInteger additionalPropertiesInteger = (AdditionalPropertiesInteger) o;
return Objects.equals(this.name, additionalPropertiesInteger.name) &&
super.equals(o);
return Objects.equals(this.name, additionalPropertiesInteger.name);
}
@Override
public int hashCode() {
return Objects.hash(name, super.hashCode());
return Objects.hash(name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesInteger {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
@@ -146,6 +144,7 @@ public class AdditionalPropertiesInteger extends HashMap<String, Integer> {
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesInteger is not found in the empty JSON string", AdditionalPropertiesInteger.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -24,8 +24,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -39,6 +37,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -50,7 +49,7 @@ import org.openapitools.client.JSON;
* AdditionalPropertiesNumber
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> {
public class AdditionalPropertiesNumber {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
@@ -81,6 +80,7 @@ public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -90,20 +90,18 @@ public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> {
return false;
}
AdditionalPropertiesNumber additionalPropertiesNumber = (AdditionalPropertiesNumber) o;
return Objects.equals(this.name, additionalPropertiesNumber.name) &&
super.equals(o);
return Objects.equals(this.name, additionalPropertiesNumber.name);
}
@Override
public int hashCode() {
return Objects.hash(name, super.hashCode());
return Objects.hash(name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesNumber {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
@@ -147,6 +145,7 @@ public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> {
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesNumber is not found in the empty JSON string", AdditionalPropertiesNumber.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -23,7 +23,6 @@ import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.Gson;
@@ -38,6 +37,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -49,7 +49,7 @@ import org.openapitools.client.JSON;
* AdditionalPropertiesObject
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AdditionalPropertiesObject extends HashMap<String, Map> {
public class AdditionalPropertiesObject {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
@@ -80,6 +80,7 @@ public class AdditionalPropertiesObject extends HashMap<String, Map> {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -89,20 +90,18 @@ public class AdditionalPropertiesObject extends HashMap<String, Map> {
return false;
}
AdditionalPropertiesObject additionalPropertiesObject = (AdditionalPropertiesObject) o;
return Objects.equals(this.name, additionalPropertiesObject.name) &&
super.equals(o);
return Objects.equals(this.name, additionalPropertiesObject.name);
}
@Override
public int hashCode() {
return Objects.hash(name, super.hashCode());
return Objects.hash(name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesObject {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
@@ -146,6 +145,7 @@ public class AdditionalPropertiesObject extends HashMap<String, Map> {
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesObject is not found in the empty JSON string", AdditionalPropertiesObject.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -23,8 +23,6 @@ import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -38,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -49,7 +48,7 @@ import org.openapitools.client.JSON;
* AdditionalPropertiesString
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AdditionalPropertiesString extends HashMap<String, String> {
public class AdditionalPropertiesString {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
@@ -80,6 +79,7 @@ public class AdditionalPropertiesString extends HashMap<String, String> {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -89,20 +89,18 @@ public class AdditionalPropertiesString extends HashMap<String, String> {
return false;
}
AdditionalPropertiesString additionalPropertiesString = (AdditionalPropertiesString) o;
return Objects.equals(this.name, additionalPropertiesString.name) &&
super.equals(o);
return Objects.equals(this.name, additionalPropertiesString.name);
}
@Override
public int hashCode() {
return Objects.hash(name, super.hashCode());
return Objects.hash(name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesString {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
@@ -146,6 +144,7 @@ public class AdditionalPropertiesString extends HashMap<String, String> {
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesString is not found in the empty JSON string", AdditionalPropertiesString.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -39,6 +39,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -109,6 +110,7 @@ public class Animal {
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -39,6 +39,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -89,6 +90,7 @@ public class ArrayOfArrayOfNumberOnly {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -153,6 +155,7 @@ public class ArrayOfArrayOfNumberOnly {
throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayOfArrayOfNumberOnly is not found in the empty JSON string", ArrayOfArrayOfNumberOnly.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -39,6 +39,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -89,6 +90,7 @@ public class ArrayOfNumberOnly {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -153,6 +155,7 @@ public class ArrayOfNumberOnly {
throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayOfNumberOnly is not found in the empty JSON string", ArrayOfNumberOnly.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -39,6 +39,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -159,6 +160,7 @@ public class ArrayTest {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -229,6 +231,7 @@ public class ArrayTest {
throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayTest is not found in the empty JSON string", ArrayTest.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -132,6 +133,7 @@ public class BigCat extends Cat {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -202,6 +204,7 @@ public class BigCat extends Cat {
throw new IllegalArgumentException(String.format("The required field(s) %s in BigCat is not found in the empty JSON string", BigCat.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -129,6 +130,7 @@ public class BigCatAllOf {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -193,6 +195,7 @@ public class BigCatAllOf {
throw new IllegalArgumentException(String.format("The required field(s) %s in BigCatAllOf is not found in the empty JSON string", BigCatAllOf.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -213,6 +214,7 @@ public class Capitalization {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -292,6 +294,7 @@ public class Capitalization {
throw new IllegalArgumentException(String.format("The required field(s) %s in Capitalization is not found in the empty JSON string", Capitalization.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -39,6 +39,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -82,6 +83,7 @@ public class Cat extends Animal {
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -78,6 +79,7 @@ public class CatAllOf {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -142,6 +144,7 @@ public class CatAllOf {
throw new IllegalArgumentException(String.format("The required field(s) %s in CatAllOf is not found in the empty JSON string", CatAllOf.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -105,6 +106,7 @@ public class Category {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -173,6 +175,7 @@ public class Category {
throw new IllegalArgumentException(String.format("The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -79,6 +80,7 @@ public class ClassModel {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -143,6 +145,7 @@ public class ClassModel {
throw new IllegalArgumentException(String.format("The required field(s) %s in ClassModel is not found in the empty JSON string", ClassModel.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -78,6 +79,7 @@ public class Client {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -142,6 +144,7 @@ public class Client {
throw new IllegalArgumentException(String.format("The required field(s) %s in Client is not found in the empty JSON string", Client.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -81,6 +82,7 @@ public class Dog extends Animal {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -150,6 +152,7 @@ public class Dog extends Animal {
throw new IllegalArgumentException(String.format("The required field(s) %s in Dog is not found in the empty JSON string", Dog.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -78,6 +79,7 @@ public class DogAllOf {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -142,6 +144,7 @@ public class DogAllOf {
throw new IllegalArgumentException(String.format("The required field(s) %s in DogAllOf is not found in the empty JSON string", DogAllOf.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -209,6 +210,7 @@ public class EnumArrays {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -276,6 +278,7 @@ public class EnumArrays {
throw new IllegalArgumentException(String.format("The required field(s) %s in EnumArrays is not found in the empty JSON string", EnumArrays.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -37,6 +37,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -379,6 +380,7 @@ public class EnumTest {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -456,6 +458,7 @@ public class EnumTest {
throw new IllegalArgumentException(String.format("The required field(s) %s in EnumTest is not found in the empty JSON string", EnumTest.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -39,6 +39,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -116,6 +117,7 @@ public class FileSchemaTestClass {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -183,6 +185,7 @@ public class FileSchemaTestClass {
throw new IllegalArgumentException(String.format("The required field(s) %s in FileSchemaTestClass is not found in the empty JSON string", FileSchemaTestClass.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -41,6 +41,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -444,6 +445,7 @@ public class FormatTest {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -551,6 +553,7 @@ public class FormatTest {
throw new IllegalArgumentException(String.format("The required field(s) %s in FormatTest is not found in the empty JSON string", FormatTest.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -97,6 +98,7 @@ public class HasOnlyReadOnly {
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -164,6 +166,7 @@ public class HasOnlyReadOnly {
throw new IllegalArgumentException(String.format("The required field(s) %s in HasOnlyReadOnly is not found in the empty JSON string", HasOnlyReadOnly.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -39,6 +39,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -241,6 +242,7 @@ public class MapTest {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -314,6 +316,7 @@ public class MapTest {
throw new IllegalArgumentException(String.format("The required field(s) %s in MapTest is not found in the empty JSON string", MapTest.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -42,6 +42,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -146,6 +147,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -216,6 +218,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
throw new IllegalArgumentException(String.format("The required field(s) %s in MixedPropertiesAndAdditionalPropertiesClass is not found in the empty JSON string", MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -106,6 +107,7 @@ public class Model200Response {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -173,6 +175,7 @@ public class Model200Response {
throw new IllegalArgumentException(String.format("The required field(s) %s in Model200Response is not found in the empty JSON string", Model200Response.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -132,6 +133,7 @@ public class ModelApiResponse {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -202,6 +204,7 @@ public class ModelApiResponse {
throw new IllegalArgumentException(String.format("The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -79,6 +80,7 @@ public class ModelFile {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -143,6 +145,7 @@ public class ModelFile {
throw new IllegalArgumentException(String.format("The required field(s) %s in ModelFile is not found in the empty JSON string", ModelFile.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -78,6 +79,7 @@ public class ModelList {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -142,6 +144,7 @@ public class ModelList {
throw new IllegalArgumentException(String.format("The required field(s) %s in ModelList is not found in the empty JSON string", ModelList.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -79,6 +80,7 @@ public class ModelReturn {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -143,6 +145,7 @@ public class ModelReturn {
throw new IllegalArgumentException(String.format("The required field(s) %s in ModelReturn is not found in the empty JSON string", ModelReturn.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -152,6 +153,7 @@ public class Name {
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -226,6 +228,7 @@ public class Name {
throw new IllegalArgumentException(String.format("The required field(s) %s in Name is not found in the empty JSON string", Name.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -37,6 +37,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -79,6 +80,7 @@ public class NumberOnly {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -143,6 +145,7 @@ public class NumberOnly {
throw new IllegalArgumentException(String.format("The required field(s) %s in NumberOnly is not found in the empty JSON string", NumberOnly.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -37,6 +37,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -263,6 +264,7 @@ public class Order {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -342,6 +344,7 @@ public class Order {
throw new IllegalArgumentException(String.format("The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -37,6 +37,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -133,6 +134,7 @@ public class OuterComposite {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -203,6 +205,7 @@ public class OuterComposite {
throw new IllegalArgumentException(String.format("The required field(s) %s in OuterComposite is not found in the empty JSON string", OuterComposite.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -42,6 +42,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -281,6 +282,7 @@ public class Pet {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -362,6 +364,7 @@ public class Pet {
throw new IllegalArgumentException(String.format("The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -104,6 +105,7 @@ public class ReadOnlyFirst {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -171,6 +173,7 @@ public class ReadOnlyFirst {
throw new IllegalArgumentException(String.format("The required field(s) %s in ReadOnlyFirst is not found in the empty JSON string", ReadOnlyFirst.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -78,6 +79,7 @@ public class SpecialModelName {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -142,6 +144,7 @@ public class SpecialModelName {
throw new IllegalArgumentException(String.format("The required field(s) %s in SpecialModelName is not found in the empty JSON string", SpecialModelName.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -105,6 +106,7 @@ public class Tag {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -172,6 +174,7 @@ public class Tag {
throw new IllegalArgumentException(String.format("The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -39,6 +39,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -194,6 +195,7 @@ public class TypeHolderDefault {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -275,6 +277,7 @@ public class TypeHolderDefault {
throw new IllegalArgumentException(String.format("The required field(s) %s in TypeHolderDefault is not found in the empty JSON string", TypeHolderDefault.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -39,6 +39,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -221,6 +222,7 @@ public class TypeHolderExample {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -306,6 +308,7 @@ public class TypeHolderExample {
throw new IllegalArgumentException(String.format("The required field(s) %s in TypeHolderExample is not found in the empty JSON string", TypeHolderExample.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -267,6 +268,7 @@ public class User {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -352,6 +354,7 @@ public class User {
throw new IllegalArgumentException(String.format("The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -39,6 +39,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -909,6 +910,7 @@ public class XmlItem {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -1057,6 +1059,7 @@ public class XmlItem {
throw new IllegalArgumentException(String.format("The required field(s) %s in XmlItem is not found in the empty JSON string", XmlItem.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -23,8 +23,6 @@ import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import android.os.Parcelable;
import android.os.Parcel;
@@ -40,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -51,13 +50,12 @@ import org.openapitools.client.JSON;
* AdditionalPropertiesAnyType
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AdditionalPropertiesAnyType extends HashMap<String, Object> implements Parcelable {
public class AdditionalPropertiesAnyType implements Parcelable {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
public AdditionalPropertiesAnyType() {
super();
}
public AdditionalPropertiesAnyType name(String name) {
@@ -83,6 +81,7 @@ public class AdditionalPropertiesAnyType extends HashMap<String, Object> impleme
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -92,20 +91,18 @@ public class AdditionalPropertiesAnyType extends HashMap<String, Object> impleme
return false;
}
AdditionalPropertiesAnyType additionalPropertiesAnyType = (AdditionalPropertiesAnyType) o;
return Objects.equals(this.name, additionalPropertiesAnyType.name) &&
super.equals(o);
return Objects.equals(this.name, additionalPropertiesAnyType.name);
}
@Override
public int hashCode() {
return Objects.hash(name, super.hashCode());
return Objects.hash(name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesAnyType {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
@@ -124,12 +121,10 @@ public class AdditionalPropertiesAnyType extends HashMap<String, Object> impleme
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeValue(name);
}
AdditionalPropertiesAnyType(Parcel in) {
super(in);
name = (String)in.readValue(null);
}
@@ -172,6 +167,7 @@ public class AdditionalPropertiesAnyType extends HashMap<String, Object> impleme
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesAnyType is not found in the empty JSON string", AdditionalPropertiesAnyType.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -23,9 +23,7 @@ import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.os.Parcelable;
import android.os.Parcel;
@@ -41,6 +39,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -52,13 +51,12 @@ import org.openapitools.client.JSON;
* AdditionalPropertiesArray
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AdditionalPropertiesArray extends HashMap<String, List> implements Parcelable {
public class AdditionalPropertiesArray implements Parcelable {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
public AdditionalPropertiesArray() {
super();
}
public AdditionalPropertiesArray name(String name) {
@@ -84,6 +82,7 @@ public class AdditionalPropertiesArray extends HashMap<String, List> implements
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -93,20 +92,18 @@ public class AdditionalPropertiesArray extends HashMap<String, List> implements
return false;
}
AdditionalPropertiesArray additionalPropertiesArray = (AdditionalPropertiesArray) o;
return Objects.equals(this.name, additionalPropertiesArray.name) &&
super.equals(o);
return Objects.equals(this.name, additionalPropertiesArray.name);
}
@Override
public int hashCode() {
return Objects.hash(name, super.hashCode());
return Objects.hash(name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesArray {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
@@ -125,12 +122,10 @@ public class AdditionalPropertiesArray extends HashMap<String, List> implements
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeValue(name);
}
AdditionalPropertiesArray(Parcel in) {
super(in);
name = (String)in.readValue(null);
}
@@ -173,6 +168,7 @@ public class AdditionalPropertiesArray extends HashMap<String, List> implements
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesArray is not found in the empty JSON string", AdditionalPropertiesArray.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -23,8 +23,6 @@ import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import android.os.Parcelable;
import android.os.Parcel;
@@ -40,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -51,13 +50,12 @@ import org.openapitools.client.JSON;
* AdditionalPropertiesBoolean
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> implements Parcelable {
public class AdditionalPropertiesBoolean implements Parcelable {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
public AdditionalPropertiesBoolean() {
super();
}
public AdditionalPropertiesBoolean name(String name) {
@@ -83,6 +81,7 @@ public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> implem
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -92,20 +91,18 @@ public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> implem
return false;
}
AdditionalPropertiesBoolean additionalPropertiesBoolean = (AdditionalPropertiesBoolean) o;
return Objects.equals(this.name, additionalPropertiesBoolean.name) &&
super.equals(o);
return Objects.equals(this.name, additionalPropertiesBoolean.name);
}
@Override
public int hashCode() {
return Objects.hash(name, super.hashCode());
return Objects.hash(name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesBoolean {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
@@ -124,12 +121,10 @@ public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> implem
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeValue(name);
}
AdditionalPropertiesBoolean(Parcel in) {
super(in);
name = (String)in.readValue(null);
}
@@ -172,6 +167,7 @@ public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> implem
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesBoolean is not found in the empty JSON string", AdditionalPropertiesBoolean.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -42,6 +42,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -418,6 +419,7 @@ public class AdditionalPropertiesClass implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -553,6 +555,7 @@ public class AdditionalPropertiesClass implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesClass is not found in the empty JSON string", AdditionalPropertiesClass.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -23,8 +23,6 @@ import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import android.os.Parcelable;
import android.os.Parcel;
@@ -40,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -51,13 +50,12 @@ import org.openapitools.client.JSON;
* AdditionalPropertiesInteger
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AdditionalPropertiesInteger extends HashMap<String, Integer> implements Parcelable {
public class AdditionalPropertiesInteger implements Parcelable {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
public AdditionalPropertiesInteger() {
super();
}
public AdditionalPropertiesInteger name(String name) {
@@ -83,6 +81,7 @@ public class AdditionalPropertiesInteger extends HashMap<String, Integer> implem
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -92,20 +91,18 @@ public class AdditionalPropertiesInteger extends HashMap<String, Integer> implem
return false;
}
AdditionalPropertiesInteger additionalPropertiesInteger = (AdditionalPropertiesInteger) o;
return Objects.equals(this.name, additionalPropertiesInteger.name) &&
super.equals(o);
return Objects.equals(this.name, additionalPropertiesInteger.name);
}
@Override
public int hashCode() {
return Objects.hash(name, super.hashCode());
return Objects.hash(name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesInteger {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
@@ -124,12 +121,10 @@ public class AdditionalPropertiesInteger extends HashMap<String, Integer> implem
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeValue(name);
}
AdditionalPropertiesInteger(Parcel in) {
super(in);
name = (String)in.readValue(null);
}
@@ -172,6 +167,7 @@ public class AdditionalPropertiesInteger extends HashMap<String, Integer> implem
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesInteger is not found in the empty JSON string", AdditionalPropertiesInteger.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -24,8 +24,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import android.os.Parcelable;
import android.os.Parcel;
@@ -41,6 +39,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -52,13 +51,12 @@ import org.openapitools.client.JSON;
* AdditionalPropertiesNumber
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> implements Parcelable {
public class AdditionalPropertiesNumber implements Parcelable {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
public AdditionalPropertiesNumber() {
super();
}
public AdditionalPropertiesNumber name(String name) {
@@ -84,6 +82,7 @@ public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> impl
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -93,20 +92,18 @@ public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> impl
return false;
}
AdditionalPropertiesNumber additionalPropertiesNumber = (AdditionalPropertiesNumber) o;
return Objects.equals(this.name, additionalPropertiesNumber.name) &&
super.equals(o);
return Objects.equals(this.name, additionalPropertiesNumber.name);
}
@Override
public int hashCode() {
return Objects.hash(name, super.hashCode());
return Objects.hash(name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesNumber {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
@@ -125,12 +122,10 @@ public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> impl
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeValue(name);
}
AdditionalPropertiesNumber(Parcel in) {
super(in);
name = (String)in.readValue(null);
}
@@ -173,6 +168,7 @@ public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> impl
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesNumber is not found in the empty JSON string", AdditionalPropertiesNumber.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -23,7 +23,6 @@ import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import android.os.Parcelable;
import android.os.Parcel;
@@ -40,6 +39,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -51,13 +51,12 @@ import org.openapitools.client.JSON;
* AdditionalPropertiesObject
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AdditionalPropertiesObject extends HashMap<String, Map> implements Parcelable {
public class AdditionalPropertiesObject implements Parcelable {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
public AdditionalPropertiesObject() {
super();
}
public AdditionalPropertiesObject name(String name) {
@@ -83,6 +82,7 @@ public class AdditionalPropertiesObject extends HashMap<String, Map> implements
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -92,20 +92,18 @@ public class AdditionalPropertiesObject extends HashMap<String, Map> implements
return false;
}
AdditionalPropertiesObject additionalPropertiesObject = (AdditionalPropertiesObject) o;
return Objects.equals(this.name, additionalPropertiesObject.name) &&
super.equals(o);
return Objects.equals(this.name, additionalPropertiesObject.name);
}
@Override
public int hashCode() {
return Objects.hash(name, super.hashCode());
return Objects.hash(name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesObject {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
@@ -124,12 +122,10 @@ public class AdditionalPropertiesObject extends HashMap<String, Map> implements
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeValue(name);
}
AdditionalPropertiesObject(Parcel in) {
super(in);
name = (String)in.readValue(null);
}
@@ -172,6 +168,7 @@ public class AdditionalPropertiesObject extends HashMap<String, Map> implements
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesObject is not found in the empty JSON string", AdditionalPropertiesObject.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -23,8 +23,6 @@ import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import android.os.Parcelable;
import android.os.Parcel;
@@ -40,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -51,13 +50,12 @@ import org.openapitools.client.JSON;
* AdditionalPropertiesString
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AdditionalPropertiesString extends HashMap<String, String> implements Parcelable {
public class AdditionalPropertiesString implements Parcelable {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
public AdditionalPropertiesString() {
super();
}
public AdditionalPropertiesString name(String name) {
@@ -83,6 +81,7 @@ public class AdditionalPropertiesString extends HashMap<String, String> implemen
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -92,20 +91,18 @@ public class AdditionalPropertiesString extends HashMap<String, String> implemen
return false;
}
AdditionalPropertiesString additionalPropertiesString = (AdditionalPropertiesString) o;
return Objects.equals(this.name, additionalPropertiesString.name) &&
super.equals(o);
return Objects.equals(this.name, additionalPropertiesString.name);
}
@Override
public int hashCode() {
return Objects.hash(name, super.hashCode());
return Objects.hash(name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesString {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
@@ -124,12 +121,10 @@ public class AdditionalPropertiesString extends HashMap<String, String> implemen
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeValue(name);
}
AdditionalPropertiesString(Parcel in) {
super(in);
name = (String)in.readValue(null);
}
@@ -172,6 +167,7 @@ public class AdditionalPropertiesString extends HashMap<String, String> implemen
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesString is not found in the empty JSON string", AdditionalPropertiesString.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -41,6 +41,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -111,6 +112,7 @@ public class Animal implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -41,6 +41,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -91,6 +92,7 @@ public class ArrayOfArrayOfNumberOnly implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -176,6 +178,7 @@ public class ArrayOfArrayOfNumberOnly implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayOfArrayOfNumberOnly is not found in the empty JSON string", ArrayOfArrayOfNumberOnly.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -41,6 +41,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -91,6 +92,7 @@ public class ArrayOfNumberOnly implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -176,6 +178,7 @@ public class ArrayOfNumberOnly implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayOfNumberOnly is not found in the empty JSON string", ArrayOfNumberOnly.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -41,6 +41,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -161,6 +162,7 @@ public class ArrayTest implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -256,6 +258,7 @@ public class ArrayTest implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayTest is not found in the empty JSON string", ArrayTest.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -40,6 +40,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -135,6 +136,7 @@ public class BigCat extends Cat implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -228,6 +230,7 @@ public class BigCat extends Cat implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in BigCat is not found in the empty JSON string", BigCat.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -131,6 +132,7 @@ public class BigCatAllOf implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -216,6 +218,7 @@ public class BigCatAllOf implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in BigCatAllOf is not found in the empty JSON string", BigCatAllOf.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -215,6 +216,7 @@ public class Capitalization implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -325,6 +327,7 @@ public class Capitalization implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in Capitalization is not found in the empty JSON string", Capitalization.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -41,6 +41,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -85,6 +86,7 @@ public class Cat extends Animal implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -80,6 +81,7 @@ public class CatAllOf implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -165,6 +167,7 @@ public class CatAllOf implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in CatAllOf is not found in the empty JSON string", CatAllOf.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -107,6 +108,7 @@ public class Category implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -198,6 +200,7 @@ public class Category implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -81,6 +82,7 @@ public class ClassModel implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -166,6 +168,7 @@ public class ClassModel implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in ClassModel is not found in the empty JSON string", ClassModel.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -80,6 +81,7 @@ public class Client implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -165,6 +167,7 @@ public class Client implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in Client is not found in the empty JSON string", Client.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -40,6 +40,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -84,6 +85,7 @@ public class Dog extends Animal implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -176,6 +178,7 @@ public class Dog extends Animal implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in Dog is not found in the empty JSON string", Dog.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -80,6 +81,7 @@ public class DogAllOf implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -165,6 +167,7 @@ public class DogAllOf implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in DogAllOf is not found in the empty JSON string", DogAllOf.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -40,6 +40,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -211,6 +212,7 @@ public class EnumArrays implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -301,6 +303,7 @@ public class EnumArrays implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in EnumArrays is not found in the empty JSON string", EnumArrays.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -39,6 +39,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -381,6 +382,7 @@ public class EnumTest implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -487,6 +489,7 @@ public class EnumTest implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in EnumTest is not found in the empty JSON string", EnumTest.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -41,6 +41,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -118,6 +119,7 @@ public class FileSchemaTestClass implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -208,6 +210,7 @@ public class FileSchemaTestClass implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in FileSchemaTestClass is not found in the empty JSON string", FileSchemaTestClass.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -43,6 +43,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -446,6 +447,7 @@ public class FormatTest implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -600,6 +602,7 @@ public class FormatTest implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in FormatTest is not found in the empty JSON string", FormatTest.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -99,6 +100,7 @@ public class HasOnlyReadOnly implements Parcelable {
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -189,6 +191,7 @@ public class HasOnlyReadOnly implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in HasOnlyReadOnly is not found in the empty JSON string", HasOnlyReadOnly.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -41,6 +41,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -243,6 +244,7 @@ public class MapTest implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -343,6 +345,7 @@ public class MapTest implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in MapTest is not found in the empty JSON string", MapTest.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -44,6 +44,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -148,6 +149,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -243,6 +245,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in MixedPropertiesAndAdditionalPropertiesClass is not found in the empty JSON string", MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -108,6 +109,7 @@ public class Model200Response implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -198,6 +200,7 @@ public class Model200Response implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in Model200Response is not found in the empty JSON string", Model200Response.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -134,6 +135,7 @@ public class ModelApiResponse implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -229,6 +231,7 @@ public class ModelApiResponse implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -81,6 +82,7 @@ public class ModelFile implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -166,6 +168,7 @@ public class ModelFile implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in ModelFile is not found in the empty JSON string", ModelFile.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -80,6 +81,7 @@ public class ModelList implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -165,6 +167,7 @@ public class ModelList implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in ModelList is not found in the empty JSON string", ModelList.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -81,6 +82,7 @@ public class ModelReturn implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -166,6 +168,7 @@ public class ModelReturn implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in ModelReturn is not found in the empty JSON string", ModelReturn.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -154,6 +155,7 @@ public class Name implements Parcelable {
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -255,6 +257,7 @@ public class Name implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in Name is not found in the empty JSON string", Name.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -39,6 +39,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -81,6 +82,7 @@ public class NumberOnly implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -166,6 +168,7 @@ public class NumberOnly implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in NumberOnly is not found in the empty JSON string", NumberOnly.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -39,6 +39,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -265,6 +266,7 @@ public class Order implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -375,6 +377,7 @@ public class Order implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -39,6 +39,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -135,6 +136,7 @@ public class OuterComposite implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -230,6 +232,7 @@ public class OuterComposite implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in OuterComposite is not found in the empty JSON string", OuterComposite.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -44,6 +44,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -283,6 +284,7 @@ public class Pet implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -395,6 +397,7 @@ public class Pet implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -106,6 +107,7 @@ public class ReadOnlyFirst implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -196,6 +198,7 @@ public class ReadOnlyFirst implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in ReadOnlyFirst is not found in the empty JSON string", ReadOnlyFirst.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -80,6 +81,7 @@ public class SpecialModelName implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -165,6 +167,7 @@ public class SpecialModelName implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in SpecialModelName is not found in the empty JSON string", SpecialModelName.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -107,6 +108,7 @@ public class Tag implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -197,6 +199,7 @@ public class Tag implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -41,6 +41,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -196,6 +197,7 @@ public class TypeHolderDefault implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -306,6 +308,7 @@ public class TypeHolderDefault implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in TypeHolderDefault is not found in the empty JSON string", TypeHolderDefault.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -41,6 +41,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -223,6 +224,7 @@ public class TypeHolderExample implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -339,6 +341,7 @@ public class TypeHolderExample implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in TypeHolderExample is not found in the empty JSON string", TypeHolderExample.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -269,6 +270,7 @@ public class User implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -389,6 +391,7 @@ public class User implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -41,6 +41,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -911,6 +912,7 @@ public class XmlItem implements Parcelable {
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -1136,6 +1138,7 @@ public class XmlItem implements Parcelable {
throw new IllegalArgumentException(String.format("The required field(s) %s in XmlItem is not found in the empty JSON string", XmlItem.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {

View File

@@ -40,6 +40,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -302,6 +303,42 @@ public class AdditionalPropertiesClass {
this.mapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString;
}
/**
* A container for additional, undeclared properties.
* This is a holder for any undeclared properties as specified with
* the 'additionalProperties' keyword in the OAS document.
*/
private Map<String, Object> additionalProperties;
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
*/
public AdditionalPropertiesClass putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Object>();
}
this.additionalProperties.put(key, value);
return this;
}
/**
* Return the additional (undeclared) property.
*/
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
}
/**
* Return the additional (undeclared) property with the specified name.
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}
@Override
public boolean equals(Object o) {
@@ -319,7 +356,8 @@ public class AdditionalPropertiesClass {
Objects.equals(this.mapWithUndeclaredPropertiesAnytype2, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype2) &&
Objects.equals(this.mapWithUndeclaredPropertiesAnytype3, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype3) &&
Objects.equals(this.emptyMap, additionalPropertiesClass.emptyMap) &&
Objects.equals(this.mapWithUndeclaredPropertiesString, additionalPropertiesClass.mapWithUndeclaredPropertiesString);
Objects.equals(this.mapWithUndeclaredPropertiesString, additionalPropertiesClass.mapWithUndeclaredPropertiesString)&&
Objects.equals(this.additionalProperties, additionalPropertiesClass.additionalProperties);
}
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
@@ -328,7 +366,7 @@ public class AdditionalPropertiesClass {
@Override
public int hashCode() {
return Objects.hash(mapProperty, mapOfMapProperty, anytype1, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, emptyMap, mapWithUndeclaredPropertiesString);
return Objects.hash(mapProperty, mapOfMapProperty, anytype1, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, emptyMap, mapWithUndeclaredPropertiesString, additionalProperties);
}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
@@ -350,6 +388,7 @@ public class AdditionalPropertiesClass {
sb.append(" mapWithUndeclaredPropertiesAnytype3: ").append(toIndentedString(mapWithUndeclaredPropertiesAnytype3)).append("\n");
sb.append(" emptyMap: ").append(toIndentedString(emptyMap)).append("\n");
sb.append(" mapWithUndeclaredPropertiesString: ").append(toIndentedString(mapWithUndeclaredPropertiesString)).append("\n");
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
sb.append("}");
return sb.toString();
}
@@ -399,13 +438,6 @@ public class AdditionalPropertiesClass {
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesClass is not found in the empty JSON string", AdditionalPropertiesClass.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
if (!AdditionalPropertiesClass.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesClass` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@@ -423,6 +455,23 @@ public class AdditionalPropertiesClass {
@Override
public void write(JsonWriter out, AdditionalPropertiesClass value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
obj.remove("additionalProperties");
// serialize additonal properties
if (value.getAdditionalProperties() != null) {
for (Map.Entry<String, Object> entry : value.getAdditionalProperties().entrySet()) {
if (entry.getValue() instanceof String)
obj.addProperty(entry.getKey(), (String) entry.getValue());
else if (entry.getValue() instanceof Number)
obj.addProperty(entry.getKey(), (Number) entry.getValue());
else if (entry.getValue() instanceof Boolean)
obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
else if (entry.getValue() instanceof Character)
obj.addProperty(entry.getKey(), (Character) entry.getValue());
else {
obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject());
}
}
}
elementAdapter.write(out, obj);
}
@@ -430,7 +479,25 @@ public class AdditionalPropertiesClass {
public AdditionalPropertiesClass read(JsonReader in) throws IOException {
JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
validateJsonObject(jsonObj);
return thisAdapter.fromJsonTree(jsonObj);
// store additional fields in the deserialized instance
AdditionalPropertiesClass instance = thisAdapter.fromJsonTree(jsonObj);
for (Map.Entry<String, JsonElement> entry : jsonObj.entrySet()) {
if (!openapiFields.contains(entry.getKey())) {
if (entry.getValue().isJsonPrimitive()) { // primitive type
if (entry.getValue().getAsJsonPrimitive().isString())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
else if (entry.getValue().getAsJsonPrimitive().isNumber())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
else if (entry.getValue().getAsJsonPrimitive().isBoolean())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
else
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
} else { // non-primitive type
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
}
}
}
return instance;
}
}.nullSafe();

View File

@@ -38,6 +38,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -107,6 +108,42 @@ public class Animal {
this.color = color;
}
/**
* A container for additional, undeclared properties.
* This is a holder for any undeclared properties as specified with
* the 'additionalProperties' keyword in the OAS document.
*/
private Map<String, Object> additionalProperties;
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
*/
public Animal putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Object>();
}
this.additionalProperties.put(key, value);
return this;
}
/**
* Return the additional (undeclared) property.
*/
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
}
/**
* Return the additional (undeclared) property with the specified name.
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}
@Override
public boolean equals(Object o) {
@@ -118,12 +155,13 @@ public class Animal {
}
Animal animal = (Animal) o;
return Objects.equals(this.className, animal.className) &&
Objects.equals(this.color, animal.color);
Objects.equals(this.color, animal.color)&&
Objects.equals(this.additionalProperties, animal.additionalProperties);
}
@Override
public int hashCode() {
return Objects.hash(className, color);
return Objects.hash(className, color, additionalProperties);
}
@Override
@@ -132,6 +170,7 @@ public class Animal {
sb.append("class Animal {\n");
sb.append(" className: ").append(toIndentedString(className)).append("\n");
sb.append(" color: ").append(toIndentedString(color)).append("\n");
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
sb.append("}");
return sb.toString();
}

View File

@@ -36,6 +36,7 @@ import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@@ -104,6 +105,42 @@ public class Apple {
this.origin = origin;
}
/**
* A container for additional, undeclared properties.
* This is a holder for any undeclared properties as specified with
* the 'additionalProperties' keyword in the OAS document.
*/
private Map<String, Object> additionalProperties;
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
*/
public Apple putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Object>();
}
this.additionalProperties.put(key, value);
return this;
}
/**
* Return the additional (undeclared) property.
*/
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
}
/**
* Return the additional (undeclared) property with the specified name.
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}
@Override
public boolean equals(Object o) {
@@ -115,12 +152,13 @@ public class Apple {
}
Apple apple = (Apple) o;
return Objects.equals(this.cultivar, apple.cultivar) &&
Objects.equals(this.origin, apple.origin);
Objects.equals(this.origin, apple.origin)&&
Objects.equals(this.additionalProperties, apple.additionalProperties);
}
@Override
public int hashCode() {
return Objects.hash(cultivar, origin);
return Objects.hash(cultivar, origin, additionalProperties);
}
@Override
@@ -129,6 +167,7 @@ public class Apple {
sb.append("class Apple {\n");
sb.append(" cultivar: ").append(toIndentedString(cultivar)).append("\n");
sb.append(" origin: ").append(toIndentedString(origin)).append("\n");
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
sb.append("}");
return sb.toString();
}
@@ -172,13 +211,6 @@ public class Apple {
throw new IllegalArgumentException(String.format("The required field(s) %s in Apple is not found in the empty JSON string", Apple.openapiRequiredFields.toString()));
}
}
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
if (!Apple.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Apple` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@@ -196,6 +228,23 @@ public class Apple {
@Override
public void write(JsonWriter out, Apple value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
obj.remove("additionalProperties");
// serialize additonal properties
if (value.getAdditionalProperties() != null) {
for (Map.Entry<String, Object> entry : value.getAdditionalProperties().entrySet()) {
if (entry.getValue() instanceof String)
obj.addProperty(entry.getKey(), (String) entry.getValue());
else if (entry.getValue() instanceof Number)
obj.addProperty(entry.getKey(), (Number) entry.getValue());
else if (entry.getValue() instanceof Boolean)
obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
else if (entry.getValue() instanceof Character)
obj.addProperty(entry.getKey(), (Character) entry.getValue());
else {
obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject());
}
}
}
elementAdapter.write(out, obj);
}
@@ -203,7 +252,25 @@ public class Apple {
public Apple read(JsonReader in) throws IOException {
JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
validateJsonObject(jsonObj);
return thisAdapter.fromJsonTree(jsonObj);
// store additional fields in the deserialized instance
Apple instance = thisAdapter.fromJsonTree(jsonObj);
for (Map.Entry<String, JsonElement> entry : jsonObj.entrySet()) {
if (!openapiFields.contains(entry.getKey())) {
if (entry.getValue().isJsonPrimitive()) { // primitive type
if (entry.getValue().getAsJsonPrimitive().isString())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
else if (entry.getValue().getAsJsonPrimitive().isNumber())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
else if (entry.getValue().getAsJsonPrimitive().isBoolean())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
else
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
} else { // non-primitive type
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
}
}
}
return instance;
}
}.nullSafe();

Some files were not shown because too many files have changed in this diff Show More