1 /** 2 * Generated by schema-salad code generator 3 * 4 * Date: 2022-11-10 5 */ 6 module cwl_d_auto.v1_0; 7 8 import salad.meta.dumper : genDumper; 9 import salad.meta.impl : genCtor, genIdentifier, genOpEq; 10 import salad.meta.parser : import_ = importFromURI; 11 import salad.meta.uda : documentRoot, id, idMap, link, secondaryFilesDSL, typeDSL; 12 import salad.primitives : SchemaBase; 13 import salad.type : None, Either; 14 15 /// parser information 16 enum parserInfo = "CWL v1.0 parser generated with schema-salad-tool"; 17 18 /** 19 * Salad data types are based on Avro schema declarations. Refer to the 20 * [Avro schema declaration documentation](https://avro.apache.org/docs/current/spec.html#schemas) for 21 * detailed information. 22 * null: no value 23 * boolean: a binary value 24 * int: 32-bit signed integer 25 * long: 64-bit signed integer 26 * float: single precision (32-bit) IEEE 754 floating-point number 27 * double: double precision (64-bit) IEEE 754 floating-point number 28 * string: Unicode character sequence 29 */ 30 class PrimitiveType : SchemaBase 31 { 32 enum Symbol 33 { 34 s0 = "null", 35 s1 = "boolean", 36 s2 = "int", 37 s3 = "long", 38 s4 = "float", 39 s5 = "double", 40 s6 = "string" 41 } 42 43 Symbol value; 44 45 mixin genCtor; 46 mixin genOpEq; 47 mixin genDumper; 48 } 49 50 /// 51 public import salad.primitives : Any; 52 53 /** 54 * A field of a record. 55 */ 56 class RecordField : SchemaBase 57 { 58 /** 59 * The name of the field 60 */ 61 @id string name_; 62 /** 63 * A documentation string for this field 64 */ 65 Either!(None, string) doc_; 66 /** 67 * The field type 68 */ 69 @typeDSL Either!(PrimitiveType, RecordSchema, EnumSchema, ArraySchema, string, Either!(PrimitiveType, RecordSchema, EnumSchema, ArraySchema, string)[]) type_; 70 71 mixin genCtor; 72 mixin genIdentifier; 73 mixin genDumper; 74 } 75 76 /// 77 class RecordSchema : SchemaBase 78 { 79 /** 80 * Defines the fields of the record. 81 */ 82 @idMap("name", "type") Either!(None, RecordField[]) fields_; 83 /** 84 * Must be `record` 85 */ 86 static immutable type_ = "record"; 87 88 mixin genCtor; 89 mixin genIdentifier; 90 mixin genDumper; 91 } 92 93 /** 94 * Define an enumerated type. 95 */ 96 class EnumSchema : SchemaBase 97 { 98 /** 99 * Defines the set of valid symbols. 100 */ 101 @link string[] symbols_; 102 /** 103 * Must be `enum` 104 */ 105 static immutable type_ = "enum"; 106 107 mixin genCtor; 108 mixin genIdentifier; 109 mixin genDumper; 110 } 111 112 /// 113 class ArraySchema : SchemaBase 114 { 115 /** 116 * Defines the type of the array elements. 117 */ 118 Either!(PrimitiveType, RecordSchema, EnumSchema, ArraySchema, string, Either!(PrimitiveType, RecordSchema, EnumSchema, ArraySchema, string)[]) items_; 119 /** 120 * Must be `array` 121 */ 122 static immutable type_ = "array"; 123 124 mixin genCtor; 125 mixin genIdentifier; 126 mixin genDumper; 127 } 128 129 /** 130 * Version symbols for published CWL document versions. 131 */ 132 class CWLVersion : SchemaBase 133 { 134 enum Symbol 135 { 136 s0 = "draft-2", 137 s1 = "draft-3.dev1", 138 s2 = "draft-3.dev2", 139 s3 = "draft-3.dev3", 140 s4 = "draft-3.dev4", 141 s5 = "draft-3.dev5", 142 s6 = "draft-3", 143 s7 = "draft-4.dev1", 144 s8 = "draft-4.dev2", 145 s9 = "draft-4.dev3", 146 s10 = "v1.0.dev4", 147 s11 = "v1.0" 148 } 149 150 Symbol value; 151 152 mixin genCtor; 153 mixin genOpEq; 154 mixin genDumper; 155 } 156 157 /** 158 * Extends primitive types with the concept of a file and directory as a builtin type. 159 * File: A File object 160 * Directory: A Directory object 161 */ 162 class CWLType : SchemaBase 163 { 164 enum Symbol 165 { 166 s0 = "null", 167 s1 = "boolean", 168 s2 = "int", 169 s3 = "long", 170 s4 = "float", 171 s5 = "double", 172 s6 = "string", 173 s7 = "File", 174 s8 = "Directory" 175 } 176 177 Symbol value; 178 179 mixin genCtor; 180 mixin genOpEq; 181 mixin genDumper; 182 } 183 184 /** 185 * Represents a file (or group of files when `secondaryFiles` is provided) that 186 * will be accessible by tools using standard POSIX file system call API such as 187 * open(2) and read(2). 188 * Files are represented as objects with `class` of `File`. File objects have 189 * a number of properties that provide metadata about the file. 190 * The `location` property of a File is a URI that uniquely identifies the 191 * file. Implementations must support the file:// URI scheme and may support 192 * other schemes such as http://. The value of `location` may also be a 193 * relative reference, in which case it must be resolved relative to the URI 194 * of the document it appears in. Alternately to `location`, implementations 195 * must also accept the `path` property on File, which must be a filesystem 196 * path available on the same host as the CWL runner (for inputs) or the 197 * runtime environment of a command line tool execution (for command line tool 198 * outputs). 199 * If no `location` or `path` is specified, a file object must specify 200 * `contents` with the UTF-8 text content of the file. This is a "file 201 * literal". File literals do not correspond to external resources, but are 202 * created on disk with `contents` with when needed for a executing a tool. 203 * Where appropriate, expressions can return file literals to define new files 204 * on a runtime. The maximum size of `contents` is 64 kilobytes. 205 * The `basename` property defines the filename on disk where the file is 206 * staged. This may differ from the resource name. If not provided, 207 * `basename` must be computed from the last path part of `location` and made 208 * available to expressions. 209 * The `secondaryFiles` property is a list of File or Directory objects that 210 * must be staged in the same directory as the primary file. It is an error 211 * for file names to be duplicated in `secondaryFiles`. 212 * The `size` property is the size in bytes of the File. It must be computed 213 * from the resource and made available to expressions. The `checksum` field 214 * contains a cryptographic hash of the file content for use it verifying file 215 * contents. Implementations may, at user option, enable or disable 216 * computation of the `checksum` field for performance or other reasons. 217 * However, the ability to compute output checksums is required to pass the 218 * CWL conformance test suite. 219 * When executing a CommandLineTool, the files and secondary files may be 220 * staged to an arbitrary directory, but must use the value of `basename` for 221 * the filename. The `path` property must be file path in the context of the 222 * tool execution runtime (local to the compute node, or within the executing 223 * container). All computed properties should be available to expressions. 224 * File literals also must be staged and `path` must be set. 225 * When collecting CommandLineTool outputs, `glob` matching returns file paths 226 * (with the `path` property) and the derived properties. This can all be 227 * modified by `outputEval`. Alternately, if the file `cwl.output.json` is 228 * present in the output, `outputBinding` is ignored. 229 * File objects in the output must provide either a `location` URI or a `path` 230 * property in the context of the tool execution runtime (local to the compute 231 * node, or within the executing container). 232 * When evaluating an ExpressionTool, file objects must be referenced via 233 * `location` (the expression tool does not have access to files on disk so 234 * `path` is meaningless) or as file literals. It is legal to return a file 235 * object with an existing `location` but a different `basename`. The 236 * `loadContents` field of ExpressionTool inputs behaves the same as on 237 * CommandLineTool inputs, however it is not meaningful on the outputs. 238 * An ExpressionTool may forward file references from input to output by using 239 * the same value for `location`. 240 */ 241 class File : SchemaBase 242 { 243 /** 244 * Must be `File` to indicate this object describes a file. 245 */ 246 static immutable class_ = "File"; 247 /** 248 * An IRI that identifies the file resource. This may be a relative 249 * reference, in which case it must be resolved using the base IRI of the 250 * document. The location may refer to a local or remote resource; the 251 * implementation must use the IRI to retrieve file content. If an 252 * implementation is unable to retrieve the file content stored at a 253 * remote resource (due to unsupported protocol, access denied, or other 254 * issue) it must signal an error. 255 * If the `location` field is not provided, the `contents` field must be 256 * provided. The implementation must assign a unique identifier for 257 * the `location` field. 258 * If the `path` field is provided but the `location` field is not, an 259 * implementation may assign the value of the `path` field to `location`, 260 * then follow the rules above. 261 */ 262 @link Either!(None, string) location_; 263 /** 264 * The local host path where the File is available when a CommandLineTool is 265 * executed. This field must be set by the implementation. The final 266 * path component must match the value of `basename`. This field 267 * must not be used in any other context. The command line tool being 268 * executed must be able to to access the file at `path` using the POSIX 269 * `open(2)` syscall. 270 * As a special case, if the `path` field is provided but the `location` 271 * field is not, an implementation may assign the value of the `path` 272 * field to `location`, and remove the `path` field. 273 * If the `path` contains [POSIX shell metacharacters](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02) 274 * (`|`,`&`, `;`, `<`, `>`, `(`,`)`, `$`,`` ` ``, `\`, `"`, `'`, 275 * `<space>`, `<tab>`, and `<newline>`) or characters 276 * [not allowed](http://www.iana.org/assignments/idna-tables-6.3.0/idna-tables-6.3.0.xhtml) 277 * for [Internationalized Domain Names for Applications](https://tools.ietf.org/html/rfc6452) 278 * then implementations may terminate the process with a 279 * `permanentFailure`. 280 */ 281 @link Either!(None, string) path_; 282 /** 283 * The base name of the file, that is, the name of the file without any 284 * leading directory path. The base name must not contain a slash `/`. 285 * If not provided, the implementation must set this field based on the 286 * `location` field by taking the final path component after parsing 287 * `location` as an IRI. If `basename` is provided, it is not required to 288 * match the value from `location`. 289 * When this file is made available to a CommandLineTool, it must be named 290 * with `basename`, i.e. the final component of the `path` field must match 291 * `basename`. 292 */ 293 Either!(None, string) basename_; 294 /** 295 * The name of the directory containing file, that is, the path leading up 296 * to the final slash in the path such that `dirname + '/' + basename == 297 * path`. 298 * The implementation must set this field based on the value of `path` 299 * prior to evaluating parameter references or expressions in a 300 * CommandLineTool document. This field must not be used in any other 301 * context. 302 */ 303 Either!(None, string) dirname_; 304 /** 305 * The basename root such that `nameroot + nameext == basename`, and 306 * `nameext` is empty or begins with a period and contains at most one 307 * period. For the purposess of path splitting leading periods on the 308 * basename are ignored; a basename of `.cshrc` will have a nameroot of 309 * `.cshrc`. 310 * The implementation must set this field automatically based on the value 311 * of `basename` prior to evaluating parameter references or expressions. 312 */ 313 Either!(None, string) nameroot_; 314 /** 315 * The basename extension such that `nameroot + nameext == basename`, and 316 * `nameext` is empty or begins with a period and contains at most one 317 * period. Leading periods on the basename are ignored; a basename of 318 * `.cshrc` will have an empty `nameext`. 319 * The implementation must set this field automatically based on the value 320 * of `basename` prior to evaluating parameter references or expressions. 321 */ 322 Either!(None, string) nameext_; 323 /** 324 * Optional hash code for validating file integrity. Currently must be in the form 325 * "sha1$ + hexadecimal string" using the SHA-1 algorithm. 326 */ 327 Either!(None, string) checksum_; 328 /** 329 * Optional file size 330 */ 331 Either!(None, long) size_; 332 /** 333 * A list of additional files or directories that are associated with the 334 * primary file and must be transferred alongside the primary file. 335 * Examples include indexes of the primary file, or external references 336 * which must be included when loading primary document. A file object 337 * listed in `secondaryFiles` may itself include `secondaryFiles` for 338 * which the same rules apply. 339 */ 340 Either!(None, Either!(File, Directory)[]) secondaryFiles_; 341 /** 342 * The format of the file: this must be an IRI of a concept node that 343 * represents the file format, preferrably defined within an ontology. 344 * If no ontology is available, file formats may be tested by exact match. 345 * Reasoning about format compatability must be done by checking that an 346 * input file format is the same, `owl:equivalentClass` or 347 * `rdfs:subClassOf` the format required by the input parameter. 348 * `owl:equivalentClass` is transitive with `rdfs:subClassOf`, e.g. if 349 * `<B> owl:equivalentClass <C>` and `<B> owl:subclassOf <A>` then infer 350 * `<C> owl:subclassOf <A>`. 351 * File format ontologies may be provided in the "$schemas" metadata at the 352 * root of the document. If no ontologies are specified in `$schemas`, the 353 * runtime may perform exact file format matches. 354 */ 355 @link Either!(None, string) format_; 356 /** 357 * File contents literal. Maximum of 64 KiB. 358 * If neither `location` nor `path` is provided, `contents` must be 359 * non-null. The implementation must assign a unique identifier for the 360 * `location` field. When the file is staged as input to CommandLineTool, 361 * the value of `contents` must be written to a file. 362 * If `loadContents` of `inputBinding` or `outputBinding` is true and 363 * `location` is valid, the implementation must read up to the first 64 364 * KiB of text from the file and place it in the "contents" field. 365 */ 366 Either!(None, string) contents_; 367 368 mixin genCtor; 369 mixin genIdentifier; 370 mixin genDumper; 371 } 372 373 /** 374 * Represents a directory to present to a command line tool. 375 * Directories are represented as objects with `class` of `Directory`. Directory objects have 376 * a number of properties that provide metadata about the directory. 377 * The `location` property of a Directory is a URI that uniquely identifies 378 * the directory. Implementations must support the file:// URI scheme and may 379 * support other schemes such as http://. Alternately to `location`, 380 * implementations must also accept the `path` property on Directory, which 381 * must be a filesystem path available on the same host as the CWL runner (for 382 * inputs) or the runtime environment of a command line tool execution (for 383 * command line tool outputs). 384 * A Directory object may have a `listing` field. This is a list of File and 385 * Directory objects that are contained in the Directory. For each entry in 386 * `listing`, the `basename` property defines the name of the File or 387 * Subdirectory when staged to disk. If `listing` is not provided, the 388 * implementation must have some way of fetching the Directory listing at 389 * runtime based on the `location` field. 390 * If a Directory does not have `location`, it is a Directory literal. A 391 * Directory literal must provide `listing`. Directory literals must be 392 * created on disk at runtime as needed. 393 * The resources in a Directory literal do not need to have any implied 394 * relationship in their `location`. For example, a Directory listing may 395 * contain two files located on different hosts. It is the responsibility of 396 * the runtime to ensure that those files are staged to disk appropriately. 397 * Secondary files associated with files in `listing` must also be staged to 398 * the same Directory. 399 * When executing a CommandLineTool, Directories must be recursively staged 400 * first and have local values of `path` assigend. 401 * Directory objects in CommandLineTool output must provide either a 402 * `location` URI or a `path` property in the context of the tool execution 403 * runtime (local to the compute node, or within the executing container). 404 * An ExpressionTool may forward file references from input to output by using 405 * the same value for `location`. 406 * Name conflicts (the same `basename` appearing multiple times in `listing` 407 * or in any entry in `secondaryFiles` in the listing) is a fatal error. 408 */ 409 class Directory : SchemaBase 410 { 411 /** 412 * Must be `Directory` to indicate this object describes a Directory. 413 */ 414 static immutable class_ = "Directory"; 415 /** 416 * An IRI that identifies the directory resource. This may be a relative 417 * reference, in which case it must be resolved using the base IRI of the 418 * document. The location may refer to a local or remote resource. If 419 * the `listing` field is not set, the implementation must use the 420 * location IRI to retrieve directory listing. If an implementation is 421 * unable to retrieve the directory listing stored at a remote resource (due to 422 * unsupported protocol, access denied, or other issue) it must signal an 423 * error. 424 * If the `location` field is not provided, the `listing` field must be 425 * provided. The implementation must assign a unique identifier for 426 * the `location` field. 427 * If the `path` field is provided but the `location` field is not, an 428 * implementation may assign the value of the `path` field to `location`, 429 * then follow the rules above. 430 */ 431 @link Either!(None, string) location_; 432 /** 433 * The local path where the Directory is made available prior to executing a 434 * CommandLineTool. This must be set by the implementation. This field 435 * must not be used in any other context. The command line tool being 436 * executed must be able to to access the directory at `path` using the POSIX 437 * `opendir(2)` syscall. 438 * If the `path` contains [POSIX shell metacharacters](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02) 439 * (`|`,`&`, `;`, `<`, `>`, `(`,`)`, `$`,`` ` ``, `\`, `"`, `'`, 440 * `<space>`, `<tab>`, and `<newline>`) or characters 441 * [not allowed](http://www.iana.org/assignments/idna-tables-6.3.0/idna-tables-6.3.0.xhtml) 442 * for [Internationalized Domain Names for Applications](https://tools.ietf.org/html/rfc6452) 443 * then implementations may terminate the process with a 444 * `permanentFailure`. 445 */ 446 @link Either!(None, string) path_; 447 /** 448 * The base name of the directory, that is, the name of the file without any 449 * leading directory path. The base name must not contain a slash `/`. 450 * If not provided, the implementation must set this field based on the 451 * `location` field by taking the final path component after parsing 452 * `location` as an IRI. If `basename` is provided, it is not required to 453 * match the value from `location`. 454 * When this file is made available to a CommandLineTool, it must be named 455 * with `basename`, i.e. the final component of the `path` field must match 456 * `basename`. 457 */ 458 Either!(None, string) basename_; 459 /** 460 * List of files or subdirectories contained in this directory. The name 461 * of each file or subdirectory is determined by the `basename` field of 462 * each `File` or `Directory` object. It is an error if a `File` shares a 463 * `basename` with any other entry in `listing`. If two or more 464 * `Directory` object share the same `basename`, this must be treated as 465 * equivalent to a single subdirectory with the listings recursively 466 * merged. 467 */ 468 Either!(None, Either!(File, Directory)[]) listing_; 469 470 mixin genCtor; 471 mixin genIdentifier; 472 mixin genDumper; 473 } 474 475 /// 476 public import salad.primitives : Expression; 477 478 /// 479 class InputRecordField : SchemaBase 480 { 481 /** 482 * The name of the field 483 */ 484 @id string name_; 485 /** 486 * A documentation string for this field 487 */ 488 Either!(None, string) doc_; 489 /** 490 * The field type 491 */ 492 @typeDSL Either!(CWLType, InputRecordSchema, InputEnumSchema, InputArraySchema, string, Either!(CWLType, InputRecordSchema, InputEnumSchema, InputArraySchema, string)[]) type_; 493 /// 494 Either!(None, CommandLineBinding) inputBinding_; 495 /** 496 * A short, human-readable label of this process object. 497 */ 498 Either!(None, string) label_; 499 500 mixin genCtor; 501 mixin genIdentifier; 502 mixin genDumper; 503 } 504 505 /// 506 class InputRecordSchema : SchemaBase 507 { 508 /** 509 * Defines the fields of the record. 510 */ 511 @idMap("name", "type") Either!(None, InputRecordField[]) fields_; 512 /** 513 * Must be `record` 514 */ 515 static immutable type_ = "record"; 516 /** 517 * A short, human-readable label of this object. 518 */ 519 Either!(None, string) label_; 520 /// 521 @id Either!(None, string) name_; 522 523 mixin genCtor; 524 mixin genIdentifier; 525 mixin genDumper; 526 } 527 528 /// 529 class InputEnumSchema : SchemaBase 530 { 531 /** 532 * Defines the set of valid symbols. 533 */ 534 @link string[] symbols_; 535 /** 536 * Must be `enum` 537 */ 538 static immutable type_ = "enum"; 539 /** 540 * A short, human-readable label of this object. 541 */ 542 Either!(None, string) label_; 543 /// 544 @id Either!(None, string) name_; 545 /// 546 Either!(None, CommandLineBinding) inputBinding_; 547 548 mixin genCtor; 549 mixin genIdentifier; 550 mixin genDumper; 551 } 552 553 /// 554 class InputArraySchema : SchemaBase 555 { 556 /** 557 * Defines the type of the array elements. 558 */ 559 Either!(CWLType, InputRecordSchema, InputEnumSchema, InputArraySchema, string, Either!(CWLType, InputRecordSchema, InputEnumSchema, InputArraySchema, string)[]) items_; 560 /** 561 * Must be `array` 562 */ 563 static immutable type_ = "array"; 564 /** 565 * A short, human-readable label of this object. 566 */ 567 Either!(None, string) label_; 568 /// 569 Either!(None, CommandLineBinding) inputBinding_; 570 571 mixin genCtor; 572 mixin genIdentifier; 573 mixin genDumper; 574 } 575 576 /// 577 class OutputRecordField : SchemaBase 578 { 579 /** 580 * The name of the field 581 */ 582 @id string name_; 583 /** 584 * A documentation string for this field 585 */ 586 Either!(None, string) doc_; 587 /** 588 * The field type 589 */ 590 @typeDSL Either!(CWLType, OutputRecordSchema, OutputEnumSchema, OutputArraySchema, string, Either!(CWLType, OutputRecordSchema, OutputEnumSchema, OutputArraySchema, string)[]) type_; 591 /// 592 Either!(None, CommandOutputBinding) outputBinding_; 593 594 mixin genCtor; 595 mixin genIdentifier; 596 mixin genDumper; 597 } 598 599 /// 600 class OutputRecordSchema : SchemaBase 601 { 602 /** 603 * Defines the fields of the record. 604 */ 605 @idMap("name", "type") Either!(None, OutputRecordField[]) fields_; 606 /** 607 * Must be `record` 608 */ 609 static immutable type_ = "record"; 610 /** 611 * A short, human-readable label of this object. 612 */ 613 Either!(None, string) label_; 614 615 mixin genCtor; 616 mixin genIdentifier; 617 mixin genDumper; 618 } 619 620 /// 621 class OutputEnumSchema : SchemaBase 622 { 623 /** 624 * Defines the set of valid symbols. 625 */ 626 @link string[] symbols_; 627 /** 628 * Must be `enum` 629 */ 630 static immutable type_ = "enum"; 631 /** 632 * A short, human-readable label of this object. 633 */ 634 Either!(None, string) label_; 635 /// 636 Either!(None, CommandOutputBinding) outputBinding_; 637 638 mixin genCtor; 639 mixin genIdentifier; 640 mixin genDumper; 641 } 642 643 /// 644 class OutputArraySchema : SchemaBase 645 { 646 /** 647 * Defines the type of the array elements. 648 */ 649 Either!(CWLType, OutputRecordSchema, OutputEnumSchema, OutputArraySchema, string, Either!(CWLType, OutputRecordSchema, OutputEnumSchema, OutputArraySchema, string)[]) items_; 650 /** 651 * Must be `array` 652 */ 653 static immutable type_ = "array"; 654 /** 655 * A short, human-readable label of this object. 656 */ 657 Either!(None, string) label_; 658 /// 659 Either!(None, CommandOutputBinding) outputBinding_; 660 661 mixin genCtor; 662 mixin genIdentifier; 663 mixin genDumper; 664 } 665 666 /// 667 class InputParameter : SchemaBase 668 { 669 /** 670 * A short, human-readable label of this object. 671 */ 672 Either!(None, string) label_; 673 /** 674 * Only valid when `type: File` or is an array of `items: File`. 675 * Provides a pattern or expression specifying files or directories that 676 * must be included alongside the primary file. All listed secondary 677 * files must be present. An implementation may fail workflow execution 678 * if an expected secondary file does not exist. 679 * If the value is an expression, the value of `self` in the expression 680 * must be the primary input or output File object to which this binding 681 * applies. The `basename`, `nameroot` and `nameext` fields must be 682 * present in `self`. For `CommandLineTool` outputs the `path` field must 683 * also be present. The expression must return a filename string relative 684 * to the path to the primary File, a File or Directory object with either 685 * `path` or `location` and `basename` fields set, or an array consisting 686 * of strings or File or Directory objects. It is legal to reference an 687 * unchanged File or Directory object taken from input as a secondaryFile. 688 * To work on non-filename-preserving storage systems, portable tool 689 * descriptions should avoid constructing new values from `location`, but 690 * should construct relative references using `basename` or `nameroot` 691 * instead. 692 * If a value in `secondaryFiles` is a string that is not an expression, 693 * it specifies that the following pattern should be applied to the path 694 * of the primary file to yield a filename relative to the primary File: 695 * 1. If string begins with one or more caret `^` characters, for each 696 * caret, remove the last file extension from the path (the last 697 * period `.` and all following characters). If there are no file 698 * extensions, the path is unchanged. 699 * 2. Append the remainder of the string to the end of the file path. 700 */ 701 Either!(None, string, Expression, Either!(string, Expression)[]) secondaryFiles_; 702 /** 703 * Only valid when `type: File` or is an array of `items: File`. 704 * A value of `true` indicates that the file is read or written 705 * sequentially without seeking. An implementation may use this flag to 706 * indicate whether it is valid to stream file contents using a named 707 * pipe. Default: `false`. 708 */ 709 Either!(None, bool) streamable_; 710 /** 711 * A documentation string for this type, or an array of strings which should be concatenated. 712 */ 713 Either!(None, string, string[]) doc_; 714 /** 715 * The unique identifier for this parameter object. 716 */ 717 @id string id_; 718 /** 719 * Only valid when `type: File` or is an array of `items: File`. 720 * This must be one or more IRIs of concept nodes 721 * that represents file formats which are allowed as input to this 722 * parameter, preferrably defined within an ontology. If no ontology is 723 * available, file formats may be tested by exact match. 724 */ 725 @link Either!(None, string, string[], Expression) format_; 726 /** 727 * Describes how to handle the inputs of a process and convert them 728 * into a concrete form for execution, such as command line parameters. 729 */ 730 Either!(None, CommandLineBinding) inputBinding_; 731 /** 732 * The default value to use for this parameter if the parameter is missing 733 * from the input object, or if the value of the parameter in the input 734 * object is `null`. Default values are applied before evaluating expressions 735 * (e.g. dependent `valueFrom` fields). 736 */ 737 Either!(None, File, Directory, Any) default_; 738 /** 739 * Specify valid types of data that may be assigned to this parameter. 740 */ 741 @typeDSL Either!(None, CWLType, InputRecordSchema, InputEnumSchema, InputArraySchema, string, Either!(CWLType, InputRecordSchema, InputEnumSchema, InputArraySchema, string)[]) type_; 742 743 mixin genCtor; 744 mixin genIdentifier; 745 mixin genDumper; 746 } 747 748 /// 749 class OutputParameter : SchemaBase 750 { 751 /** 752 * A short, human-readable label of this object. 753 */ 754 Either!(None, string) label_; 755 /** 756 * Only valid when `type: File` or is an array of `items: File`. 757 * Provides a pattern or expression specifying files or directories that 758 * must be included alongside the primary file. All listed secondary 759 * files must be present. An implementation may fail workflow execution 760 * if an expected secondary file does not exist. 761 * If the value is an expression, the value of `self` in the expression 762 * must be the primary input or output File object to which this binding 763 * applies. The `basename`, `nameroot` and `nameext` fields must be 764 * present in `self`. For `CommandLineTool` outputs the `path` field must 765 * also be present. The expression must return a filename string relative 766 * to the path to the primary File, a File or Directory object with either 767 * `path` or `location` and `basename` fields set, or an array consisting 768 * of strings or File or Directory objects. It is legal to reference an 769 * unchanged File or Directory object taken from input as a secondaryFile. 770 * To work on non-filename-preserving storage systems, portable tool 771 * descriptions should avoid constructing new values from `location`, but 772 * should construct relative references using `basename` or `nameroot` 773 * instead. 774 * If a value in `secondaryFiles` is a string that is not an expression, 775 * it specifies that the following pattern should be applied to the path 776 * of the primary file to yield a filename relative to the primary File: 777 * 1. If string begins with one or more caret `^` characters, for each 778 * caret, remove the last file extension from the path (the last 779 * period `.` and all following characters). If there are no file 780 * extensions, the path is unchanged. 781 * 2. Append the remainder of the string to the end of the file path. 782 */ 783 Either!(None, string, Expression, Either!(string, Expression)[]) secondaryFiles_; 784 /** 785 * Only valid when `type: File` or is an array of `items: File`. 786 * A value of `true` indicates that the file is read or written 787 * sequentially without seeking. An implementation may use this flag to 788 * indicate whether it is valid to stream file contents using a named 789 * pipe. Default: `false`. 790 */ 791 Either!(None, bool) streamable_; 792 /** 793 * A documentation string for this type, or an array of strings which should be concatenated. 794 */ 795 Either!(None, string, string[]) doc_; 796 /** 797 * The unique identifier for this parameter object. 798 */ 799 @id string id_; 800 /** 801 * Describes how to handle the outputs of a process. 802 */ 803 Either!(None, CommandOutputBinding) outputBinding_; 804 /** 805 * Only valid when `type: File` or is an array of `items: File`. 806 * This is the file format that will be assigned to 807 * the output parameter. 808 */ 809 @link Either!(None, string, Expression) format_; 810 811 mixin genCtor; 812 mixin genIdentifier; 813 mixin genDumper; 814 } 815 816 /** 817 * Indicates that the workflow platform must support inline Javascript expressions. 818 * If this requirement is not present, the workflow platform must not perform expression 819 * interpolatation. 820 */ 821 class InlineJavascriptRequirement : SchemaBase 822 { 823 /** 824 * Always 'InlineJavascriptRequirement' 825 */ 826 static immutable class_ = "InlineJavascriptRequirement"; 827 /** 828 * Additional code fragments that will also be inserted 829 * before executing the expression code. Allows for function definitions that may 830 * be called from CWL expressions. 831 */ 832 Either!(None, string[]) expressionLib_; 833 834 mixin genCtor; 835 mixin genIdentifier; 836 mixin genDumper; 837 } 838 839 /** 840 * This field consists of an array of type definitions which must be used when 841 * interpreting the `inputs` and `outputs` fields. When a `type` field 842 * contain a IRI, the implementation must check if the type is defined in 843 * `schemaDefs` and use that definition. If the type is not found in 844 * `schemaDefs`, it is an error. The entries in `schemaDefs` must be 845 * processed in the order listed such that later schema definitions may refer 846 * to earlier schema definitions. 847 */ 848 class SchemaDefRequirement : SchemaBase 849 { 850 /** 851 * Always 'SchemaDefRequirement' 852 */ 853 static immutable class_ = "SchemaDefRequirement"; 854 /** 855 * The list of type definitions. 856 */ 857 Either!(InputRecordSchema, InputEnumSchema, InputArraySchema)[] types_; 858 859 mixin genCtor; 860 mixin genIdentifier; 861 mixin genDumper; 862 } 863 864 /** 865 * Define an environment variable that will be set in the runtime environment 866 * by the workflow platform when executing the command line tool. May be the 867 * result of executing an expression, such as getting a parameter from input. 868 */ 869 class EnvironmentDef : SchemaBase 870 { 871 /** 872 * The environment variable name 873 */ 874 string envName_; 875 /** 876 * The environment variable value 877 */ 878 Either!(string, Expression) envValue_; 879 880 mixin genCtor; 881 mixin genIdentifier; 882 mixin genDumper; 883 } 884 885 /** 886 * When listed under `inputBinding` in the input schema, the term 887 * "value" refers to the the corresponding value in the input object. For 888 * binding objects listed in `CommandLineTool.arguments`, the term "value" 889 * refers to the effective value after evaluating `valueFrom`. 890 * The binding behavior when building the command line depends on the data 891 * type of the value. If there is a mismatch between the type described by 892 * the input schema and the effective value, such as resulting from an 893 * expression evaluation, an implementation must use the data type of the 894 * effective value. 895 * - **string**: Add `prefix` and the string to the command line. 896 * - **number**: Add `prefix` and decimal representation to command line. 897 * - **boolean**: If true, add `prefix` to the command line. If false, add 898 * nothing. 899 * - **File**: Add `prefix` and the value of 900 * [`File.path`](#File) to the command line. 901 * - **Directory**: Add `prefix` and the value of 902 * [`Directory.path`](#Directory) to the command line. 903 * - **array**: If `itemSeparator` is specified, add `prefix` and the join 904 * the array into a single string with `itemSeparator` separating the 905 * items. Otherwise first add `prefix`, then recursively process 906 * individual elements. 907 * If the array is empty, it does not add anything to command line. 908 * - **object**: Add `prefix` only, and recursively add object fields for 909 * which `inputBinding` is specified. 910 * - **null**: Add nothing. 911 */ 912 class CommandLineBinding : SchemaBase 913 { 914 /** 915 * Only valid when `type: File` or is an array of `items: File`. 916 * Read up to the first 64 KiB of text from the file and place it in the 917 * "contents" field of the file object for use by expressions. 918 */ 919 Either!(None, bool) loadContents_; 920 /** 921 * The sorting key. Default position is 0. 922 */ 923 Either!(None, int) position_; 924 /** 925 * Command line prefix to add before the value. 926 */ 927 Either!(None, string) prefix_; 928 /** 929 * If true (default), then the prefix and value must be added as separate 930 * command line arguments; if false, prefix and value must be concatenated 931 * into a single command line argument. 932 */ 933 Either!(None, bool) separate_; 934 /** 935 * Join the array elements into a single string with the elements 936 * separated by by `itemSeparator`. 937 */ 938 Either!(None, string) itemSeparator_; 939 /** 940 * If `valueFrom` is a constant string value, use this as the value and 941 * apply the binding rules above. 942 * If `valueFrom` is an expression, evaluate the expression to yield the 943 * actual value to use to build the command line and apply the binding 944 * rules above. If the inputBinding is associated with an input 945 * parameter, the value of `self` in the expression will be the value of 946 * the input parameter. Input parameter defaults (as specified by the 947 * `InputParameter.default` field) must be applied before evaluating the 948 * expression. 949 * When a binding is part of the `CommandLineTool.arguments` field, 950 * the `valueFrom` field is required. 951 */ 952 Either!(None, string, Expression) valueFrom_; 953 /** 954 * If `ShellCommandRequirement` is in the requirements for the current command, 955 * this controls whether the value is quoted on the command line (default is true). 956 * Use `shellQuote: false` to inject metacharacters for operations such as pipes. 957 * If `shellQuote` is true or not provided, the implementation must not 958 * permit interpretation of any shell metacharacters or directives. 959 */ 960 Either!(None, bool) shellQuote_; 961 962 mixin genCtor; 963 mixin genIdentifier; 964 mixin genDumper; 965 } 966 967 /** 968 * Describes how to generate an output parameter based on the files produced 969 * by a CommandLineTool. 970 * The output parameter value is generated by applying these operations in the 971 * following order: 972 * - glob 973 * - loadContents 974 * - outputEval 975 * - secondaryFiles 976 */ 977 class CommandOutputBinding : SchemaBase 978 { 979 /** 980 * Find files relative to the output directory, using POSIX glob(3) 981 * pathname matching. If an array is provided, find files that match any 982 * pattern in the array. If an expression is provided, the expression must 983 * return a string or an array of strings, which will then be evaluated as 984 * one or more glob patterns. Must only match and return files which 985 * actually exist. 986 */ 987 Either!(None, string, Expression, string[]) glob_; 988 /** 989 * For each file matched in `glob`, read up to 990 * the first 64 KiB of text from the file and place it in the `contents` 991 * field of the file object for manipulation by `outputEval`. 992 */ 993 Either!(None, bool) loadContents_; 994 /** 995 * Evaluate an expression to generate the output value. If `glob` was 996 * specified, the value of `self` must be an array containing file objects 997 * that were matched. If no files were matched, `self` must be a zero 998 * length array; if a single file was matched, the value of `self` is an 999 * array of a single element. Additionally, if `loadContents` is `true`, 1000 * the File objects must include up to the first 64 KiB of file contents 1001 * in the `contents` field. 1002 */ 1003 Either!(None, string, Expression) outputEval_; 1004 1005 mixin genCtor; 1006 mixin genIdentifier; 1007 mixin genDumper; 1008 } 1009 1010 /// 1011 class CommandInputRecordField : SchemaBase 1012 { 1013 /** 1014 * The name of the field 1015 */ 1016 @id string name_; 1017 /** 1018 * A documentation string for this field 1019 */ 1020 Either!(None, string) doc_; 1021 /** 1022 * The field type 1023 */ 1024 @typeDSL Either!(CWLType, CommandInputRecordSchema, CommandInputEnumSchema, CommandInputArraySchema, string, Either!(CWLType, CommandInputRecordSchema, CommandInputEnumSchema, CommandInputArraySchema, string)[]) type_; 1025 /// 1026 Either!(None, CommandLineBinding) inputBinding_; 1027 /** 1028 * A short, human-readable label of this process object. 1029 */ 1030 Either!(None, string) label_; 1031 1032 mixin genCtor; 1033 mixin genIdentifier; 1034 mixin genDumper; 1035 } 1036 1037 /// 1038 class CommandInputRecordSchema : SchemaBase 1039 { 1040 /** 1041 * Defines the fields of the record. 1042 */ 1043 @idMap("name", "type") Either!(None, CommandInputRecordField[]) fields_; 1044 /** 1045 * Must be `record` 1046 */ 1047 static immutable type_ = "record"; 1048 /** 1049 * A short, human-readable label of this object. 1050 */ 1051 Either!(None, string) label_; 1052 /// 1053 @id Either!(None, string) name_; 1054 1055 mixin genCtor; 1056 mixin genIdentifier; 1057 mixin genDumper; 1058 } 1059 1060 /// 1061 class CommandInputEnumSchema : SchemaBase 1062 { 1063 /** 1064 * Defines the set of valid symbols. 1065 */ 1066 @link string[] symbols_; 1067 /** 1068 * Must be `enum` 1069 */ 1070 static immutable type_ = "enum"; 1071 /** 1072 * A short, human-readable label of this object. 1073 */ 1074 Either!(None, string) label_; 1075 /// 1076 @id Either!(None, string) name_; 1077 /// 1078 Either!(None, CommandLineBinding) inputBinding_; 1079 1080 mixin genCtor; 1081 mixin genIdentifier; 1082 mixin genDumper; 1083 } 1084 1085 /// 1086 class CommandInputArraySchema : SchemaBase 1087 { 1088 /** 1089 * Defines the type of the array elements. 1090 */ 1091 Either!(CWLType, CommandInputRecordSchema, CommandInputEnumSchema, CommandInputArraySchema, string, Either!(CWLType, CommandInputRecordSchema, CommandInputEnumSchema, CommandInputArraySchema, string)[]) items_; 1092 /** 1093 * Must be `array` 1094 */ 1095 static immutable type_ = "array"; 1096 /** 1097 * A short, human-readable label of this object. 1098 */ 1099 Either!(None, string) label_; 1100 /// 1101 Either!(None, CommandLineBinding) inputBinding_; 1102 1103 mixin genCtor; 1104 mixin genIdentifier; 1105 mixin genDumper; 1106 } 1107 1108 /// 1109 class CommandOutputRecordField : SchemaBase 1110 { 1111 /** 1112 * The name of the field 1113 */ 1114 @id string name_; 1115 /** 1116 * A documentation string for this field 1117 */ 1118 Either!(None, string) doc_; 1119 /** 1120 * The field type 1121 */ 1122 @typeDSL Either!(CWLType, CommandOutputRecordSchema, CommandOutputEnumSchema, CommandOutputArraySchema, string, Either!(CWLType, CommandOutputRecordSchema, CommandOutputEnumSchema, CommandOutputArraySchema, string)[]) type_; 1123 /// 1124 Either!(None, CommandOutputBinding) outputBinding_; 1125 1126 mixin genCtor; 1127 mixin genIdentifier; 1128 mixin genDumper; 1129 } 1130 1131 /// 1132 class CommandOutputRecordSchema : SchemaBase 1133 { 1134 /** 1135 * Defines the fields of the record. 1136 */ 1137 @idMap("name", "type") Either!(None, CommandOutputRecordField[]) fields_; 1138 /** 1139 * Must be `record` 1140 */ 1141 static immutable type_ = "record"; 1142 /** 1143 * A short, human-readable label of this object. 1144 */ 1145 Either!(None, string) label_; 1146 /// 1147 @id Either!(None, string) name_; 1148 1149 mixin genCtor; 1150 mixin genIdentifier; 1151 mixin genDumper; 1152 } 1153 1154 /// 1155 class CommandOutputEnumSchema : SchemaBase 1156 { 1157 /** 1158 * Defines the set of valid symbols. 1159 */ 1160 @link string[] symbols_; 1161 /** 1162 * Must be `enum` 1163 */ 1164 static immutable type_ = "enum"; 1165 /** 1166 * A short, human-readable label of this object. 1167 */ 1168 Either!(None, string) label_; 1169 /// 1170 Either!(None, CommandOutputBinding) outputBinding_; 1171 1172 mixin genCtor; 1173 mixin genIdentifier; 1174 mixin genDumper; 1175 } 1176 1177 /// 1178 class CommandOutputArraySchema : SchemaBase 1179 { 1180 /** 1181 * Defines the type of the array elements. 1182 */ 1183 Either!(CWLType, CommandOutputRecordSchema, CommandOutputEnumSchema, CommandOutputArraySchema, string, Either!(CWLType, CommandOutputRecordSchema, CommandOutputEnumSchema, CommandOutputArraySchema, string)[]) items_; 1184 /** 1185 * Must be `array` 1186 */ 1187 static immutable type_ = "array"; 1188 /** 1189 * A short, human-readable label of this object. 1190 */ 1191 Either!(None, string) label_; 1192 /// 1193 Either!(None, CommandOutputBinding) outputBinding_; 1194 1195 mixin genCtor; 1196 mixin genIdentifier; 1197 mixin genDumper; 1198 } 1199 1200 /** 1201 * An input parameter for a CommandLineTool. 1202 */ 1203 class CommandInputParameter : SchemaBase 1204 { 1205 /** 1206 * A short, human-readable label of this object. 1207 */ 1208 Either!(None, string) label_; 1209 /** 1210 * Only valid when `type: File` or is an array of `items: File`. 1211 * Provides a pattern or expression specifying files or directories that 1212 * must be included alongside the primary file. All listed secondary 1213 * files must be present. An implementation may fail workflow execution 1214 * if an expected secondary file does not exist. 1215 * If the value is an expression, the value of `self` in the expression 1216 * must be the primary input or output File object to which this binding 1217 * applies. The `basename`, `nameroot` and `nameext` fields must be 1218 * present in `self`. For `CommandLineTool` outputs the `path` field must 1219 * also be present. The expression must return a filename string relative 1220 * to the path to the primary File, a File or Directory object with either 1221 * `path` or `location` and `basename` fields set, or an array consisting 1222 * of strings or File or Directory objects. It is legal to reference an 1223 * unchanged File or Directory object taken from input as a secondaryFile. 1224 * To work on non-filename-preserving storage systems, portable tool 1225 * descriptions should avoid constructing new values from `location`, but 1226 * should construct relative references using `basename` or `nameroot` 1227 * instead. 1228 * If a value in `secondaryFiles` is a string that is not an expression, 1229 * it specifies that the following pattern should be applied to the path 1230 * of the primary file to yield a filename relative to the primary File: 1231 * 1. If string begins with one or more caret `^` characters, for each 1232 * caret, remove the last file extension from the path (the last 1233 * period `.` and all following characters). If there are no file 1234 * extensions, the path is unchanged. 1235 * 2. Append the remainder of the string to the end of the file path. 1236 */ 1237 Either!(None, string, Expression, Either!(string, Expression)[]) secondaryFiles_; 1238 /** 1239 * Only valid when `type: File` or is an array of `items: File`. 1240 * A value of `true` indicates that the file is read or written 1241 * sequentially without seeking. An implementation may use this flag to 1242 * indicate whether it is valid to stream file contents using a named 1243 * pipe. Default: `false`. 1244 */ 1245 Either!(None, bool) streamable_; 1246 /** 1247 * A documentation string for this type, or an array of strings which should be concatenated. 1248 */ 1249 Either!(None, string, string[]) doc_; 1250 /** 1251 * The unique identifier for this parameter object. 1252 */ 1253 @id string id_; 1254 /** 1255 * Only valid when `type: File` or is an array of `items: File`. 1256 * This must be one or more IRIs of concept nodes 1257 * that represents file formats which are allowed as input to this 1258 * parameter, preferrably defined within an ontology. If no ontology is 1259 * available, file formats may be tested by exact match. 1260 */ 1261 @link Either!(None, string, string[], Expression) format_; 1262 /** 1263 * Describes how to handle the inputs of a process and convert them 1264 * into a concrete form for execution, such as command line parameters. 1265 */ 1266 Either!(None, CommandLineBinding) inputBinding_; 1267 /** 1268 * The default value to use for this parameter if the parameter is missing 1269 * from the input object, or if the value of the parameter in the input 1270 * object is `null`. Default values are applied before evaluating expressions 1271 * (e.g. dependent `valueFrom` fields). 1272 */ 1273 Either!(None, File, Directory, Any) default_; 1274 /** 1275 * Specify valid types of data that may be assigned to this parameter. 1276 */ 1277 @typeDSL Either!(None, CWLType, CommandInputRecordSchema, CommandInputEnumSchema, CommandInputArraySchema, string, Either!(CWLType, CommandInputRecordSchema, CommandInputEnumSchema, CommandInputArraySchema, string)[]) type_; 1278 1279 mixin genCtor; 1280 mixin genIdentifier; 1281 mixin genDumper; 1282 } 1283 1284 /** 1285 * An output parameter for a CommandLineTool. 1286 */ 1287 class CommandOutputParameter : SchemaBase 1288 { 1289 /** 1290 * A short, human-readable label of this object. 1291 */ 1292 Either!(None, string) label_; 1293 /** 1294 * Only valid when `type: File` or is an array of `items: File`. 1295 * Provides a pattern or expression specifying files or directories that 1296 * must be included alongside the primary file. All listed secondary 1297 * files must be present. An implementation may fail workflow execution 1298 * if an expected secondary file does not exist. 1299 * If the value is an expression, the value of `self` in the expression 1300 * must be the primary input or output File object to which this binding 1301 * applies. The `basename`, `nameroot` and `nameext` fields must be 1302 * present in `self`. For `CommandLineTool` outputs the `path` field must 1303 * also be present. The expression must return a filename string relative 1304 * to the path to the primary File, a File or Directory object with either 1305 * `path` or `location` and `basename` fields set, or an array consisting 1306 * of strings or File or Directory objects. It is legal to reference an 1307 * unchanged File or Directory object taken from input as a secondaryFile. 1308 * To work on non-filename-preserving storage systems, portable tool 1309 * descriptions should avoid constructing new values from `location`, but 1310 * should construct relative references using `basename` or `nameroot` 1311 * instead. 1312 * If a value in `secondaryFiles` is a string that is not an expression, 1313 * it specifies that the following pattern should be applied to the path 1314 * of the primary file to yield a filename relative to the primary File: 1315 * 1. If string begins with one or more caret `^` characters, for each 1316 * caret, remove the last file extension from the path (the last 1317 * period `.` and all following characters). If there are no file 1318 * extensions, the path is unchanged. 1319 * 2. Append the remainder of the string to the end of the file path. 1320 */ 1321 Either!(None, string, Expression, Either!(string, Expression)[]) secondaryFiles_; 1322 /** 1323 * Only valid when `type: File` or is an array of `items: File`. 1324 * A value of `true` indicates that the file is read or written 1325 * sequentially without seeking. An implementation may use this flag to 1326 * indicate whether it is valid to stream file contents using a named 1327 * pipe. Default: `false`. 1328 */ 1329 Either!(None, bool) streamable_; 1330 /** 1331 * A documentation string for this type, or an array of strings which should be concatenated. 1332 */ 1333 Either!(None, string, string[]) doc_; 1334 /** 1335 * The unique identifier for this parameter object. 1336 */ 1337 @id string id_; 1338 /** 1339 * Describes how to handle the outputs of a process. 1340 */ 1341 Either!(None, CommandOutputBinding) outputBinding_; 1342 /** 1343 * Only valid when `type: File` or is an array of `items: File`. 1344 * This is the file format that will be assigned to 1345 * the output parameter. 1346 */ 1347 @link Either!(None, string, Expression) format_; 1348 /** 1349 * Specify valid types of data that may be assigned to this parameter. 1350 */ 1351 @typeDSL Either!(None, CWLType, stdout, stderr, CommandOutputRecordSchema, CommandOutputEnumSchema, CommandOutputArraySchema, string, Either!(CWLType, CommandOutputRecordSchema, CommandOutputEnumSchema, CommandOutputArraySchema, string)[]) type_; 1352 1353 mixin genCtor; 1354 mixin genIdentifier; 1355 mixin genDumper; 1356 } 1357 1358 /** 1359 * Only valid as a `type` for a `CommandLineTool` output with no 1360 * `outputBinding` set. 1361 * The following 1362 * ``` 1363 * outputs: 1364 * an_output_name: 1365 * type: stdout 1366 * stdout: a_stdout_file 1367 * ``` 1368 * is equivalent to 1369 * ``` 1370 * outputs: 1371 * an_output_name: 1372 * type: File 1373 * streamable: true 1374 * outputBinding: 1375 * glob: a_stdout_file 1376 * stdout: a_stdout_file 1377 * ``` 1378 * If there is no `stdout` name provided, a random filename will be created. 1379 * For example, the following 1380 * ``` 1381 * outputs: 1382 * an_output_name: 1383 * type: stdout 1384 * ``` 1385 * is equivalent to 1386 * ``` 1387 * outputs: 1388 * an_output_name: 1389 * type: File 1390 * streamable: true 1391 * outputBinding: 1392 * glob: random_stdout_filenameABCDEFG 1393 * stdout: random_stdout_filenameABCDEFG 1394 * ``` 1395 */ 1396 class stdout : SchemaBase 1397 { 1398 enum Symbol 1399 { 1400 s0 = "stdout" 1401 } 1402 1403 Symbol value; 1404 1405 mixin genCtor; 1406 mixin genOpEq; 1407 mixin genDumper; 1408 } 1409 1410 /** 1411 * Only valid as a `type` for a `CommandLineTool` output with no 1412 * `outputBinding` set. 1413 * The following 1414 * ``` 1415 * outputs: 1416 * an_output_name: 1417 * type: stderr 1418 * stderr: a_stderr_file 1419 * ``` 1420 * is equivalent to 1421 * ``` 1422 * outputs: 1423 * an_output_name: 1424 * type: File 1425 * streamable: true 1426 * outputBinding: 1427 * glob: a_stderr_file 1428 * stderr: a_stderr_file 1429 * ``` 1430 * If there is no `stderr` name provided, a random filename will be created. 1431 * For example, the following 1432 * ``` 1433 * outputs: 1434 * an_output_name: 1435 * type: stderr 1436 * ``` 1437 * is equivalent to 1438 * ``` 1439 * outputs: 1440 * an_output_name: 1441 * type: File 1442 * streamable: true 1443 * outputBinding: 1444 * glob: random_stderr_filenameABCDEFG 1445 * stderr: random_stderr_filenameABCDEFG 1446 * ``` 1447 */ 1448 class stderr : SchemaBase 1449 { 1450 enum Symbol 1451 { 1452 s0 = "stderr" 1453 } 1454 1455 Symbol value; 1456 1457 mixin genCtor; 1458 mixin genOpEq; 1459 mixin genDumper; 1460 } 1461 1462 /** 1463 * This defines the schema of the CWL Command Line Tool Description document. 1464 */ 1465 @documentRoot class CommandLineTool : SchemaBase 1466 { 1467 /** 1468 * The unique identifier for this process object. 1469 */ 1470 @id Either!(None, string) id_; 1471 /** 1472 * Defines the input parameters of the process. The process is ready to 1473 * run when all required input parameters are associated with concrete 1474 * values. Input parameters include a schema for each parameter which is 1475 * used to validate the input object. It may also be used to build a user 1476 * interface for constructing the input object. 1477 * When accepting an input object, all input parameters must have a value. 1478 * If an input parameter is missing from the input object, it must be 1479 * assigned a value of `null` (or the value of `default` for that 1480 * parameter, if provided) for the purposes of validation and evaluation 1481 * of expressions. 1482 */ 1483 @idMap("id", "type") CommandInputParameter[] inputs_; 1484 /** 1485 * Defines the parameters representing the output of the process. May be 1486 * used to generate and/or validate the output object. 1487 */ 1488 @idMap("id", "type") CommandOutputParameter[] outputs_; 1489 /** 1490 * Declares requirements that apply to either the runtime environment or the 1491 * workflow engine that must be met in order to execute this process. If 1492 * an implementation cannot satisfy all requirements, or a requirement is 1493 * listed which is not recognized by the implementation, it is a fatal 1494 * error and the implementation must not attempt to run the process, 1495 * unless overridden at user option. 1496 */ 1497 @idMap("class") Either!(None, Either!(InlineJavascriptRequirement, SchemaDefRequirement, DockerRequirement, SoftwareRequirement, InitialWorkDirRequirement, EnvVarRequirement, ShellCommandRequirement, ResourceRequirement, SubworkflowFeatureRequirement, ScatterFeatureRequirement, MultipleInputFeatureRequirement, StepInputExpressionRequirement)[]) requirements_; 1498 /** 1499 * Declares hints applying to either the runtime environment or the 1500 * workflow engine that may be helpful in executing this process. It is 1501 * not an error if an implementation cannot satisfy all hints, however 1502 * the implementation may report a warning. 1503 */ 1504 @idMap("class") Either!(None, Either!(InlineJavascriptRequirement, SchemaDefRequirement, DockerRequirement, SoftwareRequirement, InitialWorkDirRequirement, EnvVarRequirement, ShellCommandRequirement, ResourceRequirement, SubworkflowFeatureRequirement, ScatterFeatureRequirement, MultipleInputFeatureRequirement, StepInputExpressionRequirement, Any)[]) hints_; 1505 /** 1506 * A short, human-readable label of this process object. 1507 */ 1508 Either!(None, string) label_; 1509 /** 1510 * A long, human-readable description of this process object. 1511 */ 1512 Either!(None, string) doc_; 1513 /** 1514 * CWL document version. Always required at the document root. Not 1515 * required for a Process embedded inside another Process. 1516 */ 1517 Either!(None, CWLVersion) cwlVersion_; 1518 /// 1519 static immutable class_ = "CommandLineTool"; 1520 /** 1521 * Specifies the program to execute. If an array, the first element of 1522 * the array is the command to execute, and subsequent elements are 1523 * mandatory command line arguments. The elements in `baseCommand` must 1524 * appear before any command line bindings from `inputBinding` or 1525 * `arguments`. 1526 * If `baseCommand` is not provided or is an empty array, the first 1527 * element of the command line produced after processing `inputBinding` or 1528 * `arguments` must be used as the program to execute. 1529 * If the program includes a path separator character it must 1530 * be an absolute path, otherwise it is an error. If the program does not 1531 * include a path separator, search the `$PATH` variable in the runtime 1532 * environment of the workflow runner find the absolute path of the 1533 * executable. 1534 */ 1535 Either!(None, string, string[]) baseCommand_; 1536 /** 1537 * Command line bindings which are not directly associated with input parameters. 1538 */ 1539 Either!(None, Either!(string, Expression, CommandLineBinding)[]) arguments_; 1540 /** 1541 * A path to a file whose contents must be piped into the command's 1542 * standard input stream. 1543 */ 1544 Either!(None, string, Expression) stdin_; 1545 /** 1546 * Capture the command's standard error stream to a file written to 1547 * the designated output directory. 1548 * If `stderr` is a string, it specifies the file name to use. 1549 * If `stderr` is an expression, the expression is evaluated and must 1550 * return a string with the file name to use to capture stderr. If the 1551 * return value is not a string, or the resulting path contains illegal 1552 * characters (such as the path separator `/`) it is an error. 1553 */ 1554 Either!(None, string, Expression) stderr_; 1555 /** 1556 * Capture the command's standard output stream to a file written to 1557 * the designated output directory. 1558 * If `stdout` is a string, it specifies the file name to use. 1559 * If `stdout` is an expression, the expression is evaluated and must 1560 * return a string with the file name to use to capture stdout. If the 1561 * return value is not a string, or the resulting path contains illegal 1562 * characters (such as the path separator `/`) it is an error. 1563 */ 1564 Either!(None, string, Expression) stdout_; 1565 /** 1566 * Exit codes that indicate the process completed successfully. 1567 */ 1568 Either!(None, int[]) successCodes_; 1569 /** 1570 * Exit codes that indicate the process failed due to a possibly 1571 * temporary condition, where executing the process with the same 1572 * runtime environment and inputs may produce different results. 1573 */ 1574 Either!(None, int[]) temporaryFailCodes_; 1575 /** 1576 * Exit codes that indicate the process failed due to a permanent logic error, where executing the process with the same runtime environment and same inputs is expected to always fail. 1577 */ 1578 Either!(None, int[]) permanentFailCodes_; 1579 1580 mixin genCtor; 1581 mixin genIdentifier; 1582 mixin genDumper; 1583 } 1584 1585 /** 1586 * Indicates that a workflow component should be run in a 1587 * [Docker](http://docker.com) container, and specifies how to fetch or build 1588 * the image. 1589 * If a CommandLineTool lists `DockerRequirement` under 1590 * `hints` (or `requirements`), it may (or must) be run in the specified Docker 1591 * container. 1592 * The platform must first acquire or install the correct Docker image as 1593 * specified by `dockerPull`, `dockerImport`, `dockerLoad` or `dockerFile`. 1594 * The platform must execute the tool in the container using `docker run` with 1595 * the appropriate Docker image and tool command line. 1596 * The workflow platform may provide input files and the designated output 1597 * directory through the use of volume bind mounts. The platform should rewrite 1598 * file paths in the input object to correspond to the Docker bind mounted 1599 * locations. That is, the platform should rewrite values in the parameter context 1600 * such as `runtime.outdir`, `runtime.tmpdir` and others to be valid paths 1601 * within the container. 1602 * When running a tool contained in Docker, the workflow platform must not 1603 * assume anything about the contents of the Docker container, such as the 1604 * presence or absence of specific software, except to assume that the 1605 * generated command line represents a valid command within the runtime 1606 * environment of the container. 1607 * ## Interaction with other requirements 1608 * If [EnvVarRequirement](#EnvVarRequirement) is specified alongside a 1609 * DockerRequirement, the environment variables must be provided to Docker 1610 * using `--env` or `--env-file` and interact with the container's preexisting 1611 * environment as defined by Docker. 1612 */ 1613 class DockerRequirement : SchemaBase 1614 { 1615 /** 1616 * Always 'DockerRequirement' 1617 */ 1618 static immutable class_ = "DockerRequirement"; 1619 /** 1620 * Specify a Docker image to retrieve using `docker pull`. 1621 */ 1622 Either!(None, string) dockerPull_; 1623 /** 1624 * Specify a HTTP URL from which to download a Docker image using `docker load`. 1625 */ 1626 Either!(None, string) dockerLoad_; 1627 /** 1628 * Supply the contents of a Dockerfile which will be built using `docker build`. 1629 */ 1630 Either!(None, string) dockerFile_; 1631 /** 1632 * Provide HTTP URL to download and gunzip a Docker images using `docker import. 1633 */ 1634 Either!(None, string) dockerImport_; 1635 /** 1636 * The image id that will be used for `docker run`. May be a 1637 * human-readable image name or the image identifier hash. May be skipped 1638 * if `dockerPull` is specified, in which case the `dockerPull` image id 1639 * must be used. 1640 */ 1641 Either!(None, string) dockerImageId_; 1642 /** 1643 * Set the designated output directory to a specific location inside the 1644 * Docker container. 1645 */ 1646 Either!(None, string) dockerOutputDirectory_; 1647 1648 mixin genCtor; 1649 mixin genIdentifier; 1650 mixin genDumper; 1651 } 1652 1653 /** 1654 * A list of software packages that should be configured in the environment of 1655 * the defined process. 1656 */ 1657 class SoftwareRequirement : SchemaBase 1658 { 1659 /** 1660 * Always 'SoftwareRequirement' 1661 */ 1662 static immutable class_ = "SoftwareRequirement"; 1663 /** 1664 * The list of software to be configured. 1665 */ 1666 @idMap("package", "specs") SoftwarePackage[] packages_; 1667 1668 mixin genCtor; 1669 mixin genIdentifier; 1670 mixin genDumper; 1671 } 1672 1673 /// 1674 class SoftwarePackage : SchemaBase 1675 { 1676 /** 1677 * The name of the software to be made available. If the name is 1678 * common, inconsistent, or otherwise ambiguous it should be combined with 1679 * one or more identifiers in the `specs` field. 1680 */ 1681 string package_; 1682 /** 1683 * The (optional) versions of the software that are known to be 1684 * compatible. 1685 */ 1686 Either!(None, string[]) version_; 1687 /** 1688 * One or more [IRI](https://en.wikipedia.org/wiki/Internationalized_Resource_Identifier)s 1689 * identifying resources for installing or enabling the software named in 1690 * the `package` field. Implementations may provide resolvers which map 1691 * these software identifer IRIs to some configuration action; or they can 1692 * use only the name from the `package` field on a best effort basis. 1693 * For example, the IRI https://packages.debian.org/bowtie could 1694 * be resolved with `apt-get install bowtie`. The IRI 1695 * https://anaconda.org/bioconda/bowtie could be resolved with `conda 1696 * install -c bioconda bowtie`. 1697 * IRIs can also be system independent and used to map to a specific 1698 * software installation or selection mechanism. 1699 * Using [RRID](https://www.identifiers.org/rrid/) as an example: 1700 * https://identifiers.org/rrid/RRID:SCR_005476 1701 * could be fulfilled using the above mentioned Debian or bioconda 1702 * package, a local installation managed by [Environement Modules](http://modules.sourceforge.net/), 1703 * or any other mechanism the platform chooses. IRIs can also be from 1704 * identifer sources that are discipline specific yet still system 1705 * independent. As an example, the equivalent [ELIXIR Tools and Data 1706 * Service Registry](https://bio.tools) IRI to the previous RRID example is 1707 * https://bio.tools/tool/bowtie2/version/2.2.8. 1708 * If supported by a given registry, implementations are encouraged to 1709 * query these system independent sofware identifier IRIs directly for 1710 * links to packaging systems. 1711 * A site specific IRI can be listed as well. For example, an academic 1712 * computing cluster using Environement Modules could list the IRI 1713 * `https://hpc.example.edu/modules/bowtie-tbb/1.22` to indicate that 1714 * `module load bowtie-tbb/1.1.2` should be executed to make available 1715 * `bowtie` version 1.1.2 compiled with the TBB library prior to running 1716 * the accompanying Workflow or CommandLineTool. Note that the example IRI 1717 * is specific to a particular institution and computing environment as 1718 * the Environment Modules system does not have a common namespace or 1719 * standardized naming convention. 1720 * This last example is the least portable and should only be used if 1721 * mechanisms based off of the `package` field or more generic IRIs are 1722 * unavailable or unsuitable. While harmless to other sites, site specific 1723 * software IRIs should be left out of shared CWL descriptions to avoid 1724 * clutter. 1725 */ 1726 Either!(None, string[]) specs_; 1727 1728 mixin genCtor; 1729 mixin genIdentifier; 1730 mixin genDumper; 1731 } 1732 1733 /** 1734 * Define a file or subdirectory that must be placed in the designated output 1735 * directory prior to executing the command line tool. May be the result of 1736 * executing an expression, such as building a configuration file from a 1737 * template. 1738 */ 1739 class Dirent : SchemaBase 1740 { 1741 /** 1742 * The name of the file or subdirectory to create in the output directory. 1743 * If `entry` is a File or Directory, the `entryname` field overrides the value 1744 * of `basename` of the File or Directory object. Optional. 1745 */ 1746 Either!(None, string, Expression) entryname_; 1747 /** 1748 * If the value is a string literal or an expression which evaluates to a 1749 * string, a new file must be created with the string as the file contents. 1750 * If the value is an expression that evaluates to a `File` object, this 1751 * indicates the referenced file should be added to the designated output 1752 * directory prior to executing the tool. 1753 * If the value is an expression that evaluates to a `Dirent` object, this 1754 * indicates that the File or Directory in `entry` should be added to the 1755 * designated output directory with the name in `entryname`. 1756 * If `writable` is false, the file may be made available using a bind 1757 * mount or file system link to avoid unnecessary copying of the input 1758 * file. 1759 */ 1760 Either!(string, Expression) entry_; 1761 /** 1762 * If true, the file or directory must be writable by the tool. Changes 1763 * to the file or directory must be isolated and not visible by any other 1764 * CommandLineTool process. This may be implemented by making a copy of 1765 * the original file or directory. Default false (files and directories 1766 * read-only by default). 1767 * A directory marked as `writable: true` implies that all files and 1768 * subdirectories are recursively writable as well. 1769 */ 1770 Either!(None, bool) writable_; 1771 1772 mixin genCtor; 1773 mixin genIdentifier; 1774 mixin genDumper; 1775 } 1776 1777 /** 1778 * Define a list of files and subdirectories that must be created by the workflow platform in the designated output directory prior to executing the command line tool. 1779 */ 1780 class InitialWorkDirRequirement : SchemaBase 1781 { 1782 /** 1783 * InitialWorkDirRequirement 1784 */ 1785 static immutable class_ = "InitialWorkDirRequirement"; 1786 /** 1787 * The list of files or subdirectories that must be placed in the 1788 * designated output directory prior to executing the command line tool. 1789 * May be an expression. If so, the expression return value must validate 1790 * as `{type: array, items: [File, Directory]}`. 1791 * Files or Directories which are listed in the input parameters and 1792 * appear in the `InitialWorkDirRequirement` listing must have their 1793 * `path` set to their staged location in the designated output directory. 1794 * If the same File or Directory appears more than once in the 1795 * `InitialWorkDirRequirement` listing, the implementation must choose 1796 * exactly one value for `path`; how this value is chosen is undefined. 1797 */ 1798 Either!(Either!(File, Directory, Dirent, string, Expression)[], string, Expression) listing_; 1799 1800 mixin genCtor; 1801 mixin genIdentifier; 1802 mixin genDumper; 1803 } 1804 1805 /** 1806 * Define a list of environment variables which will be set in the 1807 * execution environment of the tool. See `EnvironmentDef` for details. 1808 */ 1809 class EnvVarRequirement : SchemaBase 1810 { 1811 /** 1812 * Always 'EnvVarRequirement' 1813 */ 1814 static immutable class_ = "EnvVarRequirement"; 1815 /** 1816 * The list of environment variables. 1817 */ 1818 @idMap("envName", "envValue") EnvironmentDef[] envDef_; 1819 1820 mixin genCtor; 1821 mixin genIdentifier; 1822 mixin genDumper; 1823 } 1824 1825 /** 1826 * Modify the behavior of CommandLineTool to generate a single string 1827 * containing a shell command line. Each item in the argument list must be 1828 * joined into a string separated by single spaces and quoted to prevent 1829 * intepretation by the shell, unless `CommandLineBinding` for that argument 1830 * contains `shellQuote: false`. If `shellQuote: false` is specified, the 1831 * argument is joined into the command string without quoting, which allows 1832 * the use of shell metacharacters such as `|` for pipes. 1833 */ 1834 class ShellCommandRequirement : SchemaBase 1835 { 1836 /** 1837 * Always 'ShellCommandRequirement' 1838 */ 1839 static immutable class_ = "ShellCommandRequirement"; 1840 1841 mixin genCtor; 1842 mixin genIdentifier; 1843 mixin genDumper; 1844 } 1845 1846 /** 1847 * Specify basic hardware resource requirements. 1848 * "min" is the minimum amount of a resource that must be reserved to schedule 1849 * a job. If "min" cannot be satisfied, the job should not be run. 1850 * "max" is the maximum amount of a resource that the job shall be permitted 1851 * to use. If a node has sufficient resources, multiple jobs may be scheduled 1852 * on a single node provided each job's "max" resource requirements are 1853 * met. If a job attempts to exceed its "max" resource allocation, an 1854 * implementation may deny additional resources, which may result in job 1855 * failure. 1856 * If "min" is specified but "max" is not, then "max" == "min" 1857 * If "max" is specified by "min" is not, then "min" == "max". 1858 * It is an error if max < min. 1859 * It is an error if the value of any of these fields is negative. 1860 * If neither "min" nor "max" is specified for a resource, an implementation may provide a default. 1861 */ 1862 class ResourceRequirement : SchemaBase 1863 { 1864 /** 1865 * Always 'ResourceRequirement' 1866 */ 1867 static immutable class_ = "ResourceRequirement"; 1868 /** 1869 * Minimum reserved number of CPU cores 1870 */ 1871 Either!(None, long, string, Expression) coresMin_; 1872 /** 1873 * Maximum reserved number of CPU cores 1874 */ 1875 Either!(None, int, string, Expression) coresMax_; 1876 /** 1877 * Minimum reserved RAM in mebibytes (2**20) 1878 */ 1879 Either!(None, long, string, Expression) ramMin_; 1880 /** 1881 * Maximum reserved RAM in mebibytes (2**20) 1882 */ 1883 Either!(None, long, string, Expression) ramMax_; 1884 /** 1885 * Minimum reserved filesystem based storage for the designated temporary directory, in mebibytes (2**20) 1886 */ 1887 Either!(None, long, string, Expression) tmpdirMin_; 1888 /** 1889 * Maximum reserved filesystem based storage for the designated temporary directory, in mebibytes (2**20) 1890 */ 1891 Either!(None, long, string, Expression) tmpdirMax_; 1892 /** 1893 * Minimum reserved filesystem based storage for the designated output directory, in mebibytes (2**20) 1894 */ 1895 Either!(None, long, string, Expression) outdirMin_; 1896 /** 1897 * Maximum reserved filesystem based storage for the designated output directory, in mebibytes (2**20) 1898 */ 1899 Either!(None, long, string, Expression) outdirMax_; 1900 1901 mixin genCtor; 1902 mixin genIdentifier; 1903 mixin genDumper; 1904 } 1905 1906 /// 1907 class ExpressionToolOutputParameter : SchemaBase 1908 { 1909 /** 1910 * A short, human-readable label of this object. 1911 */ 1912 Either!(None, string) label_; 1913 /** 1914 * Only valid when `type: File` or is an array of `items: File`. 1915 * Provides a pattern or expression specifying files or directories that 1916 * must be included alongside the primary file. All listed secondary 1917 * files must be present. An implementation may fail workflow execution 1918 * if an expected secondary file does not exist. 1919 * If the value is an expression, the value of `self` in the expression 1920 * must be the primary input or output File object to which this binding 1921 * applies. The `basename`, `nameroot` and `nameext` fields must be 1922 * present in `self`. For `CommandLineTool` outputs the `path` field must 1923 * also be present. The expression must return a filename string relative 1924 * to the path to the primary File, a File or Directory object with either 1925 * `path` or `location` and `basename` fields set, or an array consisting 1926 * of strings or File or Directory objects. It is legal to reference an 1927 * unchanged File or Directory object taken from input as a secondaryFile. 1928 * To work on non-filename-preserving storage systems, portable tool 1929 * descriptions should avoid constructing new values from `location`, but 1930 * should construct relative references using `basename` or `nameroot` 1931 * instead. 1932 * If a value in `secondaryFiles` is a string that is not an expression, 1933 * it specifies that the following pattern should be applied to the path 1934 * of the primary file to yield a filename relative to the primary File: 1935 * 1. If string begins with one or more caret `^` characters, for each 1936 * caret, remove the last file extension from the path (the last 1937 * period `.` and all following characters). If there are no file 1938 * extensions, the path is unchanged. 1939 * 2. Append the remainder of the string to the end of the file path. 1940 */ 1941 Either!(None, string, Expression, Either!(string, Expression)[]) secondaryFiles_; 1942 /** 1943 * Only valid when `type: File` or is an array of `items: File`. 1944 * A value of `true` indicates that the file is read or written 1945 * sequentially without seeking. An implementation may use this flag to 1946 * indicate whether it is valid to stream file contents using a named 1947 * pipe. Default: `false`. 1948 */ 1949 Either!(None, bool) streamable_; 1950 /** 1951 * A documentation string for this type, or an array of strings which should be concatenated. 1952 */ 1953 Either!(None, string, string[]) doc_; 1954 /** 1955 * The unique identifier for this parameter object. 1956 */ 1957 @id string id_; 1958 /** 1959 * Describes how to handle the outputs of a process. 1960 */ 1961 Either!(None, CommandOutputBinding) outputBinding_; 1962 /** 1963 * Only valid when `type: File` or is an array of `items: File`. 1964 * This is the file format that will be assigned to 1965 * the output parameter. 1966 */ 1967 @link Either!(None, string, Expression) format_; 1968 /** 1969 * Specify valid types of data that may be assigned to this parameter. 1970 */ 1971 @typeDSL Either!(None, CWLType, OutputRecordSchema, OutputEnumSchema, OutputArraySchema, string, Either!(CWLType, OutputRecordSchema, OutputEnumSchema, OutputArraySchema, string)[]) type_; 1972 1973 mixin genCtor; 1974 mixin genIdentifier; 1975 mixin genDumper; 1976 } 1977 1978 /** 1979 * Execute an expression as a Workflow step. 1980 */ 1981 @documentRoot class ExpressionTool : SchemaBase 1982 { 1983 /** 1984 * The unique identifier for this process object. 1985 */ 1986 @id Either!(None, string) id_; 1987 /** 1988 * Defines the input parameters of the process. The process is ready to 1989 * run when all required input parameters are associated with concrete 1990 * values. Input parameters include a schema for each parameter which is 1991 * used to validate the input object. It may also be used to build a user 1992 * interface for constructing the input object. 1993 * When accepting an input object, all input parameters must have a value. 1994 * If an input parameter is missing from the input object, it must be 1995 * assigned a value of `null` (or the value of `default` for that 1996 * parameter, if provided) for the purposes of validation and evaluation 1997 * of expressions. 1998 */ 1999 @idMap("id", "type") InputParameter[] inputs_; 2000 /** 2001 * Defines the parameters representing the output of the process. May be 2002 * used to generate and/or validate the output object. 2003 */ 2004 @idMap("id", "type") ExpressionToolOutputParameter[] outputs_; 2005 /** 2006 * Declares requirements that apply to either the runtime environment or the 2007 * workflow engine that must be met in order to execute this process. If 2008 * an implementation cannot satisfy all requirements, or a requirement is 2009 * listed which is not recognized by the implementation, it is a fatal 2010 * error and the implementation must not attempt to run the process, 2011 * unless overridden at user option. 2012 */ 2013 @idMap("class") Either!(None, Either!(InlineJavascriptRequirement, SchemaDefRequirement, DockerRequirement, SoftwareRequirement, InitialWorkDirRequirement, EnvVarRequirement, ShellCommandRequirement, ResourceRequirement, SubworkflowFeatureRequirement, ScatterFeatureRequirement, MultipleInputFeatureRequirement, StepInputExpressionRequirement)[]) requirements_; 2014 /** 2015 * Declares hints applying to either the runtime environment or the 2016 * workflow engine that may be helpful in executing this process. It is 2017 * not an error if an implementation cannot satisfy all hints, however 2018 * the implementation may report a warning. 2019 */ 2020 @idMap("class") Either!(None, Either!(InlineJavascriptRequirement, SchemaDefRequirement, DockerRequirement, SoftwareRequirement, InitialWorkDirRequirement, EnvVarRequirement, ShellCommandRequirement, ResourceRequirement, SubworkflowFeatureRequirement, ScatterFeatureRequirement, MultipleInputFeatureRequirement, StepInputExpressionRequirement, Any)[]) hints_; 2021 /** 2022 * A short, human-readable label of this process object. 2023 */ 2024 Either!(None, string) label_; 2025 /** 2026 * A long, human-readable description of this process object. 2027 */ 2028 Either!(None, string) doc_; 2029 /** 2030 * CWL document version. Always required at the document root. Not 2031 * required for a Process embedded inside another Process. 2032 */ 2033 Either!(None, CWLVersion) cwlVersion_; 2034 /// 2035 static immutable class_ = "ExpressionTool"; 2036 /** 2037 * The expression to execute. The expression must return a JSON object which 2038 * matches the output parameters of the ExpressionTool. 2039 */ 2040 Either!(string, Expression) expression_; 2041 2042 mixin genCtor; 2043 mixin genIdentifier; 2044 mixin genDumper; 2045 } 2046 2047 /** 2048 * The input link merge method, described in [WorkflowStepInput](#WorkflowStepInput). 2049 */ 2050 class LinkMergeMethod : SchemaBase 2051 { 2052 enum Symbol 2053 { 2054 s0 = "merge_nested", 2055 s1 = "merge_flattened" 2056 } 2057 2058 Symbol value; 2059 2060 mixin genCtor; 2061 mixin genOpEq; 2062 mixin genDumper; 2063 } 2064 2065 /** 2066 * Describe an output parameter of a workflow. The parameter must be 2067 * connected to one or more parameters defined in the workflow that will 2068 * provide the value of the output parameter. 2069 */ 2070 class WorkflowOutputParameter : SchemaBase 2071 { 2072 /** 2073 * A short, human-readable label of this object. 2074 */ 2075 Either!(None, string) label_; 2076 /** 2077 * Only valid when `type: File` or is an array of `items: File`. 2078 * Provides a pattern or expression specifying files or directories that 2079 * must be included alongside the primary file. All listed secondary 2080 * files must be present. An implementation may fail workflow execution 2081 * if an expected secondary file does not exist. 2082 * If the value is an expression, the value of `self` in the expression 2083 * must be the primary input or output File object to which this binding 2084 * applies. The `basename`, `nameroot` and `nameext` fields must be 2085 * present in `self`. For `CommandLineTool` outputs the `path` field must 2086 * also be present. The expression must return a filename string relative 2087 * to the path to the primary File, a File or Directory object with either 2088 * `path` or `location` and `basename` fields set, or an array consisting 2089 * of strings or File or Directory objects. It is legal to reference an 2090 * unchanged File or Directory object taken from input as a secondaryFile. 2091 * To work on non-filename-preserving storage systems, portable tool 2092 * descriptions should avoid constructing new values from `location`, but 2093 * should construct relative references using `basename` or `nameroot` 2094 * instead. 2095 * If a value in `secondaryFiles` is a string that is not an expression, 2096 * it specifies that the following pattern should be applied to the path 2097 * of the primary file to yield a filename relative to the primary File: 2098 * 1. If string begins with one or more caret `^` characters, for each 2099 * caret, remove the last file extension from the path (the last 2100 * period `.` and all following characters). If there are no file 2101 * extensions, the path is unchanged. 2102 * 2. Append the remainder of the string to the end of the file path. 2103 */ 2104 Either!(None, string, Expression, Either!(string, Expression)[]) secondaryFiles_; 2105 /** 2106 * Only valid when `type: File` or is an array of `items: File`. 2107 * A value of `true` indicates that the file is read or written 2108 * sequentially without seeking. An implementation may use this flag to 2109 * indicate whether it is valid to stream file contents using a named 2110 * pipe. Default: `false`. 2111 */ 2112 Either!(None, bool) streamable_; 2113 /** 2114 * A documentation string for this type, or an array of strings which should be concatenated. 2115 */ 2116 Either!(None, string, string[]) doc_; 2117 /** 2118 * The unique identifier for this parameter object. 2119 */ 2120 @id string id_; 2121 /** 2122 * Describes how to handle the outputs of a process. 2123 */ 2124 Either!(None, CommandOutputBinding) outputBinding_; 2125 /** 2126 * Only valid when `type: File` or is an array of `items: File`. 2127 * This is the file format that will be assigned to 2128 * the output parameter. 2129 */ 2130 @link Either!(None, string, Expression) format_; 2131 /** 2132 * Specifies one or more workflow parameters that supply the value of to 2133 * the output parameter. 2134 */ 2135 @link Either!(None, string, string[]) outputSource_; 2136 /** 2137 * The method to use to merge multiple sources into a single array. 2138 * If not specified, the default method is "merge_nested". 2139 */ 2140 Either!(None, LinkMergeMethod) linkMerge_; 2141 /** 2142 * Specify valid types of data that may be assigned to this parameter. 2143 */ 2144 @typeDSL Either!(None, CWLType, OutputRecordSchema, OutputEnumSchema, OutputArraySchema, string, Either!(CWLType, OutputRecordSchema, OutputEnumSchema, OutputArraySchema, string)[]) type_; 2145 2146 mixin genCtor; 2147 mixin genIdentifier; 2148 mixin genDumper; 2149 } 2150 2151 /** 2152 * The input of a workflow step connects an upstream parameter (from the 2153 * workflow inputs, or the outputs of other workflows steps) with the input 2154 * parameters of the underlying step. 2155 * ## Input object 2156 * A WorkflowStepInput object must contain an `id` field in the form 2157 * `#fieldname` or `#prefix/fieldname`. When the `id` field contains a slash 2158 * `/` the field name consists of the characters following the final slash 2159 * (the prefix portion may contain one or more slashes to indicate scope). 2160 * This defines a field of the workflow step input object with the value of 2161 * the `source` parameter(s). 2162 * ## Merging 2163 * To merge multiple inbound data links, 2164 * [MultipleInputFeatureRequirement](#MultipleInputFeatureRequirement) must be specified 2165 * in the workflow or workflow step requirements. 2166 * If the sink parameter is an array, or named in a [workflow 2167 * scatter](#WorkflowStep) operation, there may be multiple inbound data links 2168 * listed in the `source` field. The values from the input links are merged 2169 * depending on the method specified in the `linkMerge` field. If not 2170 * specified, the default method is "merge_nested". 2171 * * **merge_nested** 2172 * The input must be an array consisting of exactly one entry for each 2173 * input link. If "merge_nested" is specified with a single link, the value 2174 * from the link must be wrapped in a single-item list. 2175 * * **merge_flattened** 2176 * 1. The source and sink parameters must be compatible types, or the source 2177 * type must be compatible with single element from the "items" type of 2178 * the destination array parameter. 2179 * 2. Source parameters which are arrays are concatenated. 2180 * Source parameters which are single element types are appended as 2181 * single elements. 2182 */ 2183 class WorkflowStepInput : SchemaBase 2184 { 2185 /** 2186 * Specifies one or more workflow parameters that will provide input to 2187 * the underlying step parameter. 2188 */ 2189 @link Either!(None, string, string[]) source_; 2190 /** 2191 * The method to use to merge multiple inbound links into a single array. 2192 * If not specified, the default method is "merge_nested". 2193 */ 2194 Either!(None, LinkMergeMethod) linkMerge_; 2195 /** 2196 * A unique identifier for this workflow input parameter. 2197 */ 2198 @id string id_; 2199 /** 2200 * The default value for this parameter to use if either there is no 2201 * `source` field, or the value produced by the `source` is `null`. The 2202 * default must be applied prior to scattering or evaluating `valueFrom`. 2203 */ 2204 Either!(None, File, Directory, Any) default_; 2205 /** 2206 * To use valueFrom, [StepInputExpressionRequirement](#StepInputExpressionRequirement) must 2207 * be specified in the workflow or workflow step requirements. 2208 * If `valueFrom` is a constant string value, use this as the value for 2209 * this input parameter. 2210 * If `valueFrom` is a parameter reference or expression, it must be 2211 * evaluated to yield the actual value to be assiged to the input field. 2212 * The `self` value in the parameter reference or expression must be 2213 * 1. `null` if there is no `source` field 2214 * 2. the value of the parameter(s) specified in the `source` field when this 2215 * workflow input parameter **is not** specified in this workflow step's `scatter` field. 2216 * 3. an element of the parameter specified in the `source` field when this workflow input 2217 * parameter **is** specified in this workflow step's `scatter` field. 2218 * The value of `inputs` in the parameter reference or expression must be 2219 * the input object to the workflow step after assigning the `source` 2220 * values, applying `default`, and then scattering. The order of 2221 * evaluating `valueFrom` among step input parameters is undefined and the 2222 * result of evaluating `valueFrom` on a parameter must not be visible to 2223 * evaluation of `valueFrom` on other parameters. 2224 */ 2225 Either!(None, string, Expression) valueFrom_; 2226 2227 mixin genCtor; 2228 mixin genIdentifier; 2229 mixin genDumper; 2230 } 2231 2232 /** 2233 * Associate an output parameter of the underlying process with a workflow 2234 * parameter. The workflow parameter (given in the `id` field) be may be used 2235 * as a `source` to connect with input parameters of other workflow steps, or 2236 * with an output parameter of the process. 2237 */ 2238 class WorkflowStepOutput : SchemaBase 2239 { 2240 /** 2241 * A unique identifier for this workflow output parameter. This is the 2242 * identifier to use in the `source` field of `WorkflowStepInput` to 2243 * connect the output value to downstream parameters. 2244 */ 2245 @id string id_; 2246 2247 mixin genCtor; 2248 mixin genIdentifier; 2249 mixin genDumper; 2250 } 2251 2252 /** 2253 * The scatter method, as described in [workflow step scatter](#WorkflowStep). 2254 */ 2255 class ScatterMethod : SchemaBase 2256 { 2257 enum Symbol 2258 { 2259 s0 = "dotproduct", 2260 s1 = "nested_crossproduct", 2261 s2 = "flat_crossproduct" 2262 } 2263 2264 Symbol value; 2265 2266 mixin genCtor; 2267 mixin genOpEq; 2268 mixin genDumper; 2269 } 2270 2271 /** 2272 * A workflow step is an executable element of a workflow. It specifies the 2273 * underlying process implementation (such as `CommandLineTool` or another 2274 * `Workflow`) in the `run` field and connects the input and output parameters 2275 * of the underlying process to workflow parameters. 2276 * # Scatter/gather 2277 * To use scatter/gather, 2278 * [ScatterFeatureRequirement](#ScatterFeatureRequirement) must be specified 2279 * in the workflow or workflow step requirements. 2280 * A "scatter" operation specifies that the associated workflow step or 2281 * subworkflow should execute separately over a list of input elements. Each 2282 * job making up a scatter operation is independent and may be executed 2283 * concurrently. 2284 * The `scatter` field specifies one or more input parameters which will be 2285 * scattered. An input parameter may be listed more than once. The declared 2286 * type of each input parameter is implicitly becomes an array of items of the 2287 * input parameter type. If a parameter is listed more than once, it becomes 2288 * a nested array. As a result, upstream parameters which are connected to 2289 * scattered parameters must be arrays. 2290 * All output parameter types are also implicitly wrapped in arrays. Each job 2291 * in the scatter results in an entry in the output array. 2292 * If any scattered parameter runtime value is an empty array, all outputs are 2293 * set to empty arrays and no work is done for the step, according to 2294 * applicable scattering rules. 2295 * If `scatter` declares more than one input parameter, `scatterMethod` 2296 * describes how to decompose the input into a discrete set of jobs. 2297 * * **dotproduct** specifies that each of the input arrays are aligned and one 2298 * element taken from each array to construct each job. It is an error 2299 * if all input arrays are not the same length. 2300 * * **nested_crossproduct** specifies the Cartesian product of the inputs, 2301 * producing a job for every combination of the scattered inputs. The 2302 * output must be nested arrays for each level of scattering, in the 2303 * order that the input arrays are listed in the `scatter` field. 2304 * * **flat_crossproduct** specifies the Cartesian product of the inputs, 2305 * producing a job for every combination of the scattered inputs. The 2306 * output arrays must be flattened to a single level, but otherwise listed in the 2307 * order that the input arrays are listed in the `scatter` field. 2308 * # Subworkflows 2309 * To specify a nested workflow as part of a workflow step, 2310 * [SubworkflowFeatureRequirement](#SubworkflowFeatureRequirement) must be 2311 * specified in the workflow or workflow step requirements. 2312 * It is a fatal error if a workflow directly or indirectly invokes itself as 2313 * a subworkflow (recursive workflows are not allowed). 2314 */ 2315 class WorkflowStep : SchemaBase 2316 { 2317 /** 2318 * The unique identifier for this workflow step. 2319 */ 2320 @id string id_; 2321 /** 2322 * Defines the input parameters of the workflow step. The process is ready to 2323 * run when all required input parameters are associated with concrete 2324 * values. Input parameters include a schema for each parameter which is 2325 * used to validate the input object. It may also be used build a user 2326 * interface for constructing the input object. 2327 */ 2328 @idMap("id", "source") WorkflowStepInput[] in_; 2329 /** 2330 * Defines the parameters representing the output of the process. May be 2331 * used to generate and/or validate the output object. 2332 */ 2333 @link Either!(Either!(string, WorkflowStepOutput)[]) out_; 2334 /** 2335 * Declares requirements that apply to either the runtime environment or the 2336 * workflow engine that must be met in order to execute this workflow step. If 2337 * an implementation cannot satisfy all requirements, or a requirement is 2338 * listed which is not recognized by the implementation, it is a fatal 2339 * error and the implementation must not attempt to run the process, 2340 * unless overridden at user option. 2341 */ 2342 @idMap("class") Either!(None, Either!(InlineJavascriptRequirement, SchemaDefRequirement, DockerRequirement, SoftwareRequirement, InitialWorkDirRequirement, EnvVarRequirement, ShellCommandRequirement, ResourceRequirement, SubworkflowFeatureRequirement, ScatterFeatureRequirement, MultipleInputFeatureRequirement, StepInputExpressionRequirement)[]) requirements_; 2343 /** 2344 * Declares hints applying to either the runtime environment or the 2345 * workflow engine that may be helpful in executing this workflow step. It is 2346 * not an error if an implementation cannot satisfy all hints, however 2347 * the implementation may report a warning. 2348 */ 2349 @idMap("class") Either!(None, Any[]) hints_; 2350 /** 2351 * A short, human-readable label of this process object. 2352 */ 2353 Either!(None, string) label_; 2354 /** 2355 * A long, human-readable description of this process object. 2356 */ 2357 Either!(None, string) doc_; 2358 /** 2359 * Specifies the process to run. 2360 */ 2361 @link Either!(string, CommandLineTool, ExpressionTool, Workflow) run_; 2362 /// 2363 @link Either!(None, string, string[]) scatter_; 2364 /** 2365 * Required if `scatter` is an array of more than one element. 2366 */ 2367 Either!(None, ScatterMethod) scatterMethod_; 2368 2369 mixin genCtor; 2370 mixin genIdentifier; 2371 mixin genDumper; 2372 } 2373 2374 /** 2375 * A workflow describes a set of **steps** and the **dependencies** between 2376 * those steps. When a step produces output that will be consumed by a 2377 * second step, the first step is a dependency of the second step. 2378 * When there is a dependency, the workflow engine must execute the preceding 2379 * step and wait for it to successfully produce output before executing the 2380 * dependent step. If two steps are defined in the workflow graph that 2381 * are not directly or indirectly dependent, these steps are **independent**, 2382 * and may execute in any order or execute concurrently. A workflow is 2383 * complete when all steps have been executed. 2384 * Dependencies between parameters are expressed using the `source` field on 2385 * [workflow step input parameters](#WorkflowStepInput) and [workflow output 2386 * parameters](#WorkflowOutputParameter). 2387 * The `source` field expresses the dependency of one parameter on another 2388 * such that when a value is associated with the parameter specified by 2389 * `source`, that value is propagated to the destination parameter. When all 2390 * data links inbound to a given step are fufilled, the step is ready to 2391 * execute. 2392 * ## Workflow success and failure 2393 * A completed step must result in one of `success`, `temporaryFailure` or 2394 * `permanentFailure` states. An implementation may choose to retry a step 2395 * execution which resulted in `temporaryFailure`. An implementation may 2396 * choose to either continue running other steps of a workflow, or terminate 2397 * immediately upon `permanentFailure`. 2398 * * If any step of a workflow execution results in `permanentFailure`, then 2399 * the workflow status is `permanentFailure`. 2400 * * If one or more steps result in `temporaryFailure` and all other steps 2401 * complete `success` or are not executed, then the workflow status is 2402 * `temporaryFailure`. 2403 * * If all workflow steps are executed and complete with `success`, then the 2404 * workflow status is `success`. 2405 * # Extensions 2406 * [ScatterFeatureRequirement](#ScatterFeatureRequirement) and 2407 * [SubworkflowFeatureRequirement](#SubworkflowFeatureRequirement) are 2408 * available as standard [extensions](#Extensions_and_Metadata) to core 2409 * workflow semantics. 2410 */ 2411 @documentRoot class Workflow : SchemaBase 2412 { 2413 /** 2414 * The unique identifier for this process object. 2415 */ 2416 @id Either!(None, string) id_; 2417 /** 2418 * Defines the input parameters of the process. The process is ready to 2419 * run when all required input parameters are associated with concrete 2420 * values. Input parameters include a schema for each parameter which is 2421 * used to validate the input object. It may also be used to build a user 2422 * interface for constructing the input object. 2423 * When accepting an input object, all input parameters must have a value. 2424 * If an input parameter is missing from the input object, it must be 2425 * assigned a value of `null` (or the value of `default` for that 2426 * parameter, if provided) for the purposes of validation and evaluation 2427 * of expressions. 2428 */ 2429 @idMap("id", "type") InputParameter[] inputs_; 2430 /** 2431 * Defines the parameters representing the output of the process. May be 2432 * used to generate and/or validate the output object. 2433 */ 2434 @idMap("id", "type") WorkflowOutputParameter[] outputs_; 2435 /** 2436 * Declares requirements that apply to either the runtime environment or the 2437 * workflow engine that must be met in order to execute this process. If 2438 * an implementation cannot satisfy all requirements, or a requirement is 2439 * listed which is not recognized by the implementation, it is a fatal 2440 * error and the implementation must not attempt to run the process, 2441 * unless overridden at user option. 2442 */ 2443 @idMap("class") Either!(None, Either!(InlineJavascriptRequirement, SchemaDefRequirement, DockerRequirement, SoftwareRequirement, InitialWorkDirRequirement, EnvVarRequirement, ShellCommandRequirement, ResourceRequirement, SubworkflowFeatureRequirement, ScatterFeatureRequirement, MultipleInputFeatureRequirement, StepInputExpressionRequirement)[]) requirements_; 2444 /** 2445 * Declares hints applying to either the runtime environment or the 2446 * workflow engine that may be helpful in executing this process. It is 2447 * not an error if an implementation cannot satisfy all hints, however 2448 * the implementation may report a warning. 2449 */ 2450 @idMap("class") Either!(None, Either!(InlineJavascriptRequirement, SchemaDefRequirement, DockerRequirement, SoftwareRequirement, InitialWorkDirRequirement, EnvVarRequirement, ShellCommandRequirement, ResourceRequirement, SubworkflowFeatureRequirement, ScatterFeatureRequirement, MultipleInputFeatureRequirement, StepInputExpressionRequirement, Any)[]) hints_; 2451 /** 2452 * A short, human-readable label of this process object. 2453 */ 2454 Either!(None, string) label_; 2455 /** 2456 * A long, human-readable description of this process object. 2457 */ 2458 Either!(None, string) doc_; 2459 /** 2460 * CWL document version. Always required at the document root. Not 2461 * required for a Process embedded inside another Process. 2462 */ 2463 Either!(None, CWLVersion) cwlVersion_; 2464 /// 2465 static immutable class_ = "Workflow"; 2466 /** 2467 * The individual steps that make up the workflow. Each step is executed when all of its 2468 * input data links are fufilled. An implementation may choose to execute 2469 * the steps in a different order than listed and/or execute steps 2470 * concurrently, provided that dependencies between steps are met. 2471 */ 2472 @idMap("id") Either!(WorkflowStep[]) steps_; 2473 2474 mixin genCtor; 2475 mixin genIdentifier; 2476 mixin genDumper; 2477 } 2478 2479 /** 2480 * Indicates that the workflow platform must support nested workflows in 2481 * the `run` field of [WorkflowStep](#WorkflowStep). 2482 */ 2483 class SubworkflowFeatureRequirement : SchemaBase 2484 { 2485 /** 2486 * Always 'SubworkflowFeatureRequirement' 2487 */ 2488 static immutable class_ = "SubworkflowFeatureRequirement"; 2489 2490 mixin genCtor; 2491 mixin genIdentifier; 2492 mixin genDumper; 2493 } 2494 2495 /** 2496 * Indicates that the workflow platform must support the `scatter` and 2497 * `scatterMethod` fields of [WorkflowStep](#WorkflowStep). 2498 */ 2499 class ScatterFeatureRequirement : SchemaBase 2500 { 2501 /** 2502 * Always 'ScatterFeatureRequirement' 2503 */ 2504 static immutable class_ = "ScatterFeatureRequirement"; 2505 2506 mixin genCtor; 2507 mixin genIdentifier; 2508 mixin genDumper; 2509 } 2510 2511 /** 2512 * Indicates that the workflow platform must support multiple inbound data links 2513 * listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). 2514 */ 2515 class MultipleInputFeatureRequirement : SchemaBase 2516 { 2517 /** 2518 * Always 'MultipleInputFeatureRequirement' 2519 */ 2520 static immutable class_ = "MultipleInputFeatureRequirement"; 2521 2522 mixin genCtor; 2523 mixin genIdentifier; 2524 mixin genDumper; 2525 } 2526 2527 /** 2528 * Indicate that the workflow platform must support the `valueFrom` field 2529 * of [WorkflowStepInput](#WorkflowStepInput). 2530 */ 2531 class StepInputExpressionRequirement : SchemaBase 2532 { 2533 /** 2534 * Always 'StepInputExpressionRequirement' 2535 */ 2536 static immutable class_ = "StepInputExpressionRequirement"; 2537 2538 mixin genCtor; 2539 mixin genIdentifier; 2540 mixin genDumper; 2541 } 2542 2543 /// 2544 alias DocumentRootType = Either!(CommandLineTool, ExpressionTool, Workflow); 2545 2546 /// 2547 alias importFromURI = import_!DocumentRootType; 2548 2549 @("Test for generated parser") 2550 unittest 2551 { 2552 import std : dirEntries, SpanMode; 2553 2554 auto resourceDir = "resources/cwl-v1.0"; 2555 foreach (file; dirEntries(resourceDir, SpanMode.depth)) 2556 { 2557 import std : assertNotThrown, baseName, format, startsWith; 2558 import salad.resolver : absoluteURI; 2559 2560 if (!file.baseName.startsWith("valid")) 2561 { 2562 continue; 2563 } 2564 importFromURI(file.absoluteURI).assertNotThrown(format!"Failed to load %s"(file)); 2565 } 2566 }