openwhisk-wskdeploy icon indicating copy to clipboard operation
openwhisk-wskdeploy copied to clipboard

Array value type of bound parameter not supported

Open asteed opened this issue 7 years ago • 2 comments

Currently, when binding a parameter to an action via wsk action create supports an array of strings

> wsk action update myAction action.js -p param1 '["value1","value2"]'

...results in the following invocation...

> wsk action invoke myAction --blocking
ok: invoked /guest/myAction with id 6a9fda9843b6403d9fda9843b6703d40
{
    "activationId": "6a9fda9843b6403d9fda9843b6703d40",
    "name": "myAction",
    "response": {
        "result": {
            "param1": [
                "value1",
                "value2"
            ]
        },
        ...
    },
    ...
}

However, there is not a way currently to bind a parameter to an action with an array as a value using wskdeploy. In attempting both accepted formats within the manifest.yml for declaring an array of strings, neither are accepted.

inputs:
  param1:
    - "value1"
    - "value2"

and

inputs:
  param1: ["value1","value2"]

The error reported by wskdeploy:

panic: interface conversion: interface {} is []interface {}, not string

Ideally this type would be supported as this bound parameter format (array of strings) is currently used by alarmsWeb/alarmWebAction alarmWebAction.js / installCatalog.sh#L108

asteed avatar Oct 25 '18 21:10 asteed

you get a silver ⭐️ Issue #999

csantanapr avatar Oct 25 '18 21:10 csantanapr

@asteed It looks like the following format

inputs:
  param1:
    - "value1"
    - "value2"

works.

I have added support for actions to support:

inputs:
  param1: ["value1","value2"]

Could u review the PR?

houshengbo avatar Nov 16 '18 20:11 houshengbo