Support templates in action target #25656
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed change
Support templates in visual editor for action target field. We currently support it for all subfields of
data
, but not for target until now.There is sometimes a bit of jankiness where messing with the selector will kick the user out of visual editor and back to yaml mode due to superstruct validation, but I didn't come up with a great solution that doesn't undesirably weaken the validation for other cases not involving templates.
E.g. in the example screenshot, if you add the key
area_id:
to the object selector you'll be temporarily kicked out of visual editor because the struct validator asserts that area_id cannot be null. We could add to the validator that area_id is allowed to be null, but I don't know if we want that. Or if you're editing the target template, and you remove the template identifier "{{", you'll be kicked out of visual mode because the superstruct asserts that if target is a string it must be a template.I think that's not too bad of a tradeoff to support this though, it would be a fairly rare occurence to be making edits like that.
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: