Skip to content

Commit

Permalink
Class level @tag overwrites method level @Operation.tags. Fixes #1475
Browse files Browse the repository at this point in the history
  • Loading branch information
bnasslahsen committed Jan 28, 2022
1 parent 9f73f4e commit d46b735
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,17 @@ public Operation buildTags(HandlerMethod handlerMethod, Operation operation, Ope
}
}

if (!CollectionUtils.isEmpty(tagsStr))
operation.setTags(new ArrayList<>(tagsStr));
if (!CollectionUtils.isEmpty(tagsStr)) {
if(CollectionUtils.isEmpty(operation.getTags()))
operation.setTags(new ArrayList<>(tagsStr));
else
{
Set<String> operationTagsSet = new HashSet<>(operation.getTags());
operationTagsSet.addAll(tagsStr);
operation.getTags().clear();
operation.getTags().addAll(operationTagsSet);
}
}

if (isAutoTagClasses(operation))
operation.addTagsItem(splitCamelCase(handlerMethod.getBeanType().getSimpleName()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
"/inventory": {
"get": {
"tags": [
"developers",
"inventory"
],
"summary": "By passing in the appropriate options, you can search for available inventory in the system ",
Expand Down Expand Up @@ -414,7 +415,8 @@
},
"post": {
"tags": [
"inventory"
"inventory",
"admins"
],
"summary": "Adds an item to the system",
"description": "adds an inventory item",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@
"/inventory": {
"get": {
"tags": [
"developers",
"inventory"
],
"summary": "By passing in the appropriate options, you can search for available inventory in the system ",
Expand Down Expand Up @@ -407,7 +408,8 @@
},
"post": {
"tags": [
"inventory"
"inventory",
"admins"
],
"summary": "Adds an item to the system",
"description": "adds an inventory item",
Expand Down

0 comments on commit d46b735

Please sign in to comment.