Skip to content

Commit 3557896

Browse files
committed
Fix some review comments
1 parent b14628c commit 3557896

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

core/controller/src/main/resources/apiv1swagger.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1915,7 +1915,7 @@
19151915
"items": {
19161916
"type": "string"
19171917
},
1918-
"description": "del annotations on the item"
1918+
"description": "The list of annotations to be deleted from the item"
19191919
},
19201920
"parameters": {
19211921
"type": "array",

core/controller/src/main/scala/org/apache/openwhisk/core/controller/Actions.scala

+5-6
Original file line numberDiff line numberDiff line change
@@ -537,13 +537,12 @@ trait WhiskActionsApi extends WhiskCollectionAPI with PostActionActivation with
537537

538538
val exec = content.exec getOrElse action.exec
539539

540-
var newAnnotations = action.annotations
541-
content.delAnnotations.map { annotationArray =>
542-
annotationArray.foreach { annotation =>
543-
newAnnotations -= annotation
540+
val newAnnotations = content.delAnnotations
541+
.map { annotationArray =>
542+
annotationArray.foldRight(action.annotations)((a: String, b: Parameters) => b - a)
544543
}
545-
}
546-
newAnnotations = newAnnotations ++ content.annotations
544+
.map(_ ++ content.annotations)
545+
.getOrElse(action.annotations ++ content.annotations)
547546

548547
WhiskAction(
549548
action.namespace,

tests/src/test/scala/org/apache/openwhisk/core/cli/test/WskRestBasicUsageTests.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class WskRestBasicUsageTests extends TestHelpers with WskTestHelpers with WskAct
131131
}
132132
}
133133

134-
it should "update an action via passing delAnnotations" in withAssetCleaner(wskprops) { (wp, assetHelper) =>
134+
it should "delete the given annotations using delAnnotations" in withAssetCleaner(wskprops) { (wp, assetHelper) =>
135135
val name = "hello"
136136

137137
assetHelper.withCleaner(wsk.action, name) { (action, _) =>

tests/src/test/scala/system/basic/WskActionTests.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ class WskActionTests extends TestHelpers with WskTestHelpers with JsHelpers with
357357
}
358358
}
359359

360-
it should "not delete previous annotation when update action with new annotation" in withAssetCleaner(wskprops) {
360+
it should "not delete existing annotations when updating action with new annotation" in withAssetCleaner(wskprops) {
361361
(wp, assetHelper) =>
362362
val name = "hello"
363363

0 commit comments

Comments
 (0)