From 9af9719a8a428e8c992d85244931c8ebbcc7de40 Mon Sep 17 00:00:00 2001 From: "ning.yougang" Date: Tue, 24 May 2022 16:59:22 +0800 Subject: [PATCH 1/3] POEM support array result --- proposals/POEM-support-array-result.md | 67 ++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 proposals/POEM-support-array-result.md diff --git a/proposals/POEM-support-array-result.md b/proposals/POEM-support-array-result.md new file mode 100644 index 00000000000..e93cf4cf2e0 --- /dev/null +++ b/proposals/POEM-support-array-result.md @@ -0,0 +1,67 @@ + +# Title + +Currently, openwhisk supports return json object only, e.g. +```shell +# wsk action invoke hello -r +{ + "greeting": "Hello stranger!" +} +``` +It is necessary to support return array, e.g. +```shell +# wsk action invoke hello-array -r +[ + "a", + "b" +] +``` + +# Status +* Current state: In-progress +* Author(s): @ningyougang + +# Summary and Motivation + +This POEM proposes a new feature that allows user to write their own action which supports array result. +So the result will support object and array both in future. + +# Proposed changes +## Openwhisk main repo +Make controller and invoker support array result both. + +## Runtime repos +All runtime images should support array result. e.g. + +* nodejs +* go +* java +* python +* php +* shell +* docker +* ruby +* dotnet +* rust +* swift + +## Openwhisk-cli repo +* When use wsk to execute action, need to support parse array result. +* When use wsk to get activation, need to support parse array result as well. From 589bf03244763a1cc853e931636dc3f17231a6e0 Mon Sep 17 00:00:00 2001 From: "ning.yougang" Date: Thu, 21 Jul 2022 15:27:31 +0800 Subject: [PATCH 2/3] Add missing runtime --- proposals/POEM-support-array-result.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/proposals/POEM-support-array-result.md b/proposals/POEM-support-array-result.md index e93cf4cf2e0..bf579e07e85 100644 --- a/proposals/POEM-support-array-result.md +++ b/proposals/POEM-support-array-result.md @@ -25,7 +25,7 @@ Currently, openwhisk supports return json object only, e.g. "greeting": "Hello stranger!" } ``` -It is necessary to support return array, e.g. +It is necessary to support return array for common action, e.g. ```shell # wsk action invoke hello-array -r [ @@ -33,6 +33,7 @@ It is necessary to support return array, e.g. "b" ] ``` +For sequence action, need to support as well. # Status * Current state: In-progress @@ -50,7 +51,7 @@ Make controller and invoker support array result both. ## Runtime repos All runtime images should support array result. e.g. -* nodejs +* nodejs (supports by default) * go * java * python @@ -61,6 +62,8 @@ All runtime images should support array result. e.g. * dotnet * rust * swift +* deno +* ballerina ## Openwhisk-cli repo * When use wsk to execute action, need to support parse array result. From d4899a63f7b767caaab01bfc99e49eab0bade978 Mon Sep 17 00:00:00 2001 From: "ning.yougang" Date: Tue, 26 Jul 2022 13:23:59 +0800 Subject: [PATCH 3/3] Apply review comment --- proposals/POEM-support-array-result.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/proposals/POEM-support-array-result.md b/proposals/POEM-support-array-result.md index bf579e07e85..652be2dbe9f 100644 --- a/proposals/POEM-support-array-result.md +++ b/proposals/POEM-support-array-result.md @@ -18,14 +18,14 @@ --> # Title -Currently, openwhisk supports return json object only, e.g. +Currently, OpenWhisk supports returning a JSON object only, e.g. ```shell # wsk action invoke hello -r { "greeting": "Hello stranger!" } ``` -It is necessary to support return array for common action, e.g. +It is necessary to support returning an array too as an array is also a proper JSON object, e.g. ```shell # wsk action invoke hello-array -r [ @@ -33,7 +33,7 @@ It is necessary to support return array for common action, e.g. "b" ] ``` -For sequence action, need to support as well. +The sequence action should be considered support as well. # Status * Current state: In-progress @@ -41,15 +41,15 @@ For sequence action, need to support as well. # Summary and Motivation -This POEM proposes a new feature that allows user to write their own action which supports array result. -So the result will support object and array both in future. +This POEM proposes a new feature that allows user to write their own action which supports an array result. +So actions would be able to return a JSON object or an array. # Proposed changes ## Openwhisk main repo -Make controller and invoker support array result both. +Make controller and invoker support both a JSON object and an array result. ## Runtime repos -All runtime images should support array result. e.g. +All runtime images should support an array result. e.g. * nodejs (supports by default) * go @@ -66,5 +66,5 @@ All runtime images should support array result. e.g. * ballerina ## Openwhisk-cli repo -* When use wsk to execute action, need to support parse array result. -* When use wsk to get activation, need to support parse array result as well. +* The `wsk` CLI needs to support parsing an array result when executing actions. +* The `wsk` CLI needs to support parsing an array result when getting activations.