Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add document for support array result #5311

Merged

Conversation

ningyougang
Copy link
Contributor

@ningyougang ningyougang commented Aug 17, 2022

Description

  • Add document for support array result, corresponding same document has been added to openwhisk-runtime-$image repos
  • Fix test case for swift

Related issue and scope

  • I opened an issue to propose and discuss this change (#????)

My changes affect the following components

  • API
  • Controller
  • Message Bus (e.g., Kafka)
  • Loadbalancer
  • Scheduler
  • Invoker
  • Intrinsic actions (e.g., sequences, conductors)
  • Data stores (e.g., CouchDB)
  • Tests
  • Deployment
  • CLI
  • General tooling
  • Documentation

Types of changes

  • Bug fix (generally a non-breaking change which closes an issue).
  • Enhancement or new feature (adds new functionality).
  • Breaking change (a bug fix or enhancement which changes existing behavior).

Checklist:

  • I signed an Apache CLA.
  • I reviewed the style guides and followed the recommendations (Travis CI will check :).
  • I added tests to cover my changes.
  • My changes require further changes to the documentation.
  • I updated the documentation where necessary.

if let str = args["delimiter"] as? String {
func main(args: Any) -> Any {
let dict = args as! [String:Any]
if let str = dict["delimiter"] as? String {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found relative test cases failed in our downstream, so need to fix it in upstream firstly.

@codecov-commenter
Copy link

codecov-commenter commented Aug 17, 2022

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.09%. Comparing base (9005a08) to head (4b7d7ea).
Report is 98 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (9005a08) and HEAD (4b7d7ea). Click for more details.

HEAD has 15 uploads less than BASE
Flag BASE (9005a08) HEAD (4b7d7ea)
20 5
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5311      +/-   ##
==========================================
- Coverage   81.12%   76.09%   -5.03%     
==========================================
  Files         239      239              
  Lines       14192    14192              
  Branches      580      580              
==========================================
- Hits        11513    10800     -713     
- Misses       2679     3392     +713     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

And support array result for sequence action as well, the first action's array result can be used as next action's input parameter
```
#!/bin/bash
echo $1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is sequence action's second action. can accept the array as input parameter, and we can do some sort operation here,
But here, i just return it directly(don't add sort operation), just a example.

Copy link
Contributor Author

@ningyougang ningyougang Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But there seems to be a bad point here, due to shell, it implies that any type of parameter can be received, but my example's exact meaning is, it here just can accept array type.

for some strong type language, e.g. java, we can know the input/out data type from main signature
image

@@ -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`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For the return result, not only support `dictionary` but also support `array`
Action support not only `dictionary` but also `array` as a return value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated accordingly

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
And support array result for sequence action as well, the first action's array result can be used as next action's input parameter
You can also create a sequence action with actions returning an array result.
You can easily figure out the parameters with the following example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated accordingly

@@ -79,6 +79,47 @@ cd out
zip -r -0 helloDotNet.zip *
```

For the return result, not only support `dictionary` but also support `array`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For the return result, not only support `dictionary` but also support `array`
Action support not only a JSON object but also a JSON array as a return value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated accordingly

@@ -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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
So a very simple `hello array` function would be:
It would be a simple example that uses an array as a return value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated accordingly

Comment on lines 104 to 106
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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:
You can also create a sequence action with actions returning an array result.
You can easily figure out the parameters with the following example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated accordingly

Comment on lines 50 to 52
For the return result, not only support `dictionary` but also support `array`

So a very simple `hello array` function would be:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For the return result, not only support `dictionary` but also support `array`
So a very simple `hello array` function would be:
Action support not only a JSON object but also a JSON array as a return value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated accordingly

Comment on lines 36 to 38
For the return result, not only support `dictionary` but also support `array`

So a very simple `hello array` function would be:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For the return result, not only support `dictionary` but also support `array`
So a very simple `hello array` function would be:
Action support not only a JSON object but also a JSON array as a return value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated accordingly

Comment on lines 42 to 44
For the return result, not only support `dictionary` but also support `array`

So a very simple `hello array` function would be:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For the return result, not only support `dictionary` but also support `array`
So a very simple `hello array` function would be:
Action support not only a JSON object but also a JSON array as a return value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated accordingly

Comment on lines 61 to 63
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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:
Action support not only a JSON object but also a JSON array as a return value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated accordingly

Comment on lines 49 to 51
For the return result, not only support `dictionary`, but also support `array`

So a very simple `hello array` function woule be:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For the return result, not only support `dictionary`, but also support `array`
So a very simple `hello array` function woule be:
Action support not only a JSON object but also a JSON array as a return value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated accordingly

@ningyougang ningyougang force-pushed the add-document-for-support-array-result branch from a7eda48 to 4b7d7ea Compare August 18, 2022 03:47
@ningyougang ningyougang merged commit 7de8bad into apache:master Aug 18, 2022
msciabarra pushed a commit to nuvolaris/openwhisk that referenced this pull request Nov 23, 2022
* Fix test case failed for swift

* Add document based on support array result feature

* Apply review comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants