Skip to content

doc and Input decorators do not ensure_sync for async flask handlers #288

@jiashuChen

Description

@jiashuChen

Expectation:
Expect apiflask to support following handlers

    @app.post('/')
    @app.input(FooSchema)
    async def index(data):
        return data

    @app.post('/')
    @app.input(FooSchema)
    async def index(data):
        return data

Actual Result:
Flask app return following stack trace:

sys:1: RuntimeWarning: coroutine 'test_async_input_decorator_only.<locals>.index' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
  • Python version: 3.8
  • Flask version: >=2.0.0
  • APIFlask version: latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions