Created
June 30, 2024 01:32
-
-
Save KangoV/8a62886376207e281e8b0fedd008a24d to your computer and use it in GitHub Desktop.
BUG JAVA Micronaut OpenAPI Generator - Superclass/subclass
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
@Serdeable | |
@JsonPropertyOrder({ | |
JsonOp.JSON_PROPERTY_PATH, | |
JsonOp.JSON_PROPERTY_OP, | |
JsonOp.JSON_PROPERTY_VALUE, | |
JsonOp.JSON_PROPERTY_FROM | |
}) | |
@Generated("io.micronaut.openapi.generator.JavaMicronautServerCodegen") | |
@JsonIgnoreProperties( | |
value = "op", // ignore manually set op, it will be automatically generated by Jackson during serialization | |
allowSetters = true // allows the op to be set during deserialization | |
) | |
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "op", visible = true) | |
@JsonSubTypes({ | |
@JsonSubTypes.Type(value = OpAdd.class, name = "add"), | |
@JsonSubTypes.Type(value = OpCopy.class, name = "copy"), | |
@JsonSubTypes.Type(value = OpMove.class, name = "move"), | |
@JsonSubTypes.Type(value = OpRemove.class, name = "remove"), | |
@JsonSubTypes.Type(value = OpReplace.class, name = "replace"), | |
@JsonSubTypes.Type(value = OpTest.class, name = "test") | |
}) | |
public class JsonOp { | |
public static final String JSON_PROPERTY_PATH = "path"; | |
public static final String JSON_PROPERTY_OP = "op"; | |
public static final String JSON_PROPERTY_VALUE = "value"; | |
public static final String JSON_PROPERTY_FROM = "from"; | |
@NotNull | |
@Schema(name = "path", requiredMode = Schema.RequiredMode.REQUIRED) | |
@JsonProperty(JSON_PROPERTY_PATH) | |
private String path; | |
@NotNull | |
@Schema(name = "op", requiredMode = Schema.RequiredMode.REQUIRED) | |
@JsonProperty(JSON_PROPERTY_OP) | |
protected String op; | |
@Nullable(inherited = true) | |
@Schema(name = "value", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | |
@JsonProperty(JSON_PROPERTY_VALUE) | |
@JsonInclude(JsonInclude.Include.USE_DEFAULTS) | |
private String value; | |
@Nullable(inherited = true) | |
@Schema(name = "from", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | |
@JsonProperty(JSON_PROPERTY_FROM) | |
@JsonInclude(JsonInclude.Include.USE_DEFAULTS) | |
private String from; | |
public JsonOp(String path) { | |
this.path = path; | |
} | |
/** | |
* @return the path property value | |
*/ | |
public String getPath() { | |
return path; | |
} | |
/** | |
* Set the path property value | |
*/ | |
public void setPath(String path) { | |
this.path = path; | |
} | |
/** | |
* Set path in a chainable fashion. | |
* | |
* @return The same instance of JsonOp for chaining. | |
*/ | |
public JsonOp path(String path) { | |
this.path = path; | |
return this; | |
} | |
/** | |
* @return the op property value | |
*/ | |
public String getOp() { | |
return op; | |
} | |
/** | |
* Set the op property value | |
*/ | |
public void setOp(String op) { | |
this.op = op; | |
} | |
/** | |
* Set op in a chainable fashion. | |
* | |
* @return The same instance of JsonOp for chaining. | |
*/ | |
public JsonOp op(String op) { | |
this.op = op; | |
return this; | |
} | |
/** | |
* @return the value property value | |
*/ | |
public String getValue() { | |
return value; | |
} | |
/** | |
* @return the value property value wrapped in an optional | |
*/ | |
@JsonIgnore | |
public Optional<String> getValueOptional() { | |
return Optional.ofNullable(value); | |
} | |
/** | |
* Set the value property value | |
*/ | |
public void setValue(String value) { | |
this.value = value; | |
} | |
/** | |
* Set value in a chainable fashion. | |
* | |
* @return The same instance of JsonOp for chaining. | |
*/ | |
public JsonOp value(String value) { | |
this.value = value; | |
return this; | |
} | |
/** | |
* @return the from property value | |
*/ | |
public String getFrom() { | |
return from; | |
} | |
/** | |
* @return the from property value wrapped in an optional | |
*/ | |
@JsonIgnore | |
public Optional<String> getFromOptional() { | |
return Optional.ofNullable(from); | |
} | |
/** | |
* Set the from property value | |
*/ | |
public void setFrom(String from) { | |
this.from = from; | |
} | |
/** | |
* Set from in a chainable fashion. | |
* | |
* @return The same instance of JsonOp for chaining. | |
*/ | |
public JsonOp from(String from) { | |
this.from = from; | |
return this; | |
} | |
@Override | |
public boolean equals(Object o) { | |
if (this == o) { | |
return true; | |
} | |
if (o == null || getClass() != o.getClass()) { | |
return false; | |
} | |
JsonOp jsonOp = (JsonOp) o; | |
return Objects.equals(path, jsonOp.path) && | |
Objects.equals(op, jsonOp.op) && | |
Objects.equals(value, jsonOp.value) && | |
Objects.equals(from, jsonOp.from); | |
} | |
@Override | |
public int hashCode() { | |
return Objects.hash(path, op, value, from); | |
} | |
@Override | |
public String toString() { | |
return "JsonOp(" | |
+ "path: " + getPath() + ", " | |
+ "op: " + getOp() + ", " | |
+ "value: " + getValue() + ", " | |
+ "from: " + getFrom() | |
+ ")"; | |
} | |
} | |
@Serdeable | |
@JsonPropertyOrder(OpAdd.JSON_PROPERTY_VALUE) | |
@Generated("io.micronaut.openapi.generator.JavaMicronautServerCodegen") | |
public class OpAdd extends JsonOp { | |
public static final String JSON_PROPERTY_VALUE = "value"; | |
@Nullable(inherited = true) | |
@Schema(name = "value", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | |
@JsonProperty(JSON_PROPERTY_VALUE) | |
@JsonInclude(JsonInclude.Include.USE_DEFAULTS) | |
private String value; | |
public OpAdd(String path) { | |
super(path); | |
} | |
/** | |
* @return the value property value | |
*/ | |
public String getValue() { | |
return value; | |
} | |
/** | |
* @return the value property value wrapped in an optional | |
*/ | |
@JsonIgnore | |
public Optional<String> getValueOptional() { | |
return Optional.ofNullable(value); | |
} | |
/** | |
* Set the value property value | |
*/ | |
public void setValue(String value) { | |
this.value = value; | |
} | |
/** | |
* Set value in a chainable fashion. | |
* | |
* @return The same instance of OpAdd for chaining. | |
*/ | |
public OpAdd value(String value) { | |
this.value = value; | |
return this; | |
} | |
@Override | |
public OpAdd path(String path) { | |
super.setPath(path); | |
return this; | |
} | |
@Override | |
public OpAdd op(String op) { | |
super.setOp(op); | |
return this; | |
} | |
@Override | |
public OpAdd value(String value) { | |
super.setValue(value); | |
return this; | |
} | |
@Override | |
public OpAdd from(String from) { | |
super.setFrom(from); | |
return this; | |
} | |
@Override | |
public boolean equals(Object o) { | |
if (this == o) { | |
return true; | |
} | |
if (o == null || getClass() != o.getClass()) { | |
return false; | |
} | |
OpAdd opAdd = (OpAdd) o; | |
return Objects.equals(value, opAdd.value) && | |
super.equals(o); | |
} | |
@Override | |
public int hashCode() { | |
return Objects.hash(value, super.hashCode()); | |
} | |
@Override | |
public String toString() { | |
return "OpAdd(" | |
+ "value: " + getValue() + ", " | |
+ "path: " + getPath() + ", " | |
+ "op: " + getOp() + ", " | |
+ "value: " + getValue() + ", " | |
+ "from: " + getFrom() | |
+ ")"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment