diff --git a/utoipa-axum/src/lib.rs b/utoipa-axum/src/lib.rs index 7be427de..d3525dcd 100644 --- a/utoipa-axum/src/lib.rs +++ b/utoipa-axum/src/lib.rs @@ -123,7 +123,7 @@ pub use paste::paste; /// ``` #[macro_export] macro_rules! routes { - ( $handler:path $(, $tail:path)* ) => { + ( $handler:path $(, $tail:path)* $(,)? ) => { { use $crate::PathItemExt; let mut paths = utoipa::openapi::path::Paths::new(); @@ -252,6 +252,12 @@ mod tests { let _ = router.get_openapi(); } + #[test] + fn routes_with_trailing_comma_compiles() { + let _: OpenApiRouter = OpenApiRouter::new() + .routes(routes!(get_user, post_user, delete_user,)); + } + #[test] fn openapi_router_with_openapi() { use utoipa::OpenApi;