-
Notifications
You must be signed in to change notification settings - Fork 70
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
Route layers for route functions #86
Comments
All you need to do is to add following method right next to layer() method in ApiMethodRouter /// This method wraps a route_layer around the [`ApiMethodRouter`]
/// For further information see [`axum::routing::method_routing::MethodRouter::route_layer`]
pub fn route_layer<L>(self, layer: L) -> ApiMethodRouter<S, B, Infallible>
where
L: Layer<Route<B, Infallible>> + Clone + Send + 'static,
L::Service: Service<Request<B>, Error = Infallible> + Clone + Send + 'static,
<L::Service as Service<Request<B>>>::Response: IntoResponse + 'static,
<L::Service as Service<Request<B>>>::Future: Send + 'static,
{
ApiMethodRouter {
router: self.router.route_layer(layer),
operations: self.operations,
}
} |
What do you think? |
I've added a PR that aligns the routing interface with axum's that adds this method as well. |
thank you |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First of all, thank you so much for this great library! I enjoy the code first experience with auto generated docs.
Currently for
aide::axum::routing::{delete, get, patch, put, post}
and other routing functions it is impossible to set route layers.For example this code is valid for
axum::routing::{delete, get, patch, put, post}
:but with
aide::axum::routing
functions there is no.route_layer()
function, only.layer()
function is available, but it is impossible to use multiple.layer()
function for a specific route. So it would be great if this code become valid:But currently following errors is received:
The text was updated successfully, but these errors were encountered: