for dynamic parameters (multi-type) or action-chain publishing allow explicit casting of jinja variables
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 6.5k
- Forks
- 787
- PR merge metrics
- No merged PRs in 30d
Description
If I have an workflow parameter like:
example:
required: true
type: [integer, string]
description: "An example parameter"
I don't think st2 can know what to cast the parameter as if I use it in a jinja template.
"{{ example }}" will always be a string, even if I do something like "{{ example | int }}"
In cases where it is not clear what data type something should be, like the above contrived example, If I explicitly run it through a jinja filter that specifies a type, please cast it as that type.
Some parameters can't specify a type because they can have various inputs, but within the context of, say, a particular ansible playbook, I know what type to expect, even if I can't tell ST2 in a schema that this var will be this type. Please allow type casting of jinja templates through either a jinja filter or some kind of new directive.
Finding a way to use the jinja filters will feel cleaner, but I implemented special parsing using directive-like magic strings for INT, AST, and JSON type objects in StackStorm-Exchange/stackstorm-ansible#14. Something more generic would be nice.
edit: see the next comment for publishing variables in action-chain workflows
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
No repository files or tests are named. Start by tracing Jinja template rendering for workflow parameters and action-chain publishing, and review the referenced StackStorm-Exchange implementation for INT, AST, and JSON handling. Done means an explicit, generic way to preserve requested types for multi-type parameters and action-chain variables, with coverage for the stated examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100