Action meta parameters' default values have type conversion issues when running workflow
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 6.5k
- Forks
- 787
- PR merge metrics
- No merged PRs in 30d
Description
SUMMARY
If I save an action with parameters using PUT /api/v1/actions/{ref_or_id} via st2flow, and my parameters object contains a parameter with a number or integer type, passing the default value for said parameter as a string will prevent the workflow from executing.
Example response:
ERROR: 400 Client Error: Bad Request
MESSAGE: '3' is not of type 'number' for url: http://127.0.0.1:9101/v1/executions
It is required for strings to be allowed as values for parameters regardless of parameter type, because of the possibility of Jinja templates or similar (Interestingly, a jinja template that returns a string is handled without problem). For the case of static values, coercion of the value into the intended type should be handled by the execution engine.
This is a continuation of https://github.com/StackStorm/st2flow/issues/273
ISSUE TYPE
- Bug Report
STACKSTORM VERSION
st2 3.0dev (1c301c4), on Python 2.7.12
OS / ENVIRONMENT / INSTALL METHOD
- Vagrant via st2vagrant with
releaseparameter modified tounstable
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the case by saving an action with a number or integer parameter and a string default through PUT /api/v1/actions/{ref_or_id} via st2flow. Then execute the workflow through /v1/executions and trace how static defaults are validated and converted. Done means string values remain valid for templating, static values are coerced to the declared type, and the workflow executes successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100