bauerji / flask-pydantic

flask extension for integration with the awesome pydantic package
MIT License
352 stars 56 forks source link

async function support #91

Open AmirEspahbodi opened 4 months ago

AmirEspahbodi commented 4 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