Primitive Types
Boolean, Int, Float, String, File, and Directory types
The following primitive types exist in WDL:
- A
Booleanrepresents a value oftrueorfalse. - An
Intrepresents a signed 64-bit integer (in the range[-2^63, 2^63)). - A
Floatrepresents a finite 64-bit IEEE-754 floating point number. - A
Stringrepresents a unicode character string following the format described below. - A
Filerepresents a file (or file-like object). - A
Directoryrepresents a (possibly nested) directory of files.
Example: primitive_literals.wdl
version 1.3
task write_file_task {
command <<<
mkdir -p testdir
printf "hello" > testdir/hello.txt
>>>
output {
File x = "testdir/hello.txt"
Directory d = "testdir"
}
}
workflow primitive_literals {
call write_file_task
output {
Boolean b = true
Int i = 0
Float f = 27.3
String s = "hello, world"
File x = write_file_task.x
Directory d = write_file_task.d
}
}Example input:
{}
Example output:
{
"primitive_literals.b": true,
"primitive_literals.i": 0,
"primitive_literals.f": 27.3,
"primitive_literals.s": "hello, world",
"primitive_literals.x": "hello.txt",
"primitive_literals.d": "testdir"
}All primitive WDL types serialize naturally to JSON values:
| WDL Type | JSON Type |
|---|---|
Int | number |
Float | number |
Boolean | boolean |
String | string |
File | string |
Directory | string |
None | null |
JSON has a single numeric type - it does not differentiate between integral and floating point values. A JSON number is always deserialized to a WDL Float, which may then be coerced to an Int if necessary.
JSON does not have a specific type for filesystem paths, but a WDL String may be coerced to a File if necessary.