You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Next to the synchronous Flask app, we also want to provide an asynchronous app. Instead of implementing an existing async framework, I propose to implement a simple 'native' app. We can implement this app using a combination of low level starlette components and the routing lookup mechanism we already implemented in the middleware.
Instead of using the native app, the connexion middleware can also be applied to existing async frameworks to add connexion functionality.
Fixes#1534
Changes proposed in this pull request:
- Adds a "native" async app based on lower level Starlette tools. It
leverages the routing already done in the middleware.
- Extracts code related to the parameter decorator out of the Operation
objects
There's some more work to be done, but this PR is already quite huge, so
I wanted to stop at a point where I got all the tests and a simple
example working.
- Still some general refactoring. I left some TODOs, and the Operation
classes are still relied on in too many places.
- Sync routes on an Async app should receive async decorators, so they
can access the body using `await`. The decorators should then run the
sync route in a threadpool to prevent blocking.
- We should be able to reuse the parameter decorator for all ASGI apps
since we're working with a Starlette Request which we can get directly
from the scope and receive channel, which we can make available as
context. This means we'll pass Starlette Datastructures to the view
functions (eg. FormData, UploadFiles, ...), but if this is opt-in, I
don't see any issue with this.
- We should be able to reuse the response parsing for Starlette apps as
well since it returns a StarletteResponse.
- We should test the AsyncApp as well. I'm hoping we can do this quite
quickly by generating a test client for it in the fixtures as well, but
in the long term some more work will be needed.
Next to the synchronous Flask app, we also want to provide an asynchronous app. Instead of implementing an existing async framework, I propose to implement a simple 'native' app. We can implement this app using a combination of low level starlette components and the routing lookup mechanism we already implemented in the middleware.
Instead of using the native app, the connexion middleware can also be applied to existing async frameworks to add connexion functionality.
#1395 for context.
The text was updated successfully, but these errors were encountered: