[java][webclient] Fix model combining properties and additional properties (#19711)

This commit is contained in:
João Brilhante
2025-02-14 17:15:22 +01:00
committed by GitHub
parent a5c9c6d531
commit c3c2e7aeca
183 changed files with 1405 additions and 48 deletions

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(@javax.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(@javax.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(@javax.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
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class NullableClass extends HashMap<String, Object> {
public class NullableClass {
public static final String JSON_PROPERTY_INTEGER_PROP = "integer_prop";
@javax.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(@javax.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")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
public class TestInlineFreeformAdditionalPropertiesRequest extends HashMap<String, Object> {
public class TestInlineFreeformAdditionalPropertiesRequest {
public static final String JSON_PROPERTY_SOME_PROPERTY = "someProperty";
@javax.annotation.Nullable
private String someProperty;
public TestInlineFreeformAdditionalPropertiesRequest() {
}
public TestInlineFreeformAdditionalPropertiesRequest someProperty(@javax.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) {