style95 commented on code in PR #5311:
URL: https://github.com/apache/openwhisk/pull/5311#discussion_r948572866
##########
docs/actions-docker.md:
##########
@@ -236,6 +236,18 @@ DATE=`date`
echo "{ \"message\": \"Hello $NAME! It is $DATE.\" }"
```
+For the return result, not only support `dictionary` but also support `array`
Review Comment:
```suggestion
Action support not only `dictionary` but also `array` as a return value.
```
##########
docs/actions-dotnet.md:
##########
@@ -79,6 +79,47 @@ cd out
zip -r -0 helloDotNet.zip *
```
+For the return result, not only support `dictionary` but also support `array`
Review Comment:
```suggestion
Action support not only a JSON object but also a JSON array as a return
value.
```
##########
docs/actions-dotnet.md:
##########
@@ -79,6 +79,47 @@ cd out
zip -r -0 helloDotNet.zip *
```
+For the return result, not only support `dictionary` but also support `array`
+
+So a very simple `hello array` function would be:
+
+```csharp
+using System;
+using Newtonsoft.Json.Linq;
+namespace Apache.OpenWhisk.Tests.Dotnet
+{
+ public class HelloArray
+ {
+ public JArray Main(JObject args)
+ {
+ JArray jarray = new JArray();
+ jarray.Add("a");
+ jarray.Add("b");
+ return (jarray);
+ }
+ }
+}
+```
+
+And support array result for sequence action as well, the first action's array
result can be used as next action's input parameter.
+
+So the function can be:
Review Comment:
```suggestion
You can also create a sequence action with actions returning an array result.
You can easily figure out the parameters with the following example.
```
##########
docs/actions-dotnet.md:
##########
@@ -79,6 +79,47 @@ cd out
zip -r -0 helloDotNet.zip *
```
+For the return result, not only support `dictionary` but also support `array`
+
+So a very simple `hello array` function would be:
Review Comment:
```suggestion
It would be a simple example that uses an array as a return value.
```
##########
docs/actions-java.md:
##########
@@ -48,6 +48,34 @@ public class Hello {
}
```
+Not only support return JsonObject but also support return JsonArray, the main
function would be:
+
+```java
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+public class HelloArray {
+ public static JsonArray main(JsonObject args) {
+ JsonArray jsonArray = new JsonArray();
+ jsonArray.add("a");
+ jsonArray.add("b");
+ return jsonArray;
+ }
+}
+```
+
+And support array result for sequence action as well, the first action's array
result can be used as next action's input parameter.
+
+So the function would be:
Review Comment:
```suggestion
You can also create a sequence action with actions returning an array result.
You can easily figure out the parameters with the following example.
```
##########
docs/actions-ruby.md:
##########
@@ -39,6 +39,27 @@ def main(args)
end
```
+For the return result, not only support `dictionary` but also support `array`
+
+So a very simple `hello array` function would be:
+
+```ruby
+def main(args)
+ nums = Array["a","b"]
+ nums
+end
+```
+
+And support array result for sequence action as well, the first action's array
result can be used as next action's input parameter.
+
+So the function can be
Review Comment:
```suggestion
You can also create a sequence action with actions returning an array result.
You can easily figure out the parameters with the following example.
```
##########
docs/actions-docker.md:
##########
@@ -236,6 +236,18 @@ DATE=`date`
echo "{ \"message\": \"Hello $NAME! It is $DATE.\" }"
```
+For the return result, not only support `dictionary` but also support `array`
+```
+#!/bin/bash
+echo '["a", "b"]''
+```
+
+And support array result for sequence action as well, the first action's array
result can be used as next action's input parameter
Review Comment:
```suggestion
You can also create a sequence action with actions returning an array result.
You can easily figure out the parameters with the following example.
```
##########
docs/actions-nodejs.md:
##########
@@ -31,6 +31,32 @@ and demonstrate how to bundle multiple JavaScript files and
third party dependen
}
```
+ For the return result, not only support `dictionary` but also support `array`
+
+ So a very simple `hello array` function would be:
Review Comment:
```suggestion
Action support not only a JSON object but also a JSON array as a return
value.
```
##########
docs/actions-go.md:
##########
@@ -58,6 +58,31 @@ func Main(obj map[string]interface{}) map[string]interface{}
{
}
```
+For the return result, not only support `map[string]interface{}` but also
support `[]interface{}`
+
+So a very simple `hello array` function would be:
+
+```go
+package main
+// Main is the function implementing the action
+func Main(event map[string]interface{}) []interface{} {
+ result := []interface{}{"a", "b"}
+ return result
+}
+```
+
+And support array result for sequence action as well, the first action's array
result can be used as next action's input parameter.
+
+So the function can be:
Review Comment:
You can also create a sequence action with actions returning an array result.
You can easily figure out the parameters with the following example.
```
##########
docs/actions-python.md:
##########
@@ -33,7 +33,23 @@ def main(args):
print(greeting)
return {"greeting": greeting}
```
+For the return result, not only support `dictionary` but also support `array`
+So a very simple `hello array` function would be:
+
+```python
+def main(args):
+ return ["a", "b"]
+```
+
+And support array result for sequence action as well, the first action's array
result can be used as next action's input parameter.
+
+So the function can be:
Review Comment:
```suggestion
You can also create a sequence action with actions returning an array result.
You can easily figure out the parameters with the following example.
```
##########
docs/actions-go.md:
##########
@@ -58,6 +58,31 @@ func Main(obj map[string]interface{}) map[string]interface{}
{
}
```
+For the return result, not only support `map[string]interface{}` but also
support `[]interface{}`
+
+So a very simple `hello array` function would be:
Review Comment:
```suggestion
Action support not only a JSON object but also a JSON array as a return
value and the corresponding return types are `map[string]interface{}` and
`[]interface{}` respectively.
This is a simple example.
```
##########
docs/actions-rust.md:
##########
@@ -58,6 +58,38 @@ pub fn main(args: Value) -> Result<Value, Error> {
Rust actions are mainly composed by a `main` function that accepts a JSON
`serdes Value` as input and returns a `Result` including a JSON `serde Value`.
+For the return result, not only support `A JSON serde Value` but also support
`Array serde Value`
+
+So a simple `hello array` funtion would be:
Review Comment:
```suggestion
Action support not only a JSON object but also a JSON array as a return
value.
```
##########
docs/actions-swift.md:
##########
@@ -45,6 +46,27 @@ func main(args: [String:Any]) -> [String:Any] {
```
In this example the Swift action consumes a dictionary and produces a
dictionary.
+For the return result, not only support `dictionary`, but also support `array`
+
+So a very simple `hello array` function woule be:
Review Comment:
```suggestion
Action support not only a JSON object but also a JSON array as a return
value.
```
##########
docs/actions-ruby.md:
##########
@@ -39,6 +39,27 @@ def main(args)
end
```
+For the return result, not only support `dictionary` but also support `array`
+
+So a very simple `hello array` function would be:
Review Comment:
```suggestion
Action support not only a JSON object but also a JSON array as a return
value.
```
##########
docs/actions-nodejs.md:
##########
@@ -31,6 +31,32 @@ and demonstrate how to bundle multiple JavaScript files and
third party dependen
}
```
+ For the return result, not only support `dictionary` but also support `array`
+
+ So a very simple `hello array` function would be:
+
+ ```javascript
+ function main(params) {
+ return ["a", "b"];
+ }
+ ```
+
+ And support array result for sequence action as well, the first action's
array result can be used as next action's input parameter.
+
+ So the function can be:
Review Comment:
```suggestion
You can also create a sequence action with actions returning an array result.
The following is a good example to sort parameters in an array.
```
##########
docs/actions-php.md:
##########
@@ -47,6 +47,32 @@ function main(array $args) : array
}
```
+For the return result, not only support `dictionary` but also support `array`
+
+So a very simple `hello array` function would be:
Review Comment:
```suggestion
Action support not only a JSON object but also a JSON array as a return
value.
```
##########
docs/actions-php.md:
##########
@@ -47,6 +47,32 @@ function main(array $args) : array
}
```
+For the return result, not only support `dictionary` but also support `array`
+
+So a very simple `hello array` function would be:
+
+```php
+<?php
+function main(array $args) : array
+{
+ $arr=array("a","b","c");
+ return $arr;
+}
+```
+
+And support array result for sequence action as well, the first action's array
result can be used as next action's input parameter.
+
+So the function can be:
Review Comment:
```suggestion
You can also create a sequence action with actions returning an array result.
The following is a good example to reverse parameters in an array.
```
##########
docs/actions-rust.md:
##########
@@ -58,6 +58,38 @@ pub fn main(args: Value) -> Result<Value, Error> {
Rust actions are mainly composed by a `main` function that accepts a JSON
`serdes Value` as input and returns a `Result` including a JSON `serde Value`.
+For the return result, not only support `A JSON serde Value` but also support
`Array serde Value`
+
+So a simple `hello array` funtion would be:
+
+```rust
+extern crate serde_json;
+use serde_derive::{Deserialize, Serialize};
+use serde_json::{Error, Value};
+pub fn main(args: Value) -> Result<Value, Error> {
+ let output = ["a", "b"];
+ serde_json::to_value(output)
+}
+```
+
+And support array result for sequence action as well, the first action's array
result can be used as next action's input parameter.
+
+So the function can be:
Review Comment:
```suggestion
You can also create a sequence action with actions returning an array result.
You can easily figure out the parameters with the following example.
```
##########
docs/actions-swift.md:
##########
@@ -45,6 +46,27 @@ func main(args: [String:Any]) -> [String:Any] {
```
In this example the Swift action consumes a dictionary and produces a
dictionary.
+For the return result, not only support `dictionary`, but also support `array`
+
+So a very simple `hello array` function woule be:
+
+```swift
+func main(args: Any) -> Any {
+ var arr = ["a", "b"]
+ return arr
+}
+```
+
+And support array result for sequence action as well, the first action's array
result can be used as next action's input parameter.
+
+So the function can be:
Review Comment:
```suggestion
You can also create a sequence action with actions returning an array result.
You can easily figure out the parameters with the following example.
```
##########
docs/actions-python.md:
##########
@@ -33,7 +33,23 @@ def main(args):
print(greeting)
return {"greeting": greeting}
```
+For the return result, not only support `dictionary` but also support `array`
+So a very simple `hello array` function would be:
Review Comment:
```suggestion
Action support not only a JSON object but also a JSON array as a return
value.
```
##########
docs/actions-java.md:
##########
@@ -48,6 +48,34 @@ public class Hello {
}
```
+Not only support return JsonObject but also support return JsonArray, the main
function would be:
Review Comment:
```suggestion
Action support not only a JSON object but also a JSON array as a return
value.
```
--
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]