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

async function support #91

Open
AmirEspahbodi opened this issue May 1, 2024 · 1 comment
Open

async function support #91

AmirEspahbodi opened this issue May 1, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@AmirEspahbodi
Copy link

AmirEspahbodi commented May 1, 2024

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
@yctomwang yctomwang added the enhancement New feature or request label May 3, 2024
@kouk
Copy link

kouk commented Dec 10, 2024

@yctomwang i'm using the changes written by @MarekPikula here: #70
The changes are a bit out of date with the latest version of the package so I had to resolve the conflicts in my branch here:
https://github.com/kouk/flask-pydantic/tree/improve_typing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants