Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flask connexion support #1066

Merged
merged 1 commit into from
Sep 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ public String getSchemaType(Schema p) {

@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()) {
Expand All @@ -330,9 +331,9 @@ public void preprocessOpenAPI(OpenAPI openAPI) {
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)
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
connexion == 1.1.15
# Install flask-connexion from git branch dev-2.0. Change when connexion 2.0 is released
git+https://github.com/zalando/connexion.git@35e4e678ef69e703eaf84a48126049808c73b17c#egg=connexion
swagger-ui-bundle
python_dateutil == 2.6.0
{{#supportPython2}}
typing == 3.5.2.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ paths:
summary: Add a new pet to the store
tags:
- pet
x-openapi-router-controller: openapi_server.controllers.pet_controller
x-swagger-router-controller: openapi_server.controllers.pet_controller
put:
operationId: update_pet
requestBody:
Expand Down Expand Up @@ -70,7 +70,7 @@ paths:
summary: Update an existing pet
tags:
- pet
x-openapi-router-controller: openapi_server.controllers.pet_controller
x-swagger-router-controller: openapi_server.controllers.pet_controller
/pet/findByStatus:
get:
description: Multiple status values can be provided with comma separated strings
Expand Down Expand Up @@ -115,7 +115,7 @@ paths:
summary: Finds Pets by status
tags:
- pet
x-openapi-router-controller: openapi_server.controllers.pet_controller
x-swagger-router-controller: openapi_server.controllers.pet_controller
/pet/findByTags:
get:
deprecated: true
Expand Down Expand Up @@ -156,7 +156,7 @@ paths:
summary: Finds Pets by tags
tags:
- pet
x-openapi-router-controller: openapi_server.controllers.pet_controller
x-swagger-router-controller: openapi_server.controllers.pet_controller
/pet/{petId}:
delete:
operationId: delete_pet
Expand All @@ -183,7 +183,7 @@ paths:
summary: Deletes a pet
tags:
- pet
x-openapi-router-controller: openapi_server.controllers.pet_controller
x-swagger-router-controller: openapi_server.controllers.pet_controller
get:
description: Returns a single pet
operationId: get_pet_by_id
Expand Down Expand Up @@ -216,7 +216,7 @@ paths:
summary: Find pet by ID
tags:
- pet
x-openapi-router-controller: openapi_server.controllers.pet_controller
x-swagger-router-controller: openapi_server.controllers.pet_controller
post:
operationId: update_pet_with_form
parameters:
Expand Down Expand Up @@ -249,7 +249,7 @@ paths:
summary: Updates a pet in the store with form data
tags:
- pet
x-openapi-router-controller: openapi_server.controllers.pet_controller
x-swagger-router-controller: openapi_server.controllers.pet_controller
/pet/{petId}/uploadImage:
post:
operationId: upload_file
Expand Down Expand Up @@ -287,7 +287,7 @@ paths:
summary: uploads an image
tags:
- pet
x-openapi-router-controller: openapi_server.controllers.pet_controller
x-swagger-router-controller: openapi_server.controllers.pet_controller
/store/inventory:
get:
description: Returns a map of status codes to quantities
Expand All @@ -307,7 +307,7 @@ paths:
summary: Returns pet inventories by status
tags:
- store
x-openapi-router-controller: openapi_server.controllers.store_controller
x-swagger-router-controller: openapi_server.controllers.store_controller
/store/order:
post:
operationId: place_order
Expand All @@ -334,7 +334,7 @@ paths:
summary: Place an order for a pet
tags:
- store
x-openapi-router-controller: openapi_server.controllers.store_controller
x-swagger-router-controller: openapi_server.controllers.store_controller
/store/order/{orderId}:
delete:
description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
Expand All @@ -356,7 +356,7 @@ paths:
summary: Delete purchase order by ID
tags:
- store
x-openapi-router-controller: openapi_server.controllers.store_controller
x-swagger-router-controller: openapi_server.controllers.store_controller
get:
description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
operationId: get_order_by_id
Expand Down Expand Up @@ -389,7 +389,7 @@ paths:
summary: Find purchase order by ID
tags:
- store
x-openapi-router-controller: openapi_server.controllers.store_controller
x-swagger-router-controller: openapi_server.controllers.store_controller
/user:
post:
description: This can only be done by the logged in user.
Expand All @@ -408,7 +408,7 @@ paths:
summary: Create user
tags:
- user
x-openapi-router-controller: openapi_server.controllers.user_controller
x-swagger-router-controller: openapi_server.controllers.user_controller
/user/createWithArray:
post:
operationId: create_users_with_array_input
Expand All @@ -428,7 +428,7 @@ paths:
summary: Creates list of users with given input array
tags:
- user
x-openapi-router-controller: openapi_server.controllers.user_controller
x-swagger-router-controller: openapi_server.controllers.user_controller
/user/createWithList:
post:
operationId: create_users_with_list_input
Expand All @@ -448,7 +448,7 @@ paths:
summary: Creates list of users with given input array
tags:
- user
x-openapi-router-controller: openapi_server.controllers.user_controller
x-swagger-router-controller: openapi_server.controllers.user_controller
/user/login:
get:
operationId: login_user
Expand Down Expand Up @@ -492,7 +492,7 @@ paths:
summary: Logs user into the system
tags:
- user
x-openapi-router-controller: openapi_server.controllers.user_controller
x-swagger-router-controller: openapi_server.controllers.user_controller
/user/logout:
get:
operationId: logout_user
Expand All @@ -503,7 +503,7 @@ paths:
summary: Logs out current logged in user session
tags:
- user
x-openapi-router-controller: openapi_server.controllers.user_controller
x-swagger-router-controller: openapi_server.controllers.user_controller
/user/{username}:
delete:
description: This can only be done by the logged in user.
Expand All @@ -525,7 +525,7 @@ paths:
summary: Delete user
tags:
- user
x-openapi-router-controller: openapi_server.controllers.user_controller
x-swagger-router-controller: openapi_server.controllers.user_controller
get:
operationId: get_user_by_name
parameters:
Expand Down Expand Up @@ -554,7 +554,7 @@ paths:
summary: Get user by user name
tags:
- user
x-openapi-router-controller: openapi_server.controllers.user_controller
x-swagger-router-controller: openapi_server.controllers.user_controller
put:
description: This can only be done by the logged in user.
operationId: update_user
Expand Down Expand Up @@ -582,7 +582,7 @@ paths:
summary: Updated user
tags:
- user
x-openapi-router-controller: openapi_server.controllers.user_controller
x-swagger-router-controller: openapi_server.controllers.user_controller
components:
schemas:
Order:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
connexion == 1.1.15
# Install flask-connexion from git branch dev-2.0. Change when connexion 2.0 is released
git+https://github.com/zalando/connexion.git@35e4e678ef69e703eaf84a48126049808c73b17c#egg=connexion
swagger-ui-bundle
python_dateutil == 2.6.0
typing == 3.5.2.2
setuptools >= 21.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ paths:
summary: Add a new pet to the store
tags:
- pet
x-openapi-router-controller: openapi_server.controllers.pet_controller
x-swagger-router-controller: openapi_server.controllers.pet_controller
put:
operationId: update_pet
requestBody:
Expand Down Expand Up @@ -70,7 +70,7 @@ paths:
summary: Update an existing pet
tags:
- pet
x-openapi-router-controller: openapi_server.controllers.pet_controller
x-swagger-router-controller: openapi_server.controllers.pet_controller
/pet/findByStatus:
get:
description: Multiple status values can be provided with comma separated strings
Expand Down Expand Up @@ -115,7 +115,7 @@ paths:
summary: Finds Pets by status
tags:
- pet
x-openapi-router-controller: openapi_server.controllers.pet_controller
x-swagger-router-controller: openapi_server.controllers.pet_controller
/pet/findByTags:
get:
deprecated: true
Expand Down Expand Up @@ -156,7 +156,7 @@ paths:
summary: Finds Pets by tags
tags:
- pet
x-openapi-router-controller: openapi_server.controllers.pet_controller
x-swagger-router-controller: openapi_server.controllers.pet_controller
/pet/{petId}:
delete:
operationId: delete_pet
Expand All @@ -183,7 +183,7 @@ paths:
summary: Deletes a pet
tags:
- pet
x-openapi-router-controller: openapi_server.controllers.pet_controller
x-swagger-router-controller: openapi_server.controllers.pet_controller
get:
description: Returns a single pet
operationId: get_pet_by_id
Expand Down Expand Up @@ -216,7 +216,7 @@ paths:
summary: Find pet by ID
tags:
- pet
x-openapi-router-controller: openapi_server.controllers.pet_controller
x-swagger-router-controller: openapi_server.controllers.pet_controller
post:
operationId: update_pet_with_form
parameters:
Expand Down Expand Up @@ -249,7 +249,7 @@ paths:
summary: Updates a pet in the store with form data
tags:
- pet
x-openapi-router-controller: openapi_server.controllers.pet_controller
x-swagger-router-controller: openapi_server.controllers.pet_controller
/pet/{petId}/uploadImage:
post:
operationId: upload_file
Expand Down Expand Up @@ -287,7 +287,7 @@ paths:
summary: uploads an image
tags:
- pet
x-openapi-router-controller: openapi_server.controllers.pet_controller
x-swagger-router-controller: openapi_server.controllers.pet_controller
/store/inventory:
get:
description: Returns a map of status codes to quantities
Expand All @@ -307,7 +307,7 @@ paths:
summary: Returns pet inventories by status
tags:
- store
x-openapi-router-controller: openapi_server.controllers.store_controller
x-swagger-router-controller: openapi_server.controllers.store_controller
/store/order:
post:
operationId: place_order
Expand All @@ -334,7 +334,7 @@ paths:
summary: Place an order for a pet
tags:
- store
x-openapi-router-controller: openapi_server.controllers.store_controller
x-swagger-router-controller: openapi_server.controllers.store_controller
/store/order/{orderId}:
delete:
description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
Expand All @@ -356,7 +356,7 @@ paths:
summary: Delete purchase order by ID
tags:
- store
x-openapi-router-controller: openapi_server.controllers.store_controller
x-swagger-router-controller: openapi_server.controllers.store_controller
get:
description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
operationId: get_order_by_id
Expand Down Expand Up @@ -389,7 +389,7 @@ paths:
summary: Find purchase order by ID
tags:
- store
x-openapi-router-controller: openapi_server.controllers.store_controller
x-swagger-router-controller: openapi_server.controllers.store_controller
/user:
post:
description: This can only be done by the logged in user.
Expand All @@ -408,7 +408,7 @@ paths:
summary: Create user
tags:
- user
x-openapi-router-controller: openapi_server.controllers.user_controller
x-swagger-router-controller: openapi_server.controllers.user_controller
/user/createWithArray:
post:
operationId: create_users_with_array_input
Expand All @@ -428,7 +428,7 @@ paths:
summary: Creates list of users with given input array
tags:
- user
x-openapi-router-controller: openapi_server.controllers.user_controller
x-swagger-router-controller: openapi_server.controllers.user_controller
/user/createWithList:
post:
operationId: create_users_with_list_input
Expand All @@ -448,7 +448,7 @@ paths:
summary: Creates list of users with given input array
tags:
- user
x-openapi-router-controller: openapi_server.controllers.user_controller
x-swagger-router-controller: openapi_server.controllers.user_controller
/user/login:
get:
operationId: login_user
Expand Down Expand Up @@ -492,7 +492,7 @@ paths:
summary: Logs user into the system
tags:
- user
x-openapi-router-controller: openapi_server.controllers.user_controller
x-swagger-router-controller: openapi_server.controllers.user_controller
/user/logout:
get:
operationId: logout_user
Expand All @@ -503,7 +503,7 @@ paths:
summary: Logs out current logged in user session
tags:
- user
x-openapi-router-controller: openapi_server.controllers.user_controller
x-swagger-router-controller: openapi_server.controllers.user_controller
/user/{username}:
delete:
description: This can only be done by the logged in user.
Expand All @@ -525,7 +525,7 @@ paths:
summary: Delete user
tags:
- user
x-openapi-router-controller: openapi_server.controllers.user_controller
x-swagger-router-controller: openapi_server.controllers.user_controller
get:
operationId: get_user_by_name
parameters:
Expand Down Expand Up @@ -554,7 +554,7 @@ paths:
summary: Get user by user name
tags:
- user
x-openapi-router-controller: openapi_server.controllers.user_controller
x-swagger-router-controller: openapi_server.controllers.user_controller
put:
description: This can only be done by the logged in user.
operationId: update_user
Expand Down Expand Up @@ -582,7 +582,7 @@ paths:
summary: Updated user
tags:
- user
x-openapi-router-controller: openapi_server.controllers.user_controller
x-swagger-router-controller: openapi_server.controllers.user_controller
components:
schemas:
Order:
Expand Down
Loading