-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
refactor(routing)!: Refactor routes and route handlers #3386
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provinzkraut
commented
Apr 13, 2024
provinzkraut
commented
Apr 13, 2024
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v3.0 #3386 +/- ##
==========================================
- Coverage 98.25% 98.22% -0.03%
==========================================
Files 322 322
Lines 14672 14454 -218
Branches 2332 2290 -42
==========================================
- Hits 14416 14198 -218
- Misses 117 119 +2
+ Partials 139 137 -2 ☔ View full report in Codecov by Sentry. |
provinzkraut
added a commit
that referenced
this pull request
Dec 13, 2024
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Dec 13, 2024
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Dec 13, 2024
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 11, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 11, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 11, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 11, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 11, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 11, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 11, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 11, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 11, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 11, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 11, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 11, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 11, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 11, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 11, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 15, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 15, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 15, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 15, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 15, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 15, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 15, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 15, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 15, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Jan 28, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Feb 14, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
provinzkraut
added a commit
that referenced
this pull request
Feb 16, 2025
* remove handler names * Remove option handler creation from HTTPRoute * Remove methods attribute from BaseRoute * Move kwargs model to handlers and creation to on_registration * Store kwargs model on handlers instead of routes * Simplify HTTPRoute route_handler_map creation * Simplify Router.route_handler_method_map * Relax typing of HTTPRoute * Move handling logic to route handlers * Remove scope_type * Don't pass route to HTTPRouteHandler during handling * Don't pass scope to handle methods * Resolve and establish connections in routes; Only pass connections to handlers --------- Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Peter Schutt <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/docs
This PR involves changes to the documentation
area/handlers
This PR involves changes to the handlers
area/middleware
This PR involves changes to the middleware
area/openapi
This PR involves changes to the OpenAPI schema
area/private-api
This PR involves changes to the privatized API
area/router
pr/internal
size: large
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactor routes and route handlers in an attempt to simplify configuration.
The two general goals here are:
In general I'd like to restrict the routes to an internal part of the ASGI routing, only taking care of mapping a path > route handler(s), and establishing the connection. Everything else should be taken care of by the handlers.
What this currently does:
handler_names
property fromHTTPRoute
OPTIONS
handler creation from theHTTPRoute
to the route registration processmethods
attribute fromBaseRoute
; It does not make sense on the asgi/websocket routesKwargsModel
from the routes to the handlers and remove the outside mutation of the handlersASGIConnection
/WebSocket
/Request
in the routes and pass them to handlers instead of raw ASGI objects (scope
,receive
,send
)