This example builds on the previous “Hello world" with typed input and output parameters example with more robust input and output parameter declarations by using a multi-line format for declaration.
This example:
hello_world
’ using a multi-line grammar.If we want to do more than declare the type (i.e., ‘string’, ‘integer’, ‘float’, etc.) of the input parameter, we can use the multi-line grammar.
packages: hello_world_package: ... # Package keys omitted for brevity actions: hello_world_advanced_parms: function: src/hello_plus.js runtime: nodejs@10 inputs: name: type: string description: name of person default: unknown person place: type: string description: location of person value: the Shire children: type: integer description: Number of children default: 0 height: type: float description: height in meters default: 0.0 outputs: greeting: type: string description: greeting string details: type: string description: detailed information about the person
$ wskdeploy -m docs/examples/manifest_hello_world_advanced_parms.yaml
$ wsk action invoke hello_world_package/hello_world_advanced_parms --blocking
The invocation should return an ‘ok’ with a response that includes this result:
"result": { "details": "You have 0 children and are 0 m. tall.", "greeting": "Hello, unknown person from the Shire" },
name
’ input parameter was assigned the ‘default
’ key's value “unknown person
”.place
’ input parameter was assigned the ‘value
’ key's value “the Shire
”.The manifest file for this example can be found here:
For convenience, the Actions and Parameters grammar can be found here: