forked from loafle/openapi-generator-original
Add example allOf with single ref (#10948)
* Add example allOf with single ref * fix dart-dio-next handling of that case * Refactor without vendor extension * Regenerate newer samples
This commit is contained in:
@@ -22,6 +22,11 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.openapitools.client.model.UserType;
|
||||
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;
|
||||
|
||||
@@ -36,7 +41,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
User.JSON_PROPERTY_EMAIL,
|
||||
User.JSON_PROPERTY_PASSWORD,
|
||||
User.JSON_PROPERTY_PHONE,
|
||||
User.JSON_PROPERTY_USER_STATUS
|
||||
User.JSON_PROPERTY_USER_STATUS,
|
||||
User.JSON_PROPERTY_USER_TYPE
|
||||
})
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class User {
|
||||
@@ -64,6 +70,9 @@ public class User {
|
||||
public static final String JSON_PROPERTY_USER_STATUS = "userStatus";
|
||||
private Integer userStatus;
|
||||
|
||||
public static final String JSON_PROPERTY_USER_TYPE = "userType";
|
||||
private JsonNullable<UserType> userType = JsonNullable.<UserType>undefined();
|
||||
|
||||
public User() {
|
||||
}
|
||||
|
||||
@@ -283,6 +292,41 @@ public class User {
|
||||
}
|
||||
|
||||
|
||||
public User userType(UserType userType) {
|
||||
this.userType = JsonNullable.<UserType>of(userType);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get userType
|
||||
* @return userType
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonIgnore
|
||||
|
||||
public UserType getUserType() {
|
||||
return userType.orElse(null);
|
||||
}
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_USER_TYPE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public JsonNullable<UserType> getUserType_JsonNullable() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_USER_TYPE)
|
||||
public void setUserType_JsonNullable(JsonNullable<UserType> userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
public void setUserType(UserType userType) {
|
||||
this.userType = JsonNullable.<UserType>of(userType);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
@@ -299,12 +343,24 @@ public class User {
|
||||
Objects.equals(this.email, user.email) &&
|
||||
Objects.equals(this.password, user.password) &&
|
||||
Objects.equals(this.phone, user.phone) &&
|
||||
Objects.equals(this.userStatus, user.userStatus);
|
||||
Objects.equals(this.userStatus, user.userStatus) &&
|
||||
equalsNullable(this.userType, user.userType);
|
||||
}
|
||||
|
||||
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()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
|
||||
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, hashCodeNullable(userType));
|
||||
}
|
||||
|
||||
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -319,6 +375,7 @@ public class User {
|
||||
sb.append(" password: ").append(toIndentedString(password)).append("\n");
|
||||
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
|
||||
sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n");
|
||||
sb.append(" userType: ").append(toIndentedString(userType)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Arrays;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* Gets or Sets UserType
|
||||
*/
|
||||
public enum UserType {
|
||||
|
||||
ADMIN("admin"),
|
||||
|
||||
USER("user");
|
||||
|
||||
private String value;
|
||||
|
||||
UserType(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static UserType fromValue(String value) {
|
||||
for (UserType b : UserType.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Model tests for UserType
|
||||
*/
|
||||
class UserTypeTest {
|
||||
/**
|
||||
* Model tests for UserType
|
||||
*/
|
||||
@Test
|
||||
void testUserType() {
|
||||
// TODO: test UserType
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user