diff --git a/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/wrapper/QuarkusJavaClientCodegen.java b/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/wrapper/QuarkusJavaClientCodegen.java index 2f62071f..96f13924 100644 --- a/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/wrapper/QuarkusJavaClientCodegen.java +++ b/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/wrapper/QuarkusJavaClientCodegen.java @@ -168,7 +168,7 @@ public String toEnumVarName(String value, String datatype) { // remove _ at start and end enumVarName = enumVarName.replaceAll("^_+|_+$", ""); - enumVarName = enumVarName.replaceFirst("\\d.*", "_".concat(enumVarName)); + enumVarName = enumVarName.replaceFirst("^(\\d).*", "_".concat(enumVarName)); return enumVarName.toUpperCase(Locale.ROOT); } diff --git a/deployment/src/test/java/io/quarkiverse/openapi/generator/deployment/wrapper/QuarkusJavaClientCodegenTest.java b/deployment/src/test/java/io/quarkiverse/openapi/generator/deployment/wrapper/QuarkusJavaClientCodegenTest.java index 8e56cd2d..c1a871ad 100644 --- a/deployment/src/test/java/io/quarkiverse/openapi/generator/deployment/wrapper/QuarkusJavaClientCodegenTest.java +++ b/deployment/src/test/java/io/quarkiverse/openapi/generator/deployment/wrapper/QuarkusJavaClientCodegenTest.java @@ -16,7 +16,10 @@ class QuarkusJavaClientCodegenTest { "123456,String,_123456", "quarkus_resources,String,QUARKUS_RESOURCES", "123456,Integer,NUMBER_123456", // old behavior - "123+123,Long,NUMBER_123PLUS_123" // old behavior + "123+123,Long,NUMBER_123PLUS_123", // old behavior, + "M123,String,M123", + "MA456,String,MA456", + "P1,String,P1", }) void toEnumVarName(String value, String dataType, String expectedVarName) {