Update allOf to not always be nullable (#12861)

* added nonNullableVars

* added return property to operation

* added return property to operation

* build samples

* added inner enum

* build samples

* allOf no longer always nullable

* added a comment
This commit is contained in:
devhl-labs
2022-08-15 12:47:51 -04:00
committed by GitHub
parent 17f9a28093
commit 7e4fa70067
12 changed files with 33 additions and 86 deletions

View File

@@ -23,10 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.openapitools.client.model.SingleRefType;
import org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.openapitools.jackson.nullable.JsonNullable;
import java.util.NoSuchElementException;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
@@ -43,7 +39,7 @@ public class AllOfWithSingleRef {
private String username;
public static final String JSON_PROPERTY_SINGLE_REF_TYPE = "SingleRefType";
private JsonNullable<SingleRefType> singleRefType = JsonNullable.<SingleRefType>undefined();
private SingleRefType singleRefType;
public AllOfWithSingleRef() {
}
@@ -76,8 +72,8 @@ public class AllOfWithSingleRef {
public AllOfWithSingleRef singleRefType(SingleRefType singleRefType) {
this.singleRefType = JsonNullable.<SingleRefType>of(singleRefType);
this.singleRefType = singleRefType;
return this;
}
@@ -87,26 +83,18 @@ public class AllOfWithSingleRef {
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@JsonIgnore
public SingleRefType getSingleRefType() {
return singleRefType.orElse(null);
}
@JsonProperty(JSON_PROPERTY_SINGLE_REF_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<SingleRefType> getSingleRefType_JsonNullable() {
public SingleRefType getSingleRefType() {
return singleRefType;
}
@JsonProperty(JSON_PROPERTY_SINGLE_REF_TYPE)
public void setSingleRefType_JsonNullable(JsonNullable<SingleRefType> singleRefType) {
this.singleRefType = singleRefType;
}
@JsonProperty(JSON_PROPERTY_SINGLE_REF_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setSingleRefType(SingleRefType singleRefType) {
this.singleRefType = JsonNullable.<SingleRefType>of(singleRefType);
this.singleRefType = singleRefType;
}
@@ -120,23 +108,12 @@ public class AllOfWithSingleRef {
}
AllOfWithSingleRef allOfWithSingleRef = (AllOfWithSingleRef) o;
return Objects.equals(this.username, allOfWithSingleRef.username) &&
equalsNullable(this.singleRefType, allOfWithSingleRef.singleRefType);
}
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()));
Objects.equals(this.singleRefType, allOfWithSingleRef.singleRefType);
}
@Override
public int hashCode() {
return Objects.hash(username, hashCodeNullable(singleRefType));
}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
return Objects.hash(username, singleRefType);
}
@Override