fix minus sign in enum naming in python-nextgen (#15291)

This commit is contained in:
William Cheng 2023-04-24 16:07:29 +08:00 committed by GitHub
parent 52417f0597
commit d6e19f8f55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 1 deletions

View File

@ -1518,7 +1518,7 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
public String toEnumVariableName(String name, String datatype) {
if ("int".equals(datatype)) {
return "NUMBER_" + name;
return "NUMBER_" + name.replace("-", "MINUS_");
}
// remove quote e.g. 'abc' => abc

View File

@ -1864,6 +1864,7 @@ components:
OuterEnumIntegerDefaultValue:
type: integer
enum:
- -1
- 0
- 1
- 2

View File

@ -29,6 +29,7 @@ class OuterEnumIntegerDefaultValue(int, Enum):
"""
allowed enum values
"""
NUMBER_MINUS_1 = -1
NUMBER_0 = 0
NUMBER_1 = 1
NUMBER_2 = 2

View File

@ -29,6 +29,7 @@ class OuterEnumIntegerDefaultValue(int, Enum):
"""
allowed enum values
"""
NUMBER_MINUS_1 = -1
NUMBER_0 = 0
NUMBER_1 = 1
NUMBER_2 = 2