-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add Custom Validation for User-Configured Templates #21155
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
base: dev
Are you sure you want to change the base?
Add Custom Validation for User-Configured Templates #21155
Conversation
|
These don't use the pre-existing tool_util validators but the schema for declaring them looks compatible. It is intention that the schema is the same I assume? I wish that code had been reusable but if the schema is the same and there is test coverage I think this is fine to not reuse that stuff. |
|
Good point! I was not aware of the pre-existing tool_util validators, but I guess Claude tried to keep consistency with them when suggesting the schema. |
|
The existing tool_util validators are now reused. Thanks again for catching that! |
3ee6558 to
413c579
Compare
|
It might be the case that galaxy-util is Python 3.7 compatible and galaxy-tool-util-models isn't - or you maybe need to have galaxy-util depend on galaxy-tool-util-models. Not sure but I could imagine both being a problem. |
|
Oops! I completely missed those test failures because I thought they were part of the known package test failures and didn't even check them 😅 Thanks for noticing! I will take a look 👍 |
Introduces a flexible validator system for template variables, enabling regex, length, and range checks with customizable messages.
Introduces a mechanism for attaching and evaluating custom validators (such as regex patterns) to template variables in form handling logic. Enhances client-side validation to catch invalid input earlier and provide immediate feedback, improving user experience and reducing unnecessary server requests.
Introduces regex-based validators to prevent leading/trailing whitespace and trailing slashes in bucket names, reducing misconfiguration risks and improving user input reliability.
Moves Sequence import to typing to avoid "'ABCMeta' object is not subscriptable" issues. Co-authored-by: Nicola Soranzo <nicola.soranzo@earlham.ac.uk>
413c579 to
0f8aa5f
Compare
|
Looks like @nsoranzo suggestion worked! Only unrelated test failures now :) |
Closes #20904
This PR adds custom validation to template variables in file source and object store templates, enforcing input constraints with clear error messages.
Features
Three validator types:
regex: Pattern matching with optional negationlength: String length bounds (min/max)range: Numeric value bounds (min/max)Key characteristics:
Example Usage (included in
lib/galaxy/files/templates/examples/production_s3fs.yml)This prevents common configuration mistakes and improves the user experience when setting up custom storage connections.
How to test the changes?
License