Skip to content
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

Merge paths if they already are added to the paths map in utoipa-axum #1171

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading