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
Labels
enhancement An enhancement to the WDL language. spec change A suggested change to the WDL specification.

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"
@patmagee patmagee added enhancement An enhancement to the WDL language. spec change A suggested change to the WDL specification. labels Jun 6, 2024
@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
claymcleod added a commit to claymcleod/wdl that referenced this issue Jan 16, 2025
This commit adds enumerations to WDL. Enumerations in WDL are valued,
meaning that they have an assigned valued for each variant therein.
These values can either be explicitly or implicitly typed. Ultimately,
enumerations are aimed at improved UX regarding a limited set of valid
values within a particular context.

Relevant issues: openwdl#139, openwdl#658

Co-authored-by: jdidion <[email protected]>
claymcleod added a commit to claymcleod/wdl that referenced this issue Jan 16, 2025
This commit adds enumerations to WDL. Enumerations in WDL are valued,
meaning that they have an assigned valued for each variant therein.
These values can either be explicitly or implicitly typed. Ultimately,
enumerations are aimed at improved UX regarding a limited set of valid
values within a particular context.

Relevant issues: openwdl#139, openwdl#658

Closes openwdl#139.

Co-authored-by: jdidion <[email protected]>
claymcleod added a commit to claymcleod/wdl that referenced this issue Jan 16, 2025
This commit adds enumerations to WDL. Enumerations in WDL are valued,
meaning that they have an assigned valued for each variant therein.
These values can either be explicitly or implicitly typed. Ultimately,
enumerations are aimed at improved UX regarding a limited set of valid
values within a particular context.

Relevant issues: openwdl#139, openwdl#658

Closes openwdl#139.

Co-authored-by: jdidion <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement to the WDL language. spec change A suggested change to the WDL specification.
Projects
None yet
Development

No branches or pull requests

2 participants