bauerji / flask-pydantic

flask extension for integration with the awesome pydantic package
MIT License
368 stars 58 forks source link

async function support #91

Open AmirEspahbodi opened 7 months ago

AmirEspahbodi commented 7 months ago

Does this library also support async flask? Routes that are not async work well with decorator validate But those that are async have problems error: TypeError: The view function did not return a valid response. The return type must be a string, dict, list, tuple with headers or status, Response instance, or WSGI callable, but it was a coroutine

from flask import Blueprint
from .serializer import NotifySerializer
from flask_pydantic import validate, converters
notify_blueprint = Blueprint("notify", __name__)

@notify_blueprint.route("/notify", methods=["POST"])
@validate()
async def index(body: NotifySerializer):
     return body.count