-
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.
Add testcase for enum with validation, rel #311
- Loading branch information
Showing
6 changed files
with
95 additions
and
3 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
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,35 @@ | ||
package issue._331; | ||
|
||
@jakarta.annotation.Generated("org.openapitools.codegen.languages.MicronautCodegen") | ||
@io.micronaut.core.annotation.Introspected | ||
public enum StringWithEnum { | ||
|
||
A("A"), | ||
B("B"); | ||
|
||
public static final java.lang.String A_VALUE = "A"; | ||
public static final java.lang.String B_VALUE = "B"; | ||
|
||
private final java.lang.String value; | ||
|
||
private StringWithEnum(java.lang.String value) { | ||
this.value = value; | ||
} | ||
|
||
@com.fasterxml.jackson.annotation.JsonCreator | ||
public static StringWithEnum toEnum(java.lang.String value) { | ||
return toOptional(value).orElseThrow(() -> new IllegalArgumentException("Unknown value '" + value + "'.")); | ||
} | ||
|
||
public static java.util.Optional<StringWithEnum> 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
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