-
-
Save fujigon/4ae17fc6497cb599d1dfb53c2ebeadea to your computer and use it in GitHub Desktop.
object with enum property that are $ref-ed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Sample APIs | |
* Sample API | |
* | |
* OpenAPI spec version: 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.model; | |
import java.util.Objects; | |
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.model.IntegerEnum; | |
import org.openapitools.model.StringEnum; | |
import javax.validation.constraints.*; | |
import javax.validation.Valid; | |
/** | |
* InlineResponseDefault | |
*/ | |
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-10-26T15:55:29.638702200+09:00[Asia/Tokyo]") | |
public class InlineResponseDefault { | |
@JsonProperty("string") | |
private String string = "hoge"; | |
@JsonProperty("integer") | |
private Integer integer = 2; | |
@JsonProperty("stringEnum") | |
private StringEnum stringEnum = null; | |
@JsonProperty("integerEnum") | |
private IntegerEnum integerEnum = null; | |
@JsonProperty("stringInline") | |
private String stringInline = "hoge"; | |
@JsonProperty("integerInline") | |
private String integerInline = "2"; | |
/** | |
* Gets or Sets stringEnumInline | |
*/ | |
public enum StringEnumInlineEnum { | |
FOO("foo"), | |
BAR("bar"), | |
BAZ("baz"); | |
private String value; | |
StringEnumInlineEnum(String value) { | |
this.value = value; | |
} | |
@Override | |
@JsonValue | |
public String toString() { | |
return String.valueOf(value); | |
} | |
@JsonCreator | |
public static StringEnumInlineEnum fromValue(String text) { | |
for (StringEnumInlineEnum b : StringEnumInlineEnum.values()) { | |
if (String.valueOf(b.value).equals(text)) { | |
return b; | |
} | |
} | |
throw new IllegalArgumentException("Unexpected value '" + text + "'"); | |
} | |
} | |
@JsonProperty("stringEnumInline") | |
private StringEnumInlineEnum stringEnumInline = StringEnumInlineEnum.FOO; | |
/** | |
* Gets or Sets integerEnumInline | |
*/ | |
public enum IntegerEnumInlineEnum { | |
NUMBER_1(1), | |
NUMBER_2(2), | |
NUMBER_3(3); | |
private Integer value; | |
IntegerEnumInlineEnum(Integer value) { | |
this.value = value; | |
} | |
@Override | |
@JsonValue | |
public String toString() { | |
return String.valueOf(value); | |
} | |
@JsonCreator | |
public static IntegerEnumInlineEnum fromValue(String text) { | |
for (IntegerEnumInlineEnum b : IntegerEnumInlineEnum.values()) { | |
if (String.valueOf(b.value).equals(text)) { | |
return b; | |
} | |
} | |
throw new IllegalArgumentException("Unexpected value '" + text + "'"); | |
} | |
} | |
@JsonProperty("integerEnumInline") | |
private IntegerEnumInlineEnum integerEnumInline = IntegerEnumInlineEnum.NUMBER_1; | |
public InlineResponseDefault string(String string) { | |
this.string = string; | |
return this; | |
} | |
/** | |
* Get string | |
* @return string | |
**/ | |
@JsonProperty("string") | |
@ApiModelProperty(value = "") | |
public String getString() { | |
return string; | |
} | |
public void setString(String string) { | |
this.string = string; | |
} | |
public InlineResponseDefault integer(Integer integer) { | |
this.integer = integer; | |
return this; | |
} | |
/** | |
* Get integer | |
* @return integer | |
**/ | |
@JsonProperty("integer") | |
@ApiModelProperty(value = "") | |
public Integer getInteger() { | |
return integer; | |
} | |
public void setInteger(Integer integer) { | |
this.integer = integer; | |
} | |
public InlineResponseDefault stringEnum(StringEnum stringEnum) { | |
this.stringEnum = stringEnum; | |
return this; | |
} | |
/** | |
* Get stringEnum | |
* @return stringEnum | |
**/ | |
@JsonProperty("stringEnum") | |
@ApiModelProperty(value = "") | |
@Valid | |
public StringEnum getStringEnum() { | |
return stringEnum; | |
} | |
public void setStringEnum(StringEnum stringEnum) { | |
this.stringEnum = stringEnum; | |
} | |
public InlineResponseDefault integerEnum(IntegerEnum integerEnum) { | |
this.integerEnum = integerEnum; | |
return this; | |
} | |
/** | |
* Get integerEnum | |
* @return integerEnum | |
**/ | |
@JsonProperty("integerEnum") | |
@ApiModelProperty(value = "") | |
@Valid | |
public IntegerEnum getIntegerEnum() { | |
return integerEnum; | |
} | |
public void setIntegerEnum(IntegerEnum integerEnum) { | |
this.integerEnum = integerEnum; | |
} | |
public InlineResponseDefault stringInline(String stringInline) { | |
this.stringInline = stringInline; | |
return this; | |
} | |
/** | |
* Get stringInline | |
* @return stringInline | |
**/ | |
@JsonProperty("stringInline") | |
@ApiModelProperty(value = "") | |
public String getStringInline() { | |
return stringInline; | |
} | |
public void setStringInline(String stringInline) { | |
this.stringInline = stringInline; | |
} | |
public InlineResponseDefault integerInline(String integerInline) { | |
this.integerInline = integerInline; | |
return this; | |
} | |
/** | |
* Get integerInline | |
* @return integerInline | |
**/ | |
@JsonProperty("integerInline") | |
@ApiModelProperty(value = "") | |
public String getIntegerInline() { | |
return integerInline; | |
} | |
public void setIntegerInline(String integerInline) { | |
this.integerInline = integerInline; | |
} | |
public InlineResponseDefault stringEnumInline(StringEnumInlineEnum stringEnumInline) { | |
this.stringEnumInline = stringEnumInline; | |
return this; | |
} | |
/** | |
* Get stringEnumInline | |
* @return stringEnumInline | |
**/ | |
@JsonProperty("stringEnumInline") | |
@ApiModelProperty(value = "") | |
public StringEnumInlineEnum getStringEnumInline() { | |
return stringEnumInline; | |
} | |
public void setStringEnumInline(StringEnumInlineEnum stringEnumInline) { | |
this.stringEnumInline = stringEnumInline; | |
} | |
public InlineResponseDefault integerEnumInline(IntegerEnumInlineEnum integerEnumInline) { | |
this.integerEnumInline = integerEnumInline; | |
return this; | |
} | |
/** | |
* Get integerEnumInline | |
* @return integerEnumInline | |
**/ | |
@JsonProperty("integerEnumInline") | |
@ApiModelProperty(value = "") | |
public IntegerEnumInlineEnum getIntegerEnumInline() { | |
return integerEnumInline; | |
} | |
public void setIntegerEnumInline(IntegerEnumInlineEnum integerEnumInline) { | |
this.integerEnumInline = integerEnumInline; | |
} | |
@Override | |
public boolean equals(java.lang.Object o) { | |
if (this == o) { | |
return true; | |
} | |
if (o == null || getClass() != o.getClass()) { | |
return false; | |
} | |
InlineResponseDefault inlineResponseDefault = (InlineResponseDefault) o; | |
return Objects.equals(this.string, inlineResponseDefault.string) && | |
Objects.equals(this.integer, inlineResponseDefault.integer) && | |
Objects.equals(this.stringEnum, inlineResponseDefault.stringEnum) && | |
Objects.equals(this.integerEnum, inlineResponseDefault.integerEnum) && | |
Objects.equals(this.stringInline, inlineResponseDefault.stringInline) && | |
Objects.equals(this.integerInline, inlineResponseDefault.integerInline) && | |
Objects.equals(this.stringEnumInline, inlineResponseDefault.stringEnumInline) && | |
Objects.equals(this.integerEnumInline, inlineResponseDefault.integerEnumInline); | |
} | |
@Override | |
public int hashCode() { | |
return Objects.hash(string, integer, stringEnum, integerEnum, stringInline, integerInline, stringEnumInline, integerEnumInline); | |
} | |
@Override | |
public String toString() { | |
StringBuilder sb = new StringBuilder(); | |
sb.append("class InlineResponseDefault {\n"); | |
sb.append(" string: ").append(toIndentedString(string)).append("\n"); | |
sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); | |
sb.append(" stringEnum: ").append(toIndentedString(stringEnum)).append("\n"); | |
sb.append(" integerEnum: ").append(toIndentedString(integerEnum)).append("\n"); | |
sb.append(" stringInline: ").append(toIndentedString(stringInline)).append("\n"); | |
sb.append(" integerInline: ").append(toIndentedString(integerInline)).append("\n"); | |
sb.append(" stringEnumInline: ").append(toIndentedString(stringEnumInline)).append("\n"); | |
sb.append(" integerEnumInline: ").append(toIndentedString(integerEnumInline)).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 "); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: "3.0.0" | |
info: | |
title: Sample APIs | |
version: 1.0.0 | |
description: | |
Sample API | |
servers: | |
- url: https://www.example.com/ | |
description: Server Url | |
components: | |
schemas: | |
String: | |
type: string | |
default: hoge | |
Integer: | |
type: integer | |
default: 2 | |
StringEnum: | |
type: string | |
enum: | |
- foo | |
- bar | |
- baz | |
default: foo | |
IntegerEnum: | |
type: integer | |
enum: | |
- 1 | |
- 2 | |
- 3 | |
default: 1 | |
paths: | |
/tests/defaults: | |
get: | |
responses: | |
default: | |
description: response | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
string: | |
$ref: '#/components/schemas/String' | |
integer: | |
$ref: '#/components/schemas/Integer' | |
stringEnum: | |
$ref: '#/components/schemas/StringEnum' | |
integerEnum: | |
$ref: '#/components/schemas/IntegerEnum' | |
stringInline: | |
type: string | |
default: hoge | |
integerInline: | |
type: string | |
default: 2 | |
stringEnumInline: | |
type: string | |
enum: | |
- foo | |
- bar | |
- baz | |
default: foo | |
integerEnumInline: | |
type: integer | |
enum: | |
- 1 | |
- 2 | |
- 3 | |
default: 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment