Skip to content

Commit

Permalink
Merge paths if they already are added to the paths map
Browse files Browse the repository at this point in the history
  • Loading branch information
hdoordt committed Oct 28, 2024
1 parent d21c03e commit 1baf0ff
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions utoipa-axum/src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,15 @@ where
})
};

// add current paths to the OpenApi
self.1.paths.paths.extend(paths.paths.clone());
// add or merge current paths to the OpenApi
for (path, item) in paths.paths.clone() {
if let Some(it) = self.1.paths.paths.get_mut(&path) {
it.merge_operations(item);
} else {
self.1.paths.paths.insert(path, item);
}
}

let components = self
.1
.components
Expand Down

0 comments on commit 1baf0ff

Please sign in to comment.