Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dynamic choices #1746

Open
jaecktec opened this issue Aug 23, 2024 · 3 comments
Open

Support dynamic choices #1746

jaecktec opened this issue Aug 23, 2024 · 3 comments

Comments

@jaecktec
Copy link

Actual Situation

I'd like to ask for some choices (my case aws-regions) and in the second step I want that the user selects the primary region from the previously specified region.

Sadly the choices field is not evaluated as expression

Desired Situation

What happens right now:
the String is destructed as an array and I can chose a letter from my expression

What should happen:
The user should have a way how to dynamicly specify the choices

Proposed solution

I'd like that this works:

list_input:
  type: str
  help: "Enter a comma-separated list of items."
  default: "item1,item2,item3"

selected_choice:
  type: str
  help: "Select one of the items from your list."
  choices: "{{ list_input.split(',') | map('trim') | list }}"
@sisp
Copy link
Member

sisp commented Aug 23, 2024

The request for dynamic choices has come up a few times. We have a design proposal that looks promising. Would you happen to be interested in attempting an implementation?

@jaecktec
Copy link
Author

the design proposal is coincidentially the same as my proposal :D

I most likely won't find the time the next months, however if nobody has attempted a PR I'll look into it

@sisp
Copy link
Member

sisp commented Aug 23, 2024

the design proposal is coincidentially the same as my proposal :D

Ah, yes, of course, I had a Jinja for-loop with explicit YAML list syntax in mind, but you're right. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants