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
[BUG][java] Discriminator default for direct property enum $ref generates String.<value> #24874
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Describe the bug
The Java client generator produces Java that does not compile when a discriminator property is a direct $ref to an inline enum property. The generated child constructor assigns the discriminator mapping value as though the property were String:
error: cannot find symbol
symbol: variable ARCHIVE
location: class String
The same failure occurs with OpenAPI Generator 7.24.0.
Expected result
The direct property reference should retain the enum type at the discriminator use site. The generated constructor should assign the enum member, rather than String.ARCHIVE, and the generated client should compile.
@mricken I've tested with restClient and Spring.
It compiles. It uses a String
So the issue is specific to the default java generator: okhttp-gson. See modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache
Activity
jpfinne commentedon Sep 8, 2026
@mricken I've tested with restClient and Spring.
It compiles. It uses a String
So the issue is specific to the default java generator: okhttp-gson. See modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache
fix(java): don't emit unqualified enum default for discriminator ref-…