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

Create config options from choices #2090

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

diivi
Copy link
Contributor

@diivi diivi commented Mar 25, 2024

Fixes #1414 by adding a way to validate config options from choices.

Need to figure out where else this might be needed (or not) and also edit tests.

Copy link

codecov bot commented Mar 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.69%. Comparing base (06257f2) to head (1415587).
Report is 9 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #2090   +/-   ##
=======================================
  Coverage   59.68%   59.69%           
=======================================
  Files         191      191           
  Lines       24418    24435   +17     
  Branches     2419     2423    +4     
=======================================
+ Hits        14574    14586   +12     
- Misses       9061     9064    +3     
- Partials      783      785    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

# validate param value before trigger
if not config.validate_choices(self.param.name, self.param.value):
self.param.revert_default()
return f"Invalid value '{self.param.value}' for parameter '{self.param.name}'. Valid choices are: {', '.join(self.param.choices)}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this if need to be in the trigger loop? The condition do not use trigger at all and here we will be re-validating things on each trigger. Is that needed?

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

Successfully merging this pull request may close these issues.

Add a way to create config options from a fixed set of choices
2 participants