mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 02:55:19 +00:00
better symbol mapping for enum name
This commit is contained in:
parent
89fe3403a7
commit
122af80881
@ -804,10 +804,12 @@ public class DefaultCodegen {
|
||||
specialCharReplacements.put(":", "Colon");
|
||||
specialCharReplacements.put(">", "Greater_Than");
|
||||
specialCharReplacements.put("<", "Less_Than");
|
||||
specialCharReplacements.put(".", "Period");
|
||||
specialCharReplacements.put("_", "Underscore");
|
||||
|
||||
specialCharReplacements.put("<=", "Less_Than_Or_Equal_To");
|
||||
specialCharReplacements.put(">=", "Greater_Than_Or_Equal_To");
|
||||
specialCharReplacements.put("!=", "Greater_Than_Or_Equal_To");
|
||||
specialCharReplacements.put("!=", "Not_Equal");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -184,12 +184,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen {
|
||||
model.imports.add("SerializedName");
|
||||
}
|
||||
} else { // enum class
|
||||
//Needed imports for Jackson based libraries
|
||||
//Needed imports for Jackson's JsonCreator
|
||||
if(additionalProperties.containsKey("jackson")) {
|
||||
model.imports.add("JsonCreator");
|
||||
model.imports.add("JsonProperty");
|
||||
}
|
||||
model.imports.add("JsonCreator");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,9 +27,9 @@ public class AbstractJavaCodegenTest {
|
||||
|
||||
@Test
|
||||
public void toEnumVarNameShouldNotShortenUnderScore() throws Exception {
|
||||
Assert.assertEquals("_", fakeJavaCodegen.toEnumVarName("_", "String"));
|
||||
Assert.assertEquals("UNDERSCORE", fakeJavaCodegen.toEnumVarName("_", "String"));
|
||||
Assert.assertEquals("__", fakeJavaCodegen.toEnumVarName("__", "String"));
|
||||
Assert.assertEquals("__", fakeJavaCodegen.toEnumVarName("_,.", "String"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user