You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inner URI Enums with useEnumCaseInsensitive causes compilation errors #20952
if (b.value.{{^isString}}equals{{/isString}}{{#isString}}{{#useEnumCaseInsensitive}}equalsIgnoreCase{{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}equals{{/useEnumCaseInsensitive}}{{/isString}}(value)) {
The current implementation of inner enum classes are not working for:
<library>okhttp-gson</library>
<enumCaseInsensitive>true</enumCaseInsensitive>
type: string
format: uri
This would generate:
publicstaticExampleInnerThreeEnumfromValue(URIvalue) {
for (ExampleInnerThreeEnumb : ExampleInnerThreeEnum.values()) {
if (b.value.equalsIgnoreCase(value)) {
returnb;
}
}
thrownewIllegalArgumentException("Unexpected value '" + value + "'");
}
Which will cause compilation errors, since URI does not have a method equalsIgnoreCase.
Activity
Chrimle commentedon Mar 23, 2025
I fixed this bug in my project by updating the generation of the
fromValuein inner enum classes like so:https://github.com/Chrimle/openapi-to-java-records-mustache-templates/pull/379/files#diff-aeb7136d23f600e2b94b74af6d963df0114170da689c37a60bc64bbccea4565cR100