[java][restclient] Fix model combining properties and additional properties (#20947)

This commit is contained in:
João Brilhante 2025-04-23 09:57:57 +02:00 committed by GitHub
parent abce11152e
commit d2e20253e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
150 changed files with 1269 additions and 36 deletions

View File

@ -55,6 +55,8 @@
sha256: 45cdaba3d2adc212cd4f0184ad475419a95e2326254c2ef84175e210c922b2f3
- filename: "samples/client/petstore/java/feign/src/test/java/org/openapitools/client/JacksonTest.java"
sha256: 45cdaba3d2adc212cd4f0184ad475419a95e2326254c2ef84175e210c922b2f3
- filename: "samples/client/petstore/java/restclient/src/test/java/org/openapitools/client/JacksonTest.java"
sha256: 45cdaba3d2adc212cd4f0184ad475419a95e2326254c2ef84175e210c922b2f3
# rust axum test files
- filename: "samples/server/petstore/rust-axum/output/rust-axum-oneof/tests/oneof_with_discriminator.rs"
sha256: 2d4f5a069fdcb3057bb078d5e75b3de63cd477b97725e457079df24bd2c30600

View File

@ -634,6 +634,13 @@ public class JavaClientCodegen extends AbstractJavaCodegen
} else if (libRestClient) {
forceSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON);
applyJakartaPackage();
// 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 (libVertx) {
typeMapping.put("file", "AsyncFile");
importMapping.put("AsyncFile", "io.vertx.core.file.AsyncFile");

View File

@ -0,0 +1,45 @@
{{#additionalPropertiesType}}
/**
* 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, {{{.}}}> additionalProperties;
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
* @param key the name of the property
* @param value the value of the property
* @return self reference
*/
@JsonAnySetter
public {{classname}} putAdditionalProperty(String key, {{{.}}} value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, {{{.}}}>();
}
this.additionalProperties.put(key, value);
return this;
}
/**
* Return the additional (undeclared) properties.
* @return the additional (undeclared) properties
*/
@JsonAnyGetter
public Map<String, {{{.}}}> getAdditionalProperties() {
return additionalProperties;
}
/**
* Return the additional (undeclared) property with the specified name.
* @param key the name of the property
* @return the additional (undeclared) property with the specified name
*/
public {{{.}}} getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}
{{/additionalPropertiesType}}

View File

@ -0,0 +1,78 @@
{{>licenseInfo}}
package {{package}};
{{#useReflectionEqualsHashCode}}
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
{{/useReflectionEqualsHashCode}}
{{#models}}
{{#model}}
{{#additionalPropertiesType}}
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
{{/additionalPropertiesType}}
{{/model}}
{{/models}}
import java.util.Objects;
import java.util.Arrays;
{{#imports}}
import {{import}};
{{/imports}}
{{#serializableModel}}
import java.io.Serializable;
{{/serializableModel}}
{{#jackson}}
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
{{#withXml}}
import com.fasterxml.jackson.dataformat.xml.annotation.*;
{{/withXml}}
{{#vendorExtensions.x-has-readonly-properties}}
import com.fasterxml.jackson.annotation.JsonCreator;
{{/vendorExtensions.x-has-readonly-properties}}
{{/jackson}}
{{#withXml}}
import {{javaxPackage}}.xml.bind.annotation.*;
import {{javaxPackage}}.xml.bind.annotation.adapters.*;
import io.github.threetenjaxb.core.*;
{{/withXml}}
{{#jsonb}}
import java.lang.reflect.Type;
import {{javaxPackage}}.json.bind.annotation.JsonbTypeDeserializer;
import {{javaxPackage}}.json.bind.annotation.JsonbTypeSerializer;
import {{javaxPackage}}.json.bind.serializer.DeserializationContext;
import {{javaxPackage}}.json.bind.serializer.JsonbDeserializer;
import {{javaxPackage}}.json.bind.serializer.JsonbSerializer;
import {{javaxPackage}}.json.bind.serializer.SerializationContext;
import {{javaxPackage}}.json.stream.JsonGenerator;
import {{javaxPackage}}.json.stream.JsonParser;
import {{javaxPackage}}.json.bind.annotation.JsonbProperty;
{{#vendorExtensions.x-has-readonly-properties}}
import {{javaxPackage}}.json.bind.annotation.JsonbCreator;
{{/vendorExtensions.x-has-readonly-properties}}
{{/jsonb}}
{{#parcelableModel}}
import android.os.Parcelable;
import android.os.Parcel;
{{/parcelableModel}}
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
{{#performBeanValidation}}
import org.hibernate.validator.constraints.*;
{{/performBeanValidation}}
{{#supportUrlQuery}}
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.StringJoiner;
{{/supportUrlQuery}}
{{#models}}
{{#model}}
{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{#vendorExtensions.x-is-one-of-interface}}{{>oneof_interface}}{{/vendorExtensions.x-is-one-of-interface}}{{^vendorExtensions.x-is-one-of-interface}}{{>pojo}}{{/vendorExtensions.x-is-one-of-interface}}{{/isEnum}}
{{/model}}
{{/models}}

View File

@ -0,0 +1,620 @@
/**
* {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}}
* @deprecated{{/isDeprecated}}
*/{{#isDeprecated}}
@Deprecated{{/isDeprecated}}
{{#swagger1AnnotationLibrary}}
{{#description}}
@ApiModel(description = "{{{.}}}")
{{/description}}
{{/swagger1AnnotationLibrary}}
{{#swagger2AnnotationLibrary}}
{{#description}}
@Schema(description = "{{{.}}}")
{{/description}}
{{/swagger2AnnotationLibrary}}
{{#jackson}}
@JsonPropertyOrder({
{{#vars}}
{{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}}
{{/vars}}
})
{{#isClassnameSanitized}}
{{^hasDiscriminatorWithNonEmptyMapping}}
@JsonTypeName("{{name}}")
{{/hasDiscriminatorWithNonEmptyMapping}}
{{/isClassnameSanitized}}
{{/jackson}}
{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}}
{{#vendorExtensions.x-class-extra-annotation}}
{{{vendorExtensions.x-class-extra-annotation}}}
{{/vendorExtensions.x-class-extra-annotation}}
public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{
{{#serializableModel}}
private static final long serialVersionUID = 1L;
{{/serializableModel}}
{{#vars}}
{{#isEnum}}
{{^isContainer}}
{{>modelInnerEnum}}
{{/isContainer}}
{{#isContainer}}
{{#mostInnerItems}}
{{>modelInnerEnum}}
{{/mostInnerItems}}
{{/isContainer}}
{{/isEnum}}
{{#gson}}
public static final String SERIALIZED_NAME_{{nameInSnakeCase}} = "{{baseName}}";
{{/gson}}
{{#jackson}}
public static final String JSON_PROPERTY_{{nameInSnakeCase}} = "{{baseName}}";
{{/jackson}}
{{#withXml}}
@Xml{{#isXmlAttribute}}Attribute{{/isXmlAttribute}}{{^isXmlAttribute}}Element{{/isXmlAttribute}}(name = "{{items.xmlName}}{{^items.xmlName}}{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}{{/items.xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}})
{{#isXmlWrapped}}
@XmlElementWrapper(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}})
{{/isXmlWrapped}}
{{^isXmlAttribute}}
{{#isDateTime}}
@XmlJavaTypeAdapter(OffsetDateTimeXmlAdapter.class)
{{/isDateTime}}
{{/isXmlAttribute}}
{{/withXml}}
{{#gson}}
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
{{/gson}}
{{>nullable_var_annotations}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#vendorExtensions.x-is-jackson-optional-nullable}}
{{#isContainer}}
{{#hasChildren}}protected{{/hasChildren}}{{^hasChildren}}private{{/hasChildren}} JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined();
{{/isContainer}}
{{^isContainer}}
{{#hasChildren}}protected{{/hasChildren}}{{^hasChildren}}private{{/hasChildren}} JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}};
{{/isContainer}}
{{/vendorExtensions.x-is-jackson-optional-nullable}}
{{^vendorExtensions.x-is-jackson-optional-nullable}}
{{#isContainer}}
{{#hasChildren}}protected{{/hasChildren}}{{^hasChildren}}private{{/hasChildren}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
{{/isContainer}}
{{^isContainer}}
{{#hasChildren}}protected{{/hasChildren}}{{^hasChildren}}private{{/hasChildren}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};
{{/isContainer}}
{{/vendorExtensions.x-is-jackson-optional-nullable}}
{{/vars}}
public {{classname}}() {
{{#parent}}
{{#parcelableModel}}
super();{{/parcelableModel}}
{{/parent}}
{{#gson}}
{{#discriminator}}
{{#discriminator.isEnum}}
this.{{{discriminatorName}}} = this.getClass().getSimpleName();
{{/discriminator.isEnum}}
{{/discriminator}}
{{/gson}}
}
{{#vendorExtensions.x-has-readonly-properties}}
{{^withXml}}
/**
* Constructor with only readonly parameters{{#generateConstructorWithAllArgs}}{{^vendorExtensions.x-java-all-args-constructor}} and all parameters{{/vendorExtensions.x-java-all-args-constructor}}{{/generateConstructorWithAllArgs}}
*/
{{#jsonb}}@JsonbCreator{{/jsonb}}{{#jackson}}@JsonCreator{{/jackson}}
public {{classname}}(
{{#readOnlyVars}}
{{#jsonb}}@JsonbProperty(value = "{{baseName}}"{{^required}}, nullable = true{{/required}}){{/jsonb}}{{#jackson}}@JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}){{/jackson}} {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}}
{{/readOnlyVars}}
) {
this();
{{#readOnlyVars}}
this.{{name}} = {{#vendorExtensions.x-is-jackson-optional-nullable}}{{name}} == null ? JsonNullable.<{{{datatypeWithEnum}}}>undefined() : JsonNullable.of({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{name}}{{/vendorExtensions.x-is-jackson-optional-nullable}};
{{/readOnlyVars}}
}
{{/withXml}}
{{/vendorExtensions.x-has-readonly-properties}}
{{#vendorExtensions.x-java-all-args-constructor}}
/**
* Constructor with all args parameters
*/
public {{classname}}({{#vendorExtensions.x-java-all-args-constructor-vars}}{{#jsonb}}@JsonbProperty(value = "{{baseName}}"{{^required}}, nullable = true{{/required}}){{/jsonb}}{{#jackson}}@JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}){{/jackson}} {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-java-all-args-constructor-vars}}) {
{{#parent}}
super({{#parentVars}}{{name}}{{^-last}}, {{/-last}}{{/parentVars}});
{{/parent}}
{{#vars}}
this.{{name}} = {{#vendorExtensions.x-is-jackson-optional-nullable}}{{name}} == null ? JsonNullable.<{{{datatypeWithEnum}}}>undefined() : JsonNullable.of({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{name}}{{/vendorExtensions.x-is-jackson-optional-nullable}};
{{/vars}}
}
{{/vendorExtensions.x-java-all-args-constructor}}
{{#vars}}
{{^isReadOnly}}
public {{classname}} {{name}}({{>nullable_var_annotations}} {{{datatypeWithEnum}}} {{name}}) {
{{#vendorExtensions.x-is-jackson-optional-nullable}}this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}});{{/vendorExtensions.x-is-jackson-optional-nullable}}
{{^vendorExtensions.x-is-jackson-optional-nullable}}this.{{name}} = {{name}};{{/vendorExtensions.x-is-jackson-optional-nullable}}
return this;
}
{{#isArray}}
public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
{{#vendorExtensions.x-is-jackson-optional-nullable}}
if (this.{{name}} == null || !this.{{name}}.isPresent()) {
this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}});
}
try {
this.{{name}}.get().add({{name}}Item);
} catch (java.util.NoSuchElementException e) {
// this can never happen, as we make sure above that the value is present
}
return this;
{{/vendorExtensions.x-is-jackson-optional-nullable}}
{{^vendorExtensions.x-is-jackson-optional-nullable}}
if (this.{{name}} == null) {
this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}};
}
this.{{name}}.add({{name}}Item);
return this;
{{/vendorExtensions.x-is-jackson-optional-nullable}}
}
{{/isArray}}
{{#isMap}}
public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) {
{{#vendorExtensions.x-is-jackson-optional-nullable}}
if (this.{{name}} == null || !this.{{name}}.isPresent()) {
this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}});
}
try {
this.{{name}}.get().put(key, {{name}}Item);
} catch (java.util.NoSuchElementException e) {
// this can never happen, as we make sure above that the value is present
}
return this;
{{/vendorExtensions.x-is-jackson-optional-nullable}}
{{^vendorExtensions.x-is-jackson-optional-nullable}}
{{^required}}
if (this.{{name}} == null) {
this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}};
}
{{/required}}
this.{{name}}.put(key, {{name}}Item);
return this;
{{/vendorExtensions.x-is-jackson-optional-nullable}}
}
{{/isMap}}
{{/isReadOnly}}
/**
{{#description}}
* {{.}}
{{/description}}
{{^description}}
* Get {{name}}
{{/description}}
{{#minimum}}
* minimum: {{.}}
{{/minimum}}
{{#maximum}}
* maximum: {{.}}
{{/maximum}}
* @return {{name}}
{{#deprecated}}
* @deprecated
{{/deprecated}}
*/
{{#deprecated}}
@Deprecated
{{/deprecated}}
{{>nullable_var_annotations}}
{{#jsonb}}
@JsonbProperty("{{baseName}}")
{{/jsonb}}
{{#useBeanValidation}}
{{>beanValidation}}
{{/useBeanValidation}}
{{#swagger1AnnotationLibrary}}
@ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
{{/swagger1AnnotationLibrary}}
{{#swagger2AnnotationLibrary}}
@Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}")
{{/swagger2AnnotationLibrary}}
{{#vendorExtensions.x-extra-annotation}}
{{{vendorExtensions.x-extra-annotation}}}
{{/vendorExtensions.x-extra-annotation}}
{{#vendorExtensions.x-is-jackson-optional-nullable}}
{{!unannotated, Jackson would pick this up automatically and add it *in addition* to the _JsonNullable getter field}}
@JsonIgnore
{{/vendorExtensions.x-is-jackson-optional-nullable}}
{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#jackson}}{{> jackson_annotations}}{{/jackson}}{{/vendorExtensions.x-is-jackson-optional-nullable}}
public {{{datatypeWithEnum}}} {{getter}}() {
{{#vendorExtensions.x-is-jackson-optional-nullable}}
{{#isReadOnly}}{{! A readonly attribute doesn't have setter => jackson will set null directly if explicitly returned by API, so make sure we have an empty JsonNullable}}
if ({{name}} == null) {
{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}};
}
{{/isReadOnly}}
return {{name}}.orElse(null);
{{/vendorExtensions.x-is-jackson-optional-nullable}}
{{^vendorExtensions.x-is-jackson-optional-nullable}}
return {{name}};
{{/vendorExtensions.x-is-jackson-optional-nullable}}
}
{{#vendorExtensions.x-is-jackson-optional-nullable}}
{{> jackson_annotations}}
public JsonNullable<{{{datatypeWithEnum}}}> {{getter}}_JsonNullable() {
return {{name}};
}
{{/vendorExtensions.x-is-jackson-optional-nullable}}{{#vendorExtensions.x-is-jackson-optional-nullable}}
@JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}})
{{#isReadOnly}}private{{/isReadOnly}}{{^isReadOnly}}public{{/isReadOnly}} void {{setter}}_JsonNullable(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) {
{{! For getters/setters that have name differing from attribute name, we must include setter (albeit private) for jackson to be able to set the attribute}}
this.{{name}} = {{name}};
}
{{/vendorExtensions.x-is-jackson-optional-nullable}}
{{^isReadOnly}}
{{#vendorExtensions.x-setter-extra-annotation}} {{{vendorExtensions.x-setter-extra-annotation}}}
{{/vendorExtensions.x-setter-extra-annotation}}{{#jackson}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{> jackson_annotations}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{/jackson}} public void {{setter}}({{>nullable_var_annotations}} {{{datatypeWithEnum}}} {{name}}) {
{{#vendorExtensions.x-is-jackson-optional-nullable}}
this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}});
{{/vendorExtensions.x-is-jackson-optional-nullable}}
{{^vendorExtensions.x-is-jackson-optional-nullable}}
this.{{name}} = {{name}};
{{/vendorExtensions.x-is-jackson-optional-nullable}}
}
{{/isReadOnly}}
{{/vars}}
{{>libraries/restclient/additional_properties}}
{{#parent}}
{{#readWriteVars}}
{{#isOverridden}}
@Override
public {{classname}} {{name}}({{>nullable_var_annotations}} {{{datatypeWithEnum}}} {{name}}) {
{{#vendorExtensions.x-is-jackson-optional-nullable}}
this.{{setter}}(JsonNullable.<{{{datatypeWithEnum}}}>of({{name}}));
{{/vendorExtensions.x-is-jackson-optional-nullable}}
{{^vendorExtensions.x-is-jackson-optional-nullable}}
this.{{setter}}({{name}});
{{/vendorExtensions.x-is-jackson-optional-nullable}}
return this;
}
{{/isOverridden}}
{{/readWriteVars}}
{{/parent}}
@Override
public boolean equals(Object o) {
{{#useReflectionEqualsHashCode}}
return EqualsBuilder.reflectionEquals(this, o, false, null, true);
{{/useReflectionEqualsHashCode}}
{{^useReflectionEqualsHashCode}}
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}{{#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}}{{#additionalPropertiesType}} &&
Objects.equals(this.additionalProperties, {{classVarName}}.additionalProperties){{/additionalPropertiesType}}{{#parent}} &&
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}}
{{/useReflectionEqualsHashCode}}
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
@Override
public int hashCode() {
{{#useReflectionEqualsHashCode}}
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}}{{#additionalPropertiesType}}, additionalProperties{{/additionalPropertiesType}});
{{/useReflectionEqualsHashCode}}
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class {{classname}} {\n");
{{#parent}}
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
{{/parent}}
{{#vars}}
sb.append(" {{name}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{name}}){{/isPassword}}).append("\n");
{{/vars}}
{{#additionalPropertiesType}}
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
{{/additionalPropertiesType}}
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private{{#jsonb}} static{{/jsonb}} String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
{{#supportUrlQuery}}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
{{#allVars}}
// add `{{baseName}}` to the URL query string
{{#isArray}}
{{#items.isPrimitiveType}}
{{#uniqueItems}}
if ({{getter}}() != null) {
int i = 0;
for ({{{items.datatypeWithEnum}}} _item : {{getter}}()) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
}
}
i++;
}
{{/uniqueItems}}
{{^uniqueItems}}
if ({{getter}}() != null) {
for (int i = 0; i < {{getter}}().size(); i++) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
}
}
}
{{/uniqueItems}}
{{/items.isPrimitiveType}}
{{^items.isPrimitiveType}}
{{#items.isModel}}
{{#uniqueItems}}
if ({{getter}}() != null) {
int i = 0;
for ({{{items.dataType}}} _item : {{getter}}()) {
if (_item != null) {
joiner.add(_item.toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
}
}
i++;
}
{{/uniqueItems}}
{{^uniqueItems}}
if ({{getter}}() != null) {
for (int i = 0; i < {{getter}}().size(); i++) {
if ({{getter}}().get(i) != null) {
joiner.add({{getter}}().get(i).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
{{/uniqueItems}}
{{/items.isModel}}
{{^items.isModel}}
{{#uniqueItems}}
if ({{getter}}() != null) {
int i = 0;
for ({{{items.dataType}}} _item : {{getter}}()) {
if (_item != null) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
}
}
i++;
}
}
{{/uniqueItems}}
{{^uniqueItems}}
if ({{getter}}() != null) {
for (int i = 0; i < {{getter}}().size(); i++) {
if ({{getter}}().get(i) != null) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
}
}
}
}
{{/uniqueItems}}
{{/items.isModel}}
{{/items.isPrimitiveType}}
{{/isArray}}
{{^isArray}}
{{#isMap}}
{{^items.isModel}}
if ({{getter}}() != null) {
for (String _key : {{getter}}().keySet()) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix),
{{getter}}().get(_key), URLEncoder.encode(String.valueOf({{getter}}().get(_key)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
}
}
}
{{/items.isModel}}
{{#items.isModel}}
if ({{getter}}() != null) {
for (String _key : {{getter}}().keySet()) {
if ({{getter}}().get(_key) != null) {
joiner.add({{getter}}().get(_key).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix))));
}
}
}
{{/items.isModel}}
{{/isMap}}
{{^isMap}}
{{#isPrimitiveType}}
if ({{getter}}() != null) {
try {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
}
}
{{/isPrimitiveType}}
{{^isPrimitiveType}}
{{#isModel}}
if ({{getter}}() != null) {
joiner.add({{getter}}().toUrlQueryString(prefix + "{{{baseName}}}" + suffix));
}
{{/isModel}}
{{^isModel}}
if ({{getter}}() != null) {
try {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
}
}
{{/isModel}}
{{/isPrimitiveType}}
{{/isMap}}
{{/isArray}}
{{/allVars}}
return joiner.toString();
}
{{/supportUrlQuery}}
{{#parcelableModel}}
public void writeToParcel(Parcel out, int flags) {
{{#model}}
{{#isArray}}
out.writeList(this);
{{/isArray}}
{{^isArray}}
{{#parent}}
super.writeToParcel(out, flags);
{{/parent}}
{{#vars}}
out.writeValue({{name}});
{{/vars}}
{{/isArray}}
{{/model}}
}
{{classname}}(Parcel in) {
{{#isArray}}
in.readTypedList(this, {{arrayModelType}}.CREATOR);
{{/isArray}}
{{^isArray}}
{{#parent}}
super(in);
{{/parent}}
{{#vars}}
{{#isPrimitiveType}}
{{name}} = ({{{datatypeWithEnum}}})in.readValue(null);
{{/isPrimitiveType}}
{{^isPrimitiveType}}
{{name}} = ({{{datatypeWithEnum}}})in.readValue({{complexType}}.class.getClassLoader());
{{/isPrimitiveType}}
{{/vars}}
{{/isArray}}
}
public int describeContents() {
return 0;
}
public static final Parcelable.Creator<{{classname}}> CREATOR = new Parcelable.Creator<{{classname}}>() {
public {{classname}} createFromParcel(Parcel in) {
{{#model}}
{{#isArray}}
{{classname}} result = new {{classname}}();
result.addAll(in.readArrayList({{arrayModelType}}.class.getClassLoader()));
return result;
{{/isArray}}
{{^isArray}}
return new {{classname}}(in);
{{/isArray}}
{{/model}}
}
public {{classname}}[] newArray(int size) {
return new {{classname}}[size];
}
};
{{/parcelableModel}}
{{#generateBuilders}}
{{>javaBuilder}}
{{/generateBuilders}}
}

View File

@ -93,6 +93,7 @@ public class Bird {
this.color = color;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -93,6 +93,7 @@ public class Category {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -129,6 +129,7 @@ public class DataQuery extends Query {
this.date = date;
}
@Override
public DataQuery id(@jakarta.annotation.Nullable Long id) {
this.setId(id);

View File

@ -406,6 +406,7 @@ public class DefaultValue {
this.stringNullable = JsonNullable.<String>of(stringNullable);
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -126,6 +126,7 @@ public class NumberPropertiesOnly {
this._double = _double;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -271,6 +271,7 @@ public class Pet {
this.status = status;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -141,6 +141,7 @@ public class Query {
this.outcomes = outcomes;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -93,6 +93,7 @@ public class Tag {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -64,6 +64,7 @@ public class TestFormObjectMultipartRequestMarker {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -154,6 +154,7 @@ public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -75,6 +75,7 @@ public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {
this.values = values;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -204,6 +204,7 @@ public class ByteArrayObject {
this.intField = intField;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -114,6 +114,7 @@ public class AdditionalPropertiesClass {
this.mapOfMapProperty = mapOfMapProperty;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -97,6 +97,7 @@ public class AllOfWithSingleRef {
this.singleRefType = singleRefType;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -109,6 +109,7 @@ public class Animal {
this.color = color;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -77,6 +77,7 @@ public class ArrayOfArrayOfNumberOnly {
this.arrayArrayNumber = arrayArrayNumber;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -77,6 +77,7 @@ public class ArrayOfNumberOnly {
this.arrayNumber = arrayNumber;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -155,6 +155,7 @@ public class ArrayTest {
this.arrayArrayOfModel = arrayArrayOfModel;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -220,6 +220,7 @@ public class Capitalization {
this.ATT_NAME = ATT_NAME;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -76,6 +76,7 @@ public class Cat extends Animal {
this.declawed = declawed;
}
@Override
public Cat className(@jakarta.annotation.Nonnull String className) {
this.setClassName(className);

View File

@ -96,6 +96,7 @@ public class Category {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -77,6 +77,7 @@ public class ChildWithNullable extends ParentWithNullable {
this.otherProperty = otherProperty;
}
@Override
public ChildWithNullable type(@jakarta.annotation.Nullable TypeEnum type) {
this.setType(type);

View File

@ -66,6 +66,7 @@ public class ClassModel {
this.propertyClass = propertyClass;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -65,6 +65,7 @@ public class Client {
this.client = client;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -67,6 +67,7 @@ public class DeprecatedObject {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -76,6 +76,7 @@ public class Dog extends Animal {
this.breed = breed;
}
@Override
public Dog className(@jakarta.annotation.Nonnull String className) {
this.setClassName(className);

View File

@ -177,6 +177,7 @@ public class EnumArrays {
this.arrayEnum = arrayEnum;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -443,6 +443,7 @@ public class EnumTest {
this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -108,6 +108,7 @@ public class FakeBigDecimalMap200Response {
this.someMap = someMap;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -108,6 +108,7 @@ public class FileSchemaTestClass {
this.files = files;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -65,6 +65,7 @@ public class Foo {
this.bar = bar;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -67,6 +67,7 @@ public class FooGetDefaultResponse {
this.string = string;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -546,6 +546,7 @@ public class FormatTest {
this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -87,6 +87,7 @@ public class HasOnlyReadOnly {
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -78,6 +78,7 @@ public class HealthCheckResult {
this.nullableMessage = JsonNullable.<String>of(nullableMessage);
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -227,6 +227,7 @@ public class MapTest {
this.indirectMap = indirectMap;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -140,6 +140,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
this.map = map;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -98,6 +98,7 @@ public class Model200Response {
this.propertyClass = propertyClass;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -128,6 +128,7 @@ public class ModelApiResponse {
this.message = message;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -67,6 +67,7 @@ public class ModelFile {
this.sourceURI = sourceURI;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -66,6 +66,7 @@ public class ModelList {
this._123list = _123list;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -67,6 +67,7 @@ public class ModelReturn {
this._return = _return;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -149,6 +149,7 @@ public class Name {
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -13,6 +13,10 @@
package org.openapitools.client.model;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
@ -54,7 +58,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
NullableClass.JSON_PROPERTY_OBJECT_ITEMS_NULLABLE
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT")
public class NullableClass extends HashMap<String, Object> {
public class NullableClass {
public static final String JSON_PROPERTY_INTEGER_PROP = "integer_prop";
@jakarta.annotation.Nullable
private JsonNullable<Integer> integerProp = JsonNullable.<Integer>undefined();
@ -104,7 +108,6 @@ public class NullableClass extends HashMap<String, Object> {
private Map<String, Object> objectItemsNullable;
public NullableClass() {
}
public NullableClass integerProp(@jakarta.annotation.Nullable Integer integerProp) {
@ -563,6 +566,50 @@ public class NullableClass extends HashMap<String, Object> {
this.objectItemsNullable = objectItemsNullable;
}
/**
* 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.
* @param key the name of the property
* @param value the value of the property
* @return self reference
*/
@JsonAnySetter
public NullableClass 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) properties.
* @return the additional (undeclared) properties
*/
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
}
/**
* Return the additional (undeclared) property with the specified name.
* @param key the name of the property
* @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) {
if (this == o) {
@ -584,7 +631,7 @@ public class NullableClass extends HashMap<String, Object> {
equalsNullable(this.objectNullableProp, nullableClass.objectNullableProp) &&
equalsNullable(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) &&
Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) &&
super.equals(o);
Objects.equals(this.additionalProperties, nullableClass.additionalProperties);
}
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
@ -593,7 +640,7 @@ public class NullableClass extends HashMap<String, Object> {
@Override
public int hashCode() {
return Objects.hash(hashCodeNullable(integerProp), hashCodeNullable(numberProp), hashCodeNullable(booleanProp), hashCodeNullable(stringProp), hashCodeNullable(dateProp), hashCodeNullable(datetimeProp), hashCodeNullable(arrayNullableProp), hashCodeNullable(arrayAndItemsNullableProp), arrayItemsNullable, hashCodeNullable(objectNullableProp), hashCodeNullable(objectAndItemsNullableProp), objectItemsNullable, super.hashCode());
return Objects.hash(hashCodeNullable(integerProp), hashCodeNullable(numberProp), hashCodeNullable(booleanProp), hashCodeNullable(stringProp), hashCodeNullable(dateProp), hashCodeNullable(datetimeProp), hashCodeNullable(arrayNullableProp), hashCodeNullable(arrayAndItemsNullableProp), arrayItemsNullable, hashCodeNullable(objectNullableProp), hashCodeNullable(objectAndItemsNullableProp), objectItemsNullable, additionalProperties);
}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
@ -607,7 +654,6 @@ public class NullableClass extends HashMap<String, Object> {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class NullableClass {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" integerProp: ").append(toIndentedString(integerProp)).append("\n");
sb.append(" numberProp: ").append(toIndentedString(numberProp)).append("\n");
sb.append(" booleanProp: ").append(toIndentedString(booleanProp)).append("\n");
@ -620,6 +666,7 @@ public class NullableClass extends HashMap<String, Object> {
sb.append(" objectNullableProp: ").append(toIndentedString(objectNullableProp)).append("\n");
sb.append(" objectAndItemsNullableProp: ").append(toIndentedString(objectAndItemsNullableProp)).append("\n");
sb.append(" objectItemsNullable: ").append(toIndentedString(objectItemsNullable)).append("\n");
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
sb.append("}");
return sb.toString();
}

View File

@ -66,6 +66,7 @@ public class NumberOnly {
this.justNumber = justNumber;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -177,6 +177,7 @@ public class ObjectWithDeprecatedFields {
this.bars = bars;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -258,6 +258,7 @@ public class Order {
this.complete = complete;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -128,6 +128,7 @@ public class OuterComposite {
this.myBoolean = myBoolean;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -66,6 +66,7 @@ public class OuterObjectWithEnumProperty {
this.value = value;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -153,6 +153,7 @@ public class ParentWithNullable {
this.nullableProperty = JsonNullable.<String>of(nullableProperty);
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -282,6 +282,7 @@ public class Pet {
this.status = status;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -95,6 +95,7 @@ public class ReadOnlyFirst {
this.baz = baz;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -66,6 +66,7 @@ public class SpecialModelName {
this.$specialPropertyName = $specialPropertyName;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -96,6 +96,7 @@ public class Tag {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -13,6 +13,10 @@
package org.openapitools.client.model;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
@ -21,8 +25,6 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
@ -34,13 +36,12 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
})
@JsonTypeName("testInlineFreeformAdditionalProperties_request")
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT")
public class TestInlineFreeformAdditionalPropertiesRequest extends HashMap<String, Object> {
public class TestInlineFreeformAdditionalPropertiesRequest {
public static final String JSON_PROPERTY_SOME_PROPERTY = "someProperty";
@jakarta.annotation.Nullable
private String someProperty;
public TestInlineFreeformAdditionalPropertiesRequest() {
}
public TestInlineFreeformAdditionalPropertiesRequest someProperty(@jakarta.annotation.Nullable String someProperty) {
@ -69,6 +70,50 @@ public class TestInlineFreeformAdditionalPropertiesRequest extends HashMap<Strin
this.someProperty = someProperty;
}
/**
* 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.
* @param key the name of the property
* @param value the value of the property
* @return self reference
*/
@JsonAnySetter
public TestInlineFreeformAdditionalPropertiesRequest 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) properties.
* @return the additional (undeclared) properties
*/
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
}
/**
* Return the additional (undeclared) property with the specified name.
* @param key the name of the property
* @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) {
if (this == o) {
@ -79,20 +124,20 @@ public class TestInlineFreeformAdditionalPropertiesRequest extends HashMap<Strin
}
TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = (TestInlineFreeformAdditionalPropertiesRequest) o;
return Objects.equals(this.someProperty, testInlineFreeformAdditionalPropertiesRequest.someProperty) &&
super.equals(o);
Objects.equals(this.additionalProperties, testInlineFreeformAdditionalPropertiesRequest.additionalProperties);
}
@Override
public int hashCode() {
return Objects.hash(someProperty, super.hashCode());
return Objects.hash(someProperty, additionalProperties);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class TestInlineFreeformAdditionalPropertiesRequest {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" someProperty: ").append(toIndentedString(someProperty)).append("\n");
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
sb.append("}");
return sb.toString();
}

View File

@ -282,6 +282,7 @@ public class User {
this.userStatus = userStatus;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -111,6 +111,7 @@ public class AdditionalPropertiesClass {
this.mapOfMapProperty = mapOfMapProperty;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -94,6 +94,7 @@ public class AllOfWithSingleRef {
this.singleRefType = singleRefType;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -106,6 +106,7 @@ public class Animal {
this.color = color;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -75,6 +75,7 @@ public class ArrayOfArrayOfNumberOnly {
this.arrayArrayNumber = arrayArrayNumber;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -75,6 +75,7 @@ public class ArrayOfNumberOnly {
this.arrayNumber = arrayNumber;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -151,6 +151,7 @@ public class ArrayTest {
this.arrayArrayOfModel = arrayArrayOfModel;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -213,6 +213,7 @@ public class Capitalization {
this.ATT_NAME = ATT_NAME;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -74,6 +74,7 @@ public class Cat extends Animal {
this.declawed = declawed;
}
@Override
public Cat className(@jakarta.annotation.Nonnull String className) {
this.setClassName(className);

View File

@ -93,6 +93,7 @@ public class Category {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -75,6 +75,7 @@ public class ChildWithNullable extends ParentWithNullable {
this.otherProperty = otherProperty;
}
@Override
public ChildWithNullable type(@jakarta.annotation.Nullable TypeEnum type) {
this.setType(type);

View File

@ -63,6 +63,7 @@ public class ClassModel {
this.propertyClass = propertyClass;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -63,6 +63,7 @@ public class Client {
this.client = client;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -65,6 +65,7 @@ public class DeprecatedObject {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -74,6 +74,7 @@ public class Dog extends Animal {
this.breed = breed;
}
@Override
public Dog className(@jakarta.annotation.Nonnull String className) {
this.setClassName(className);

View File

@ -174,6 +174,7 @@ public class EnumArrays {
this.arrayEnum = arrayEnum;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -434,6 +434,7 @@ public class EnumTest {
this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -105,6 +105,7 @@ public class FakeBigDecimalMap200Response {
this.someMap = someMap;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -105,6 +105,7 @@ public class FileSchemaTestClass {
this.files = files;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -63,6 +63,7 @@ public class Foo {
this.bar = bar;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -65,6 +65,7 @@ public class FooGetDefaultResponse {
this.string = string;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -529,6 +529,7 @@ public class FormatTest {
this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -84,6 +84,7 @@ public class HasOnlyReadOnly {
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -75,6 +75,7 @@ public class HealthCheckResult {
this.nullableMessage = JsonNullable.<String>of(nullableMessage);
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -222,6 +222,7 @@ public class MapTest {
this.indirectMap = indirectMap;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -136,6 +136,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
this.map = map;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -94,6 +94,7 @@ public class Model200Response {
this.propertyClass = propertyClass;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -124,6 +124,7 @@ public class ModelApiResponse {
this.message = message;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -64,6 +64,7 @@ public class ModelFile {
this.sourceURI = sourceURI;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -64,6 +64,7 @@ public class ModelList {
this._123list = _123list;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -64,6 +64,7 @@ public class ModelReturn {
this._return = _return;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -143,6 +143,7 @@ public class Name {
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -13,6 +13,10 @@
package org.openapitools.client.model;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
@ -53,7 +57,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
NullableClass.JSON_PROPERTY_OBJECT_ITEMS_NULLABLE
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0-SNAPSHOT")
public class NullableClass extends HashMap<String, Object> {
public class NullableClass {
public static final String JSON_PROPERTY_INTEGER_PROP = "integer_prop";
@jakarta.annotation.Nullable
private JsonNullable<Integer> integerProp = JsonNullable.<Integer>undefined();
@ -103,7 +107,6 @@ public class NullableClass extends HashMap<String, Object> {
private Map<String, Object> objectItemsNullable = new HashMap<>();
public NullableClass() {
}
public NullableClass integerProp(@jakarta.annotation.Nullable Integer integerProp) {
@ -550,6 +553,50 @@ public class NullableClass extends HashMap<String, Object> {
this.objectItemsNullable = objectItemsNullable;
}
/**
* 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.
* @param key the name of the property
* @param value the value of the property
* @return self reference
*/
@JsonAnySetter
public NullableClass 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) properties.
* @return the additional (undeclared) properties
*/
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
}
/**
* Return the additional (undeclared) property with the specified name.
* @param key the name of the property
* @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) {
if (this == o) {
@ -571,7 +618,7 @@ public class NullableClass extends HashMap<String, Object> {
equalsNullable(this.objectNullableProp, nullableClass.objectNullableProp) &&
equalsNullable(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) &&
Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) &&
super.equals(o);
Objects.equals(this.additionalProperties, nullableClass.additionalProperties);
}
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
@ -580,7 +627,7 @@ public class NullableClass extends HashMap<String, Object> {
@Override
public int hashCode() {
return Objects.hash(hashCodeNullable(integerProp), hashCodeNullable(numberProp), hashCodeNullable(booleanProp), hashCodeNullable(stringProp), hashCodeNullable(dateProp), hashCodeNullable(datetimeProp), hashCodeNullable(arrayNullableProp), hashCodeNullable(arrayAndItemsNullableProp), arrayItemsNullable, hashCodeNullable(objectNullableProp), hashCodeNullable(objectAndItemsNullableProp), objectItemsNullable, super.hashCode());
return Objects.hash(hashCodeNullable(integerProp), hashCodeNullable(numberProp), hashCodeNullable(booleanProp), hashCodeNullable(stringProp), hashCodeNullable(dateProp), hashCodeNullable(datetimeProp), hashCodeNullable(arrayNullableProp), hashCodeNullable(arrayAndItemsNullableProp), arrayItemsNullable, hashCodeNullable(objectNullableProp), hashCodeNullable(objectAndItemsNullableProp), objectItemsNullable, additionalProperties);
}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
@ -594,7 +641,6 @@ public class NullableClass extends HashMap<String, Object> {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class NullableClass {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" integerProp: ").append(toIndentedString(integerProp)).append("\n");
sb.append(" numberProp: ").append(toIndentedString(numberProp)).append("\n");
sb.append(" booleanProp: ").append(toIndentedString(booleanProp)).append("\n");
@ -607,6 +653,7 @@ public class NullableClass extends HashMap<String, Object> {
sb.append(" objectNullableProp: ").append(toIndentedString(objectNullableProp)).append("\n");
sb.append(" objectAndItemsNullableProp: ").append(toIndentedString(objectAndItemsNullableProp)).append("\n");
sb.append(" objectItemsNullable: ").append(toIndentedString(objectItemsNullable)).append("\n");
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
sb.append("}");
return sb.toString();
}

View File

@ -64,6 +64,7 @@ public class NumberOnly {
this.justNumber = justNumber;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -172,6 +172,7 @@ public class ObjectWithDeprecatedFields {
this.bars = bars;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -251,6 +251,7 @@ public class Order {
this.complete = complete;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -124,6 +124,7 @@ public class OuterComposite {
this.myBoolean = myBoolean;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -64,6 +64,7 @@ public class OuterObjectWithEnumProperty {
this.value = value;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -150,6 +150,7 @@ public class ParentWithNullable {
this.nullableProperty = JsonNullable.<String>of(nullableProperty);
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -275,6 +275,7 @@ public class Pet {
this.status = status;
}
@Override
public boolean equals(Object o) {
if (this == o) {

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