Open fmigneault opened 1 year ago
Since a CWL enum is basically a (possibly named) type: string
with a restricted set of valid values, one could (eventually) implement the numerical version of a CWL enum as a type: int
and then use the restrictions syntax that is still being developed to list the acceptable numbers: https://github.com/common-workflow-language/common-workflow-language/issues/764
So for now, I would recommend making non-string based enumerations the appropriate atomic CWL numerical type
and listing the valid values in a label
or doc
note.
If you really need to check this at tool instantiation time (but prior to running the tool) you can generate a inputBinding: { valueFrom: ... }
section that uses JavaScript to confirm the validity, returning self
in a positive outcome or raising an exception in the failure case.
Would it be possible to use the SchemaDefRequirement
to define some IntEnum
? Would validation be performed if such a type was defined and used, or would I still need to define the valueFrom
check for each tool that needs IntEnum
?
Would it be possible to use the
SchemaDefRequirement
to define someIntEnum
?
Not in CWL v1.0-v1.2, no.
The https://www.commonwl.org/v1.2/CommandLineTool.html#CommandInputEnumSchema only allows
string
symbols.However, it is very common to have
integer
anddouble
/float
as well.Should
CommandInputEnumSchema
allow these numeric types as well? Otherwise, how could I add this functionality? I am trying to convert OpenAPI-style process definitions into CWL processes, and I cannot convert an input using anenum[int]
type.Note that the current JSON schema actually allows (incorrectly?) numbers, given that I did not even realize numbers were not supported while writing it. https://github.com/common-workflow-language/cwl-v1.2/blob/1.2.1_proposed/json-schema/cwl.yaml#L1354-L1364