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 Input Validation for Workflow and Tasks #657

Open
patmagee opened this issue Jun 6, 2024 · 0 comments
Open

Support Input Validation for Workflow and Tasks #657

patmagee opened this issue Jun 6, 2024 · 0 comments

Comments

@patmagee
Copy link
Member

patmagee commented Jun 6, 2024

A common problem that consumers of WDL face is the need to perform input validation at both the tasks and the workflow level. The current status quo requires spinning up a task to perform any validation which can be both costly and time consuming. A fail fast mechanism would allow immediate feedback to the end user.

To accomplish this, I propose a new Syntax or function for performing validation within the input block of a task / workflow. This approach has the benefit of clearly showing that validation is part of the input blocks, however it does mean that it cannot happen anywhere else. An additional benefit is the fact the all validations can be evaluated and returned to the user instead of failing at the first one.

workflow foo {
  input {
    String name
    Int age

    # New Validation Section
    validation {
      length(name) > 0: "Name must not be empty"
      age > = 0: "Age must be greater then 0"
      age < 110: "Really? Is someone actually that old?"
    }
  }
}

The above mechanism relies on new syntax to provide a clear and concise way to validate inputs. However we may want to make this more flexible with an engine function

workflow foo {
  input {
    String name
    Int age
  }

  validate(length(name) > 0, "Name must not be empty")
  validate(age > 0, "Age must be greater then 0")
  validate(age < 110, "Really? Is someone actually that old")
}

Validation Errors

When a workflow fails for a validation error, we would want to make a guarantee that the failure message is returned according to some standardized format. Since there is no format currently (see #611), a statement that the engine must return the relevant validation errors and their messages would be as much as we could provide

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

1 participant