quarkiverse / quarkus-openapi-generator

OpenAPI Generator - REST Client Generator
Apache License 2.0
119 stars 80 forks source link

Constant names for Enums have changed with 2.2.12 #537

Closed chberger closed 11 months ago

chberger commented 11 months ago

I've updated quarkus-openapi-generator from 2.2.11 to 2.2.12. With that release it seems like constant names for enums will be determined in a different way.

Related PR: https://github.com/quarkiverse/quarkus-openapi-generator/pull/510/files#diff-72cbb66ba35c7356ee16cd4b1dc1ba37c30f4ad9af3d1ca8685a825f631b83be

Before version 2.2.12 a value of M123 led to a constant called M123. Now with that PR the enum constant has changed to M_M123.

⚠️ This is a breaking change which I would not expect in a patch update.

I've extended QuarkusJavaClientCodegenTest with two scenarios to showcase the behavior: https://github.com/techspace-de/quarkus-openapi-generator/commit/caac29de1b2e0dd6f1413ef79e8fb94708c9ad34

The last two test parameters will fail:

rg.opentest4j.AssertionFailedError: 
expected: "M123"
 but was: "M_M123"
Expected :"M123"
Actual   :"M_M123"
<Click to see difference>

    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
..

and

rg.opentest4j.AssertionFailedError: 
expected: "MA456"
 but was: "MA_MA456"
Expected :"MA456"
Actual   :"MA_MA456"
<Click to see difference>

    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
chberger commented 11 months ago

CC @hbelmiro @fjtirado @ricardozanini @mcruzdev

ricardozanini commented 11 months ago

@mcruzdev can you please take a look?

michalsomora commented 11 months ago

The same issue is mentioned already here https://github.com/quarkiverse/quarkus-openapi-generator/issues/421#issuecomment-1770382260

mcruzdev commented 11 months ago

Hi @ricardozanini, of course!

mcruzdev commented 11 months ago

Sorry for the delay, I was out, I am getting this issue now.

mcruzdev commented 11 months ago

Hi @chberger, pull request opened #541.

ricardozanini commented 11 months ago

@hbelmiro can you release a new patch version?