-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
6 changed files
with
250 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package issue._432; | ||
|
||
@jakarta.annotation.Generated("org.openapitools.codegen.languages.MicronautCodegen") | ||
@io.micronaut.serde.annotation.Serdeable | ||
public final class Child implements Parent { | ||
|
||
@com.fasterxml.jackson.annotation.JsonProperty("id") | ||
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL) | ||
private java.lang.String id; | ||
|
||
@com.fasterxml.jackson.annotation.JsonProperty("state") | ||
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL) | ||
private State state; | ||
|
||
@com.fasterxml.jackson.annotation.JsonProperty("name") | ||
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL) | ||
private java.lang.String name; | ||
|
||
// methods | ||
|
||
@Override | ||
public boolean equals(Object object) { | ||
if (object == this) { | ||
return true; | ||
} | ||
if (object == null || getClass() != object.getClass()) { | ||
return false; | ||
} | ||
Child other = (Child) object; | ||
return java.util.Objects.equals(id, other.id) | ||
&& java.util.Objects.equals(state, other.state) | ||
&& java.util.Objects.equals(name, other.name); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return java.util.Objects.hash(id, state, name); | ||
} | ||
|
||
@Override | ||
public java.lang.String toString() { | ||
return new java.lang.StringBuilder() | ||
.append("Child[") | ||
.append("id=").append(id).append(",") | ||
.append("state=").append(state).append(",") | ||
.append("name=").append(name) | ||
.append("]") | ||
.toString(); | ||
} | ||
|
||
// fluent | ||
|
||
public Child id(java.lang.String newId) { | ||
this.id = newId; | ||
return this; | ||
} | ||
|
||
public Child state(State newState) { | ||
this.state = newState; | ||
return this; | ||
} | ||
|
||
public Child name(java.lang.String newName) { | ||
this.name = newName; | ||
return this; | ||
} | ||
|
||
// getter/setter | ||
|
||
public java.lang.String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(java.lang.String newId) { | ||
this.id = newId; | ||
} | ||
|
||
public State getState() { | ||
return state; | ||
} | ||
|
||
public void setState(State newState) { | ||
this.state = newState; | ||
} | ||
|
||
public java.lang.String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(java.lang.String newName) { | ||
this.name = newName; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package issue._432; | ||
|
||
@jakarta.annotation.Generated("org.openapitools.codegen.languages.MicronautCodegen") | ||
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(as = ParentDefault.class) | ||
public sealed interface Parent permits Child, ParentDefault { | ||
|
||
|
||
@com.fasterxml.jackson.annotation.JsonProperty("id") | ||
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL) | ||
java.lang.String getId(); | ||
|
||
@com.fasterxml.jackson.annotation.JsonProperty("id") | ||
void setId(java.lang.String newId); | ||
|
||
@com.fasterxml.jackson.annotation.JsonProperty("state") | ||
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL) | ||
State getState(); | ||
|
||
@com.fasterxml.jackson.annotation.JsonProperty("state") | ||
void setState(State newState); | ||
|
||
@io.micronaut.serde.annotation.Serdeable | ||
public enum State { | ||
|
||
ON("on"), | ||
OFF("off"); | ||
|
||
public static final java.lang.String ON_VALUE = "on"; | ||
public static final java.lang.String OFF_VALUE = "off"; | ||
|
||
private final java.lang.String value; | ||
|
||
private State(java.lang.String value) { | ||
this.value = value; | ||
} | ||
|
||
@com.fasterxml.jackson.annotation.JsonCreator | ||
public static State toEnum(java.lang.String value) { | ||
return toOptional(value).orElseThrow(() -> new IllegalArgumentException("Unknown value '" + value + "'.")); | ||
} | ||
|
||
public static java.util.Optional<State> toOptional(java.lang.String value) { | ||
return java.util.Arrays | ||
.stream(values()) | ||
.filter(e -> e.value.equals(value)) | ||
.findAny(); | ||
} | ||
|
||
@com.fasterxml.jackson.annotation.JsonValue | ||
public java.lang.String getValue() { | ||
return value; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package issue._432; | ||
|
||
@jakarta.annotation.Generated("org.openapitools.codegen.languages.MicronautCodegen") | ||
@io.micronaut.serde.annotation.Serdeable | ||
public final class ParentDefault implements Parent { | ||
|
||
@com.fasterxml.jackson.annotation.JsonProperty("id") | ||
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL) | ||
private java.lang.String id; | ||
|
||
@com.fasterxml.jackson.annotation.JsonProperty("state") | ||
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL) | ||
private State state; | ||
|
||
// methods | ||
|
||
@Override | ||
public boolean equals(Object object) { | ||
if (object == this) { | ||
return true; | ||
} | ||
if (object == null || getClass() != object.getClass()) { | ||
return false; | ||
} | ||
ParentDefault other = (ParentDefault) object; | ||
return java.util.Objects.equals(id, other.id) | ||
&& java.util.Objects.equals(state, other.state); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return java.util.Objects.hash(id, state); | ||
} | ||
|
||
@Override | ||
public java.lang.String toString() { | ||
return new java.lang.StringBuilder() | ||
.append("ParentDefault[") | ||
.append("id=").append(id).append(",") | ||
.append("state=").append(state) | ||
.append("]") | ||
.toString(); | ||
} | ||
|
||
// fluent | ||
|
||
public ParentDefault id(java.lang.String newId) { | ||
this.id = newId; | ||
return this; | ||
} | ||
|
||
public ParentDefault state(State newState) { | ||
this.state = newState; | ||
return this; | ||
} | ||
|
||
// getter/setter | ||
|
||
public java.lang.String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(java.lang.String newId) { | ||
this.id = newId; | ||
} | ||
|
||
public State getState() { | ||
return state; | ||
} | ||
|
||
public void setState(State newState) { | ||
this.state = newState; | ||
} | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
openapi: 3.0.1 | ||
info: | ||
version: 0.0.1 | ||
title: EnumTest | ||
paths: {} | ||
components: | ||
schemas: | ||
Parent: | ||
type: object | ||
properties: | ||
id: | ||
type: string | ||
state: | ||
enum: ["on", "off"] | ||
Child: | ||
allOf: | ||
- type: object | ||
properties: | ||
name: | ||
type: string | ||
- $ref: "#/components/schemas/Parent" |