ningyougang commented on code in PR #516:
URL: https://github.com/apache/openwhisk-cli/pull/516#discussion_r950954594


##########
commands/util.go:
##########
@@ -604,16 +604,20 @@ func getChildValueStrings(keyValueArr whisk.KeyValueArr, 
key string, childKey st
        return res
 }
 
-func getValueFromJSONResponse(field string, response map[string]interface{}) 
interface{} {
+func getValueFromJSONResponse(field string, response interface{}) interface{} {
        var res interface{}
 
-       for key, value := range response {
-               if key == field {
-                       res = value
-                       break
+       if result, ok := response.(map[string]interface{}); ok {
+               for key, value := range result {
+                       if key == field {
+                               res = value
+                               break
+                       }
                }
        }
-
+       if result, ok := response.([]interface{}); ok {

Review Comment:
   Btw, i already cherry-pick this pr's commits to 
https://github.com/apache/openwhisk-cli/pull/517,
   Because add-array-result pr: https://github.com/apache/openwhisk/pull/5290 
is merged before than this pr, so when build this pr and execute this pr's test 
cases, it would execute openwhisk core relative's add-array-result feature test 
cases. e.g. when invoke below test case
   
![image](https://user-images.githubusercontent.com/11749867/185826163-7e317072-d2f5-4ad1-a887-e4d0932e26dc.png)
   it invoke use `CLIActivationsOperations` to get result in this pr
   
![image](https://user-images.githubusercontent.com/11749867/185826242-ee8d7dc8-ca3e-4e4f-afc7-5946ae77b3a9.png)
   
   When build openwhisk pr, it would use `RestActivationsOperations` to get the 
result
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to