forked from loafle/openapi-generator-original
Support models with multi-level hierarchy (via roxspring) (#4503)
* Example of broken multi-level hierarchy * Support for multiple levels of hierarchy in model objects * Support for multiple levels of hierarchy in generators * Regenerated samples * Temporarily skip scalaz sample verification, which is having issue with Java version in CI container * Re-enable scalaz in verify samples Co-authored-by: Rob Oxspring <roxspring@imapmail.org>
This commit is contained in:
committed by
William Cheng
parent
daec02b8c5
commit
376e419d0b
23
samples/client/petstore/java/native/docs/BigCat.md
Normal file
23
samples/client/petstore/java/native/docs/BigCat.md
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
# BigCat
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**kind** | [**KindEnum**](#KindEnum) | | [optional]
|
||||
|
||||
|
||||
|
||||
## Enum: KindEnum
|
||||
|
||||
Name | Value
|
||||
---- | -----
|
||||
LIONS | "lions"
|
||||
TIGERS | "tigers"
|
||||
LEOPARDS | "leopards"
|
||||
JAGUARS | "jaguars"
|
||||
|
||||
|
||||
|
||||
23
samples/client/petstore/java/native/docs/BigCatAllOf.md
Normal file
23
samples/client/petstore/java/native/docs/BigCatAllOf.md
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
# BigCatAllOf
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**kind** | [**KindEnum**](#KindEnum) | | [optional]
|
||||
|
||||
|
||||
|
||||
## Enum: KindEnum
|
||||
|
||||
Name | Value
|
||||
---- | -----
|
||||
LIONS | "lions"
|
||||
TIGERS | "tigers"
|
||||
LEOPARDS | "leopards"
|
||||
JAGUARS | "jaguars"
|
||||
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
@JsonSubTypes({
|
||||
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
|
||||
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
|
||||
@JsonSubTypes.Type(value = BigCat.class, name = "BigCat"),
|
||||
})
|
||||
|
||||
public class Animal {
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* 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.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.openapitools.client.model.BigCatAllOf;
|
||||
import org.openapitools.client.model.Cat;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
/**
|
||||
* BigCat
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
BigCat.JSON_PROPERTY_KIND
|
||||
})
|
||||
|
||||
public class BigCat extends Cat {
|
||||
/**
|
||||
* Gets or Sets kind
|
||||
*/
|
||||
public enum KindEnum {
|
||||
LIONS("lions"),
|
||||
|
||||
TIGERS("tigers"),
|
||||
|
||||
LEOPARDS("leopards"),
|
||||
|
||||
JAGUARS("jaguars");
|
||||
|
||||
private String value;
|
||||
|
||||
KindEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static KindEnum fromValue(String value) {
|
||||
for (KindEnum b : KindEnum.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
}
|
||||
|
||||
public static final String JSON_PROPERTY_KIND = "kind";
|
||||
private KindEnum kind;
|
||||
|
||||
|
||||
public BigCat kind(KindEnum kind) {
|
||||
|
||||
this.kind = kind;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get kind
|
||||
* @return kind
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty(JSON_PROPERTY_KIND)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public KindEnum getKind() {
|
||||
return kind;
|
||||
}
|
||||
|
||||
|
||||
public void setKind(KindEnum kind) {
|
||||
this.kind = kind;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
BigCat bigCat = (BigCat) o;
|
||||
return Objects.equals(this.kind, bigCat.kind) &&
|
||||
super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(kind, super.hashCode());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class BigCat {\n");
|
||||
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
|
||||
sb.append(" kind: ").append(toIndentedString(kind)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(java.lang.Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* 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.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
/**
|
||||
* BigCatAllOf
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
BigCatAllOf.JSON_PROPERTY_KIND
|
||||
})
|
||||
|
||||
public class BigCatAllOf {
|
||||
/**
|
||||
* Gets or Sets kind
|
||||
*/
|
||||
public enum KindEnum {
|
||||
LIONS("lions"),
|
||||
|
||||
TIGERS("tigers"),
|
||||
|
||||
LEOPARDS("leopards"),
|
||||
|
||||
JAGUARS("jaguars");
|
||||
|
||||
private String value;
|
||||
|
||||
KindEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static KindEnum fromValue(String value) {
|
||||
for (KindEnum b : KindEnum.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
}
|
||||
|
||||
public static final String JSON_PROPERTY_KIND = "kind";
|
||||
private KindEnum kind;
|
||||
|
||||
|
||||
public BigCatAllOf kind(KindEnum kind) {
|
||||
|
||||
this.kind = kind;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get kind
|
||||
* @return kind
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty(JSON_PROPERTY_KIND)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public KindEnum getKind() {
|
||||
return kind;
|
||||
}
|
||||
|
||||
|
||||
public void setKind(KindEnum kind) {
|
||||
this.kind = kind;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
BigCatAllOf bigCatAllOf = (BigCatAllOf) o;
|
||||
return Objects.equals(this.kind, bigCatAllOf.kind);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(kind);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class BigCatAllOf {\n");
|
||||
sb.append(" kind: ").append(toIndentedString(kind)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(java.lang.Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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 com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Model tests for BigCatAllOf
|
||||
*/
|
||||
public class BigCatAllOfTest {
|
||||
private final BigCatAllOf model = new BigCatAllOf();
|
||||
|
||||
/**
|
||||
* Model tests for BigCatAllOf
|
||||
*/
|
||||
@Test
|
||||
public void testBigCatAllOf() {
|
||||
// TODO: test BigCatAllOf
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'kind'
|
||||
*/
|
||||
@Test
|
||||
public void kindTest() {
|
||||
// TODO: test kind
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* 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 com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.openapitools.client.model.BigCatAllOf;
|
||||
import org.openapitools.client.model.Cat;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Model tests for BigCat
|
||||
*/
|
||||
public class BigCatTest {
|
||||
private final BigCat model = new BigCat();
|
||||
|
||||
/**
|
||||
* Model tests for BigCat
|
||||
*/
|
||||
@Test
|
||||
public void testBigCat() {
|
||||
// TODO: test BigCat
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'className'
|
||||
*/
|
||||
@Test
|
||||
public void classNameTest() {
|
||||
// TODO: test className
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'color'
|
||||
*/
|
||||
@Test
|
||||
public void colorTest() {
|
||||
// TODO: test color
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'declawed'
|
||||
*/
|
||||
@Test
|
||||
public void declawedTest() {
|
||||
// TODO: test declawed
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'kind'
|
||||
*/
|
||||
@Test
|
||||
public void kindTest() {
|
||||
// TODO: test kind
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user