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

Introduce enum syntax #658

Closed
patmagee opened this issue Jun 6, 2024 · 3 comments
Closed

Introduce enum syntax #658

patmagee opened this issue Jun 6, 2024 · 3 comments

Comments

@patmagee
Copy link
Member

patmagee commented Jun 6, 2024

A long standing request from users has been the ability to define enum constants where a user can restrict the values an input can contain and easily refer to those values in a named way. While restricting the values is accomplishable with validation (see #657), being able to easily refer to those constants is another matter.

At the risk of making WDL a little bit more like a programming language, I propose we add a new construct called enum

enum Foo {
  FOO
  BAR
  BIZ
}


workflow my_workflow {
  input {
    Foo val
  }

  if (Foo.BAR == val) {
    call bar
  }

}

Semantics:

  • Input values are provided as JSON strings, where the String value is expected to equal the value of the enum
  • The strings are case sensitive ("Foo" != FOO)
  • A String can be converted to an enum Foo foo = "FOO"
@jdidion
Copy link
Collaborator

jdidion commented Jun 6, 2024

Duplicate of #139?

@patmagee
Copy link
Member Author

patmagee commented Jun 6, 2024

Huh, yup. This is what happens when you do not look at the history @jdidion

@patmagee
Copy link
Member Author

patmagee commented Jun 6, 2024

closing in favour of #139

@patmagee patmagee closed this as completed Jun 6, 2024
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