Fix flask connexion support (#1066)

Use the dev-2.0 git branch of flask connexion to fix the generator.
This is not ideal but better than a generator not working at all.

Fix #323
This commit is contained in:
Christophe Bornet
2018-09-20 13:48:28 +02:00
committed by William Cheng
parent c0a6eaab85
commit 6dc618fa3f
6 changed files with 53 additions and 46 deletions

View File

@@ -312,7 +312,8 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements
@Override
public void preprocessOpenAPI(OpenAPI openAPI) {
// need vendor extensions for x-openapi-router-controller
// need vendor extensions for x-swagger-router-controller
// can be changed to x-openapi-router-controller when https://github.com/zalando/connexion/issues/683 is done
Map<String, PathItem> paths = openAPI.getPaths();
if (paths != null) {
for (String pathname : paths.keySet()) {
@@ -330,9 +331,9 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements
operationId = getOrGenerateOperationId(operation, pathname, method.toString());
}
operation.setOperationId(toOperationId(operationId));
if (operation.getExtensions() == null || operation.getExtensions().get("x-openapi-router-controller") == null) {
if (operation.getExtensions() == null || operation.getExtensions().get("x-swagger-router-controller") == null) {
operation.addExtension(
"x-openapi-router-controller",
"x-swagger-router-controller",
controllerPackage + "." + toApiFilename(tag)
);
}