Explicitly support Flask async routes (#1592)

This commit is contained in:
Robbe Sneyders
2022-09-26 20:04:23 +02:00
committed by GitHub
parent fc003ca140
commit 024666de89
5 changed files with 25 additions and 1 deletions

View File

@@ -33,7 +33,7 @@ install_requires = [
swagger_ui_require = 'swagger-ui-bundle>=0.0.2,<0.1'
flask_require = [
'flask>=2.2,<3',
'flask[async]>=2.2,<3',
'a2wsgi>=1.4,<2',
]

View File

@@ -361,3 +361,9 @@ def test_using_all_fields_in_path_item(simple_api_spec_dir):
continue
test_methods.update({method.lower() for method in rule.methods})
assert set(test_methods) == METHODS
def test_async_route(simple_app):
app_client = simple_app.app.test_client()
resp = app_client.get("/v1.0/async-route")
assert resp.status_code == 200

View File

@@ -647,3 +647,7 @@ def nullable_default(test):
def get_streaming_response():
return send_file(__file__)
async def async_route():
return {}, 200

View File

@@ -1239,6 +1239,13 @@ paths:
responses:
'200':
description: Echo the validated request.
/async-route:
get:
operationId: fakeapi.hello.async_route
responses:
200:
description: 'OK'
servers:
- url: http://localhost:{port}/{basePath}

View File

@@ -1046,6 +1046,13 @@ paths:
schema:
type: file
/async-route:
get:
operationId: fakeapi.hello.async_route
responses:
200:
description: 'OK'
definitions:
new_stack:
type: object