forked from loafle/openapi-generator-original
fix operation id starting with number for python client (#682)
This commit is contained in:
parent
b587052de4
commit
036fa6918c
@ -224,7 +224,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
setPackageUrl((String) additionalProperties.get(PACKAGE_URL));
|
setPackageUrl((String) additionalProperties.get(PACKAGE_URL));
|
||||||
}
|
}
|
||||||
|
|
||||||
String readmePath ="README.md";
|
String readmePath = "README.md";
|
||||||
String readmeTemplate = "README.mustache";
|
String readmeTemplate = "README.mustache";
|
||||||
if (generateSourceCodeOnly) {
|
if (generateSourceCodeOnly) {
|
||||||
readmePath = packageName + "_" + readmePath;
|
readmePath = packageName + "_" + readmePath;
|
||||||
@ -232,7 +232,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
}
|
}
|
||||||
supportingFiles.add(new SupportingFile(readmeTemplate, "", readmePath));
|
supportingFiles.add(new SupportingFile(readmeTemplate, "", readmePath));
|
||||||
|
|
||||||
if (!generateSourceCodeOnly){
|
if (!generateSourceCodeOnly) {
|
||||||
supportingFiles.add(new SupportingFile("tox.mustache", "", "tox.ini"));
|
supportingFiles.add(new SupportingFile("tox.mustache", "", "tox.ini"));
|
||||||
supportingFiles.add(new SupportingFile("test-requirements.mustache", "", "test-requirements.txt"));
|
supportingFiles.add(new SupportingFile("test-requirements.mustache", "", "test-requirements.txt"));
|
||||||
supportingFiles.add(new SupportingFile("requirements.mustache", "", "requirements.txt"));
|
supportingFiles.add(new SupportingFile("requirements.mustache", "", "requirements.txt"));
|
||||||
@ -552,6 +552,12 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
operationId = "call_" + operationId;
|
operationId = "call_" + operationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// model name starts with a number
|
||||||
|
if (operationId.matches("^\\d.*")) {
|
||||||
|
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + underscore(sanitizeName("call_" + operationId)));
|
||||||
|
operationId = "call_" + operationId;
|
||||||
|
}
|
||||||
|
|
||||||
return underscore(sanitizeName(operationId));
|
return underscore(sanitizeName(operationId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
3.1.1-SNAPSHOT
|
3.2.0-SNAPSHOT
|
Loading…
x
Reference in New Issue
Block a user