Skip to content

Commit

Permalink
Merge paths if they already are added to the paths map (#1171)
Browse files Browse the repository at this point in the history
  • Loading branch information
hdoordt authored Oct 28, 2024
1 parent d21c03e commit 8a5ed1e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions utoipa-axum/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog - utoipa-axum

## Unreleased

* Merge paths if they already are added to the paths map in utoipa-axum (https://github.com/juhaku/utoipa/pull/1171)

## 0.1.1 - Oct 16 2024

### Changed
Expand Down
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 {
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 8a5ed1e

Please sign in to comment.