[python] fix custom model template feature (#9118)

* Removes colliding __init__model.mustache in PythonClientCodegen.java

* Removes unused files

* Regenerates samples
This commit is contained in:
Justin Black
2021-03-28 11:28:25 -07:00
committed by GitHub
parent c99226900b
commit fe52529f05
5 changed files with 8 additions and 4 deletions

View File

@@ -125,8 +125,16 @@ public class PythonClientCodegen extends PythonLegacyClientCodegen {
supportingFiles.add(new SupportingFile("model_utils.mustache", packagePath(), "model_utils.py"));
// add the models and apis folders
supportingFiles.add(new SupportingFile("__init__models.mustache", packagePath() + File.separatorChar + "models", "__init__.py"));
SupportingFile originalInitModel = supportingFiles.stream()
.filter(sf -> sf.getTemplateFile().equals("__init__model.mustache"))
.reduce((a, b) -> {
throw new IllegalStateException("Multiple elements: " + a + ", " + b);
})
.get();
supportingFiles.remove(originalInitModel);
supportingFiles.add(new SupportingFile("__init__model.mustache", packagePath() + File.separatorChar + "model", "__init__.py"));
supportingFiles.add(new SupportingFile("__init__apis.mustache", packagePath() + File.separatorChar + "apis", "__init__.py"));
// Generate the 'signing.py' module, but only if the 'HTTP signature' security scheme is specified in the OAS.

View File

@@ -150,7 +150,6 @@ petstore_api/model/user.py
petstore_api/model/xml_item.py
petstore_api/model_utils.py
petstore_api/models/__init__.py
petstore_api/models/__init__.py
petstore_api/rest.py
requirements.txt
setup.cfg

View File

@@ -20,5 +20,4 @@ x_auth_id_alias/exceptions.py
x_auth_id_alias/model/__init__.py
x_auth_id_alias/model_utils.py
x_auth_id_alias/models/__init__.py
x_auth_id_alias/models/__init__.py
x_auth_id_alias/rest.py

View File

@@ -13,7 +13,6 @@ dynamic_servers/exceptions.py
dynamic_servers/model/__init__.py
dynamic_servers/model_utils.py
dynamic_servers/models/__init__.py
dynamic_servers/models/__init__.py
dynamic_servers/rest.py
git_push.sh
requirements.txt

View File

@@ -196,7 +196,6 @@ petstore_api/model/whale.py
petstore_api/model/zebra.py
petstore_api/model_utils.py
petstore_api/models/__init__.py
petstore_api/models/__init__.py
petstore_api/rest.py
petstore_api/signing.py
requirements.txt