You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2022/08/20 03:15:04 UTC

[GitHub] [openwhisk-cli] ningyougang commented on a diff in pull request #516: Support array result

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


##########
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:
   @dgrove-oss yes, you right.
   
   But it is better to cherry this pr's commits to https://github.com/apache/openwhisk-cli/pull/517 and close this pr
   I know it is not good due to `Fix deprecated issue(pull/517)` and this pr is target is different.
   
   And due to dependency problem, it seems we must do this,
   The reason is https://github.com/apache/openwhisk-cli/pull/517#issuecomment-1221219583



-- 
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: issues-unsubscribe@openwhisk.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org