diff --git a/utoipa-axum/CHANGELOG.md b/utoipa-axum/CHANGELOG.md index b8a46afd..17226c88 100644 --- a/utoipa-axum/CHANGELOG.md +++ b/utoipa-axum/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Changed + +* Allow trailing comma in `routes!()` macro (https://github.com/juhaku/utoipa/pull/1238) + ### Fixed * Fix axum path nesting (https://github.com/juhaku/utoipa/pull/1231) diff --git a/utoipa-axum/src/lib.rs b/utoipa-axum/src/lib.rs index 7be427de..5c848a5b 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;