• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

common-workflow-language / cwljava / #423

17 Dec 2025 10:33AM UTC coverage: 56.982% (-1.0%) from 57.972%
#423

push

github

web-flow
refresh 2025-12 (including extensions) (#218)

* "id" is a required field in for Parameters and WorkflowSteps
* regen; drop CommandLineBindableImpl; add optional CWL extensions

185 of 577 new or added lines in 21 files covered. (32.06%)

10 existing lines in 10 files now uncovered.

7892 of 13850 relevant lines covered (56.98%)

0.57 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.39
/src/main/java/org/commonwl/cwlsdk/cwl1_2/WorkflowStepInputImpl.java
1
// Copyright Common Workflow Language project contributors
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//      http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15
package org.commonwl.cwlsdk.cwl1_2;
16

17
import org.commonwl.cwlsdk.cwl1_2.utils.LoaderInstances;
18
import org.commonwl.cwlsdk.cwl1_2.utils.LoadingOptions;
19
import org.commonwl.cwlsdk.cwl1_2.utils.LoadingOptionsBuilder;
20
import org.commonwl.cwlsdk.cwl1_2.utils.SaveableImpl;
21
import org.commonwl.cwlsdk.cwl1_2.utils.ValidationException;
22

23
/**
24
* Auto-generated class implementation for <I>https://w3id.org/cwl/cwl#WorkflowStepInput</I><BR> <BLOCKQUOTE>
25
 The input of a workflow step connects an upstream parameter (from the
26
 workflow inputs, or the outputs of other workflows steps) with the input
27
 parameters of the process specified by the `run` field. Only input parameters
28
 declared by the target process will be passed through at runtime to the process
29
 though additional parameters may be specified (for use within `valueFrom`
30
 expressions for instance) - unconnected or unused parameters do not represent an
31
 error condition.
32
 
33
 # Input object
34
 
35
 A WorkflowStepInput object must contain an `id` field in the form
36
 `#fieldname` or `#prefix/fieldname`.  When the `id` field contains a slash
37
 `/` the field name consists of the characters following the final slash
38
 (the prefix portion may contain one or more slashes to indicate scope).
39
 This defines a field of the workflow step input object with the value of
40
 the `source` parameter(s).
41
 
42
 # Merging multiple inbound data links
43
 
44
 To merge multiple inbound data links,
45
 [MultipleInputFeatureRequirement](#MultipleInputFeatureRequirement) must be specified
46
 in the workflow or workflow step requirements.
47
 
48
 If the sink parameter is an array, or named in a [workflow
49
 scatter](#WorkflowStep) operation, there may be multiple inbound
50
 data links listed in the `source` field.  The values from the
51
 input links are merged depending on the method specified in the
52
 `linkMerge` field.  If both `linkMerge` and `pickValue` are null
53
 or not specified, and there is more than one element in the
54
 `source` array, the default method is &quot;merge_nested&quot;.
55
 
56
 If both `linkMerge` and `pickValue` are null or not specified, and
57
 there is only a single element in the `source`, then the input
58
 parameter takes the scalar value from the single input link (it is
59
 *not* wrapped in a single-list).
60
 
61
 * **merge_nested**
62
 
63
   The input must be an array consisting of exactly one entry for each
64
   input link.  If &quot;merge_nested&quot; is specified with a single link, the value
65
   from the link must be wrapped in a single-item list.
66
 
67
 * **merge_flattened**
68
 
69
   1. The source and sink parameters must be compatible types, or the source
70
      type must be compatible with single element from the &quot;items&quot; type of
71
      the destination array parameter.
72
   2. Source parameters which are arrays are concatenated.
73
      Source parameters which are single element types are appended as
74
      single elements.
75
 
76
 # Picking non-null values among inbound data links
77
 
78
 If present, `pickValue` specifies how to pick non-null values among inbound data links.
79
 
80
 `pickValue` is evaluated
81
   1. Once all source values from upstream step or parameters are available.
82
   2. After `linkMerge`.
83
   3. Before `scatter` or `valueFrom`.
84
 
85
 This is specifically intended to be useful in combination with
86
 [conditional execution](#WorkflowStep), where several upstream
87
 steps may be connected to a single input (`source` is a list), and
88
 skipped steps produce null values.
89
 
90
 Static type checkers should check for type consistency after inferring what the type
91
 will be after `pickValue` is applied, just as they do currently for `linkMerge`.
92
 
93
 * **first_non_null**
94
 
95
   For the first level of a list input, pick the first non-null element.  The result is a scalar.
96
   It is an error if there is no non-null element.  Examples:
97
   * `[null, x, null, y] -&gt; x`
98
   * `[null, [null], null, y] -&gt; [null]`
99
   * `[null, null, null] -&gt; Runtime Error`
100
 
101
   *Intended use case*: If-else pattern where the
102
   value comes either from a conditional step or from a default or
103
   fallback value. The conditional step(s) should be placed first in
104
   the list.
105
 
106
 * **the_only_non_null**
107
 
108
   For the first level of a list input, pick the single non-null element.  The result is a scalar.
109
   It is an error if there is more than one non-null element.  Examples:
110
 
111
   * `[null, x, null] -&gt; x`
112
   * `[null, x, null, y] -&gt; Runtime Error`
113
   * `[null, [null], null] -&gt; [null]`
114
   * `[null, null, null] -&gt; Runtime Error`
115
 
116
   *Intended use case*: Switch type patterns where developer considers
117
   more than one active code path as a workflow error
118
   (possibly indicating an error in writing `when` condition expressions).
119
 
120
 * **all_non_null**
121
 
122
   For the first level of a list input, pick all non-null values.
123
   The result is a list, which may be empty.  Examples:
124
 
125
   * `[null, x, null] -&gt; [x]`
126
   * `[x, null, y] -&gt; [x, y]`
127
   * `[null, [x], [null]] -&gt; [[x], [null]]`
128
   * `[null, null, null] -&gt; []`
129
 
130
   *Intended use case*: It is valid to have more than one source, but
131
    sources are conditional, so null sources (from skipped steps)
132
    should be filtered out.
133
  </BLOCKQUOTE>
134
 */
135
public class WorkflowStepInputImpl extends SaveableImpl implements WorkflowStepInput {
136
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
1✔
137
  private java.util.Map<String, Object> extensionFields_ =
1✔
138
      new java.util.HashMap<String, Object>();
139
  public LoadingOptions getLoadingOptions() {
140
    return this.loadingOptions_;
×
141
  }
142
  public java.util.Map<String, Object> getExtensionFields() {
143
    return this.extensionFields_;
×
144
  }
145

146
  private String id;
147

148
  /**
149
   * Getter for property <I>https://w3id.org/cwl/cwl#WorkflowStepInput/id</I><BR>
150
   * <BLOCKQUOTE>
151
   * The unique identifier of the source input field name.   * </BLOCKQUOTE>
152
   */
153

154
  public String getId() {
155
    return this.id;
1✔
156
  }
157

158
  private Object source;
159

160
  /**
161
   * Getter for property <I>https://w3id.org/cwl/cwl#source</I><BR>
162
   * <BLOCKQUOTE>
163
   * Specifies one or more workflow parameters that will provide input to
164
   * the underlying step parameter.
165
   *    * </BLOCKQUOTE>
166
   */
167

168
  public Object getSource() {
169
    return this.source;
1✔
170
  }
171

172
  private java.util.Optional<LinkMergeMethod> linkMerge;
173

174
  /**
175
   * Getter for property <I>https://w3id.org/cwl/cwl#Sink/linkMerge</I><BR>
176
   * <BLOCKQUOTE>
177
   * The method to use to merge multiple inbound links into a single array.
178
   * If not specified, the default method is &quot;merge_nested&quot;.
179
   *    * </BLOCKQUOTE>
180
   */
181

182
  public java.util.Optional<LinkMergeMethod> getLinkMerge() {
183
    return this.linkMerge;
×
184
  }
185

186
  private java.util.Optional<PickValueMethod> pickValue;
187

188
  /**
189
   * Getter for property <I>https://w3id.org/cwl/cwl#Sink/pickValue</I><BR>
190
   * <BLOCKQUOTE>
191
   * The method to use to choose non-null elements among multiple sources.
192
   *    * </BLOCKQUOTE>
193
   */
194

195
  public java.util.Optional<PickValueMethod> getPickValue() {
196
    return this.pickValue;
×
197
  }
198

199
  private java.util.Optional<Boolean> loadContents;
200

201
  /**
202
   * Getter for property <I>https://w3id.org/cwl/cwl#LoadContents/loadContents</I><BR>
203
   * <BLOCKQUOTE>
204
   * Only valid when `type: File` or is an array of `items: File`.
205
   * 
206
   * If true, the file (or each file in the array) must be a UTF-8
207
   * text file 64 KiB or smaller, and the implementation must read
208
   * the entire contents of the file (or file array) and place it
209
   * in the `contents` field of the File object for use by
210
   * expressions.  If the size of the file is greater than 64 KiB,
211
   * the implementation must raise a fatal error.
212
   *    * </BLOCKQUOTE>
213
   */
214

215
  public java.util.Optional<Boolean> getLoadContents() {
216
    return this.loadContents;
×
217
  }
218

219
  private java.util.Optional<LoadListingEnum> loadListing;
220

221
  /**
222
   * Getter for property <I>https://w3id.org/cwl/cwl#LoadContents/loadListing</I><BR>
223
   * <BLOCKQUOTE>
224
   * Only valid when `type: Directory` or is an array of `items: Directory`.
225
   * 
226
   * Specify the desired behavior for loading the `listing` field of
227
   * a Directory object for use by expressions.
228
   * 
229
   * The order of precedence for loadListing is:
230
   * 
231
   *   1. `loadListing` on an individual parameter
232
   *   2. Inherited from `LoadListingRequirement`
233
   *   3. By default: `no_listing`
234
   *    * </BLOCKQUOTE>
235
   */
236

237
  public java.util.Optional<LoadListingEnum> getLoadListing() {
238
    return this.loadListing;
×
239
  }
240

241
  private java.util.Optional<String> label;
242

243
  /**
244
   * Getter for property <I>https://w3id.org/cwl/cwl#Labeled/label</I><BR>
245
   * <BLOCKQUOTE>
246
   * A short, human-readable label of this object.   * </BLOCKQUOTE>
247
   */
248

249
  public java.util.Optional<String> getLabel() {
250
    return this.label;
×
251
  }
252

253
  private java.util.Optional<Object> default_;
254

255
  /**
256
   * Getter for property <I>https://w3id.org/cwl/salad#default</I><BR>
257
   * <BLOCKQUOTE>
258
   * The default value for this parameter to use if either there is no
259
   * `source` field, or the value produced by the `source` is `null`.  The
260
   * default must be applied prior to scattering or evaluating `valueFrom`.
261
   *    * </BLOCKQUOTE>
262
   */
263

264
  public java.util.Optional<Object> getDefault() {
265
    return this.default_;
×
266
  }
267

268
  private Object valueFrom;
269

270
  /**
271
   * Getter for property <I>https://w3id.org/cwl/cwl#WorkflowStepInput/valueFrom</I><BR>
272
   * <BLOCKQUOTE>
273
   * To use valueFrom, [StepInputExpressionRequirement](#StepInputExpressionRequirement) must
274
   * be specified in the workflow or workflow step requirements.
275
   * 
276
   * If `valueFrom` is a constant string value, use this as the value for
277
   * this input parameter.
278
   * 
279
   * If `valueFrom` is a parameter reference or expression, it must be
280
   * evaluated to yield the actual value to be assigned to the input field.
281
   * 
282
   * The `self` value in the parameter reference or expression must be
283
   * 1. `null` if there is no `source` field
284
   * 2. the value of the parameter(s) specified in the `source` field when this
285
   * workflow input parameter **is not** specified in this workflow step&#x27;s `scatter` field.
286
   * 3. an element of the parameter specified in the `source` field when this workflow input
287
   * parameter **is** specified in this workflow step&#x27;s `scatter` field.
288
   * 
289
   * The value of `inputs` in the parameter reference or expression must be
290
   * the input object to the workflow step after assigning the `source`
291
   * values, applying `default`, and then scattering.  The order of
292
   * evaluating `valueFrom` among step input parameters is undefined and the
293
   * result of evaluating `valueFrom` on a parameter must not be visible to
294
   * evaluation of `valueFrom` on other parameters.
295
   *    * </BLOCKQUOTE>
296
   */
297

298
  public Object getValueFrom() {
299
    return this.valueFrom;
×
300
  }
301

302
  /**
303
   * Used by {@link org.commonwl.cwlsdk.cwl1_2.utils.RootLoader} to construct instances of WorkflowStepInputImpl.
304
   *
305
   * @param __doc_            Document fragment to load this record object from (presumably a
306
                              {@link java.util.Map}).
307
   * @param __baseUri_        Base URI to generate child document IDs against.
308
   * @param __loadingOptions  Context for loading URIs and populating objects.
309
   * @param __docRoot_        ID at this position in the document (if available) (maybe?)
310
   * @throws ValidationException If the document fragment is not a {@link java.util.Map}
311
   *                             or validation of fields fails.
312
   */
313
  public WorkflowStepInputImpl(
314
      final Object __doc_,
315
      final String __baseUri_,
316
      LoadingOptions __loadingOptions,
317
      final String __docRoot_) {
318
    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
1✔
319
    // Prefix plumbing variables with '__' to reduce likelihood of collision with
320
    // generated names.
321
    String __baseUri = __baseUri_;
1✔
322
    String __docRoot = __docRoot_;
1✔
323
    if (!(__doc_ instanceof java.util.Map)) {
1✔
324
      throw new ValidationException("WorkflowStepInputImpl called on non-map");
×
325
    }
326
    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
1✔
327
    final java.util.List<ValidationException> __errors =
1✔
328
        new java.util.ArrayList<ValidationException>();
329
    if (__loadingOptions != null) {
1✔
330
      this.loadingOptions_ = __loadingOptions;
1✔
331
    }
332
    String id;
333

334
    if (__doc.containsKey("id")) {
1✔
335
      try {
336
        id =
1✔
337
            LoaderInstances
338
                .uri_StringInstance_True_False_None_None
339
                .loadField(__doc.get("id"), __baseUri, __loadingOptions);
1✔
340
      } catch (ValidationException e) {
×
341
        id = null; // won't be used but prevents compiler from complaining.
×
342
        final String __message = "the `id` field is not valid because:";
×
343
        __errors.add(new ValidationException(__message, e));
×
344
      }
1✔
345

346
    } else {
347
      id = null;
×
348
    }
349

350
    if (id == null) {
1✔
UNCOV
351
      if (__docRoot != null) {
×
NEW
352
        id = __docRoot;
×
353
      } else {
NEW
354
        throw new ValidationException("Missing id");
×
355
      }
356
    }
357
    __baseUri = (String) id;
1✔
358
    Object source;
359

360
    if (__doc.containsKey("source")) {
1✔
361
      try {
362
        source =
1✔
363
            LoaderInstances
364
                .uri_union_of_NullInstance_or_StringInstance_or_array_of_StringInstance_False_False_2_None
365
                .loadField(__doc.get("source"), __baseUri, __loadingOptions);
1✔
366
      } catch (ValidationException e) {
×
367
        source = null; // won't be used but prevents compiler from complaining.
×
368
        final String __message = "the `source` field is not valid because:";
×
369
        __errors.add(new ValidationException(__message, e));
×
370
      }
1✔
371

372
    } else {
373
      source = null;
1✔
374
    }
375
    java.util.Optional<LinkMergeMethod> linkMerge;
376

377
    if (__doc.containsKey("linkMerge")) {
1✔
378
      try {
379
        linkMerge =
1✔
380
            LoaderInstances
381
                .optional_LinkMergeMethod
382
                .loadField(__doc.get("linkMerge"), __baseUri, __loadingOptions);
1✔
383
      } catch (ValidationException e) {
×
384
        linkMerge = null; // won't be used but prevents compiler from complaining.
×
385
        final String __message = "the `linkMerge` field is not valid because:";
×
386
        __errors.add(new ValidationException(__message, e));
×
387
      }
1✔
388

389
    } else {
390
      linkMerge = null;
1✔
391
    }
392
    java.util.Optional<PickValueMethod> pickValue;
393

394
    if (__doc.containsKey("pickValue")) {
1✔
395
      try {
396
        pickValue =
×
397
            LoaderInstances
398
                .optional_PickValueMethod
399
                .loadField(__doc.get("pickValue"), __baseUri, __loadingOptions);
×
400
      } catch (ValidationException e) {
×
401
        pickValue = null; // won't be used but prevents compiler from complaining.
×
402
        final String __message = "the `pickValue` field is not valid because:";
×
403
        __errors.add(new ValidationException(__message, e));
×
404
      }
×
405

406
    } else {
407
      pickValue = null;
1✔
408
    }
409
    java.util.Optional<Boolean> loadContents;
410

411
    if (__doc.containsKey("loadContents")) {
1✔
412
      try {
413
        loadContents =
1✔
414
            LoaderInstances
415
                .optional_BooleanInstance
416
                .loadField(__doc.get("loadContents"), __baseUri, __loadingOptions);
1✔
417
      } catch (ValidationException e) {
×
418
        loadContents = null; // won't be used but prevents compiler from complaining.
×
419
        final String __message = "the `loadContents` field is not valid because:";
×
420
        __errors.add(new ValidationException(__message, e));
×
421
      }
1✔
422

423
    } else {
424
      loadContents = null;
1✔
425
    }
426
    java.util.Optional<LoadListingEnum> loadListing;
427

428
    if (__doc.containsKey("loadListing")) {
1✔
429
      try {
430
        loadListing =
×
431
            LoaderInstances
432
                .optional_LoadListingEnum
433
                .loadField(__doc.get("loadListing"), __baseUri, __loadingOptions);
×
434
      } catch (ValidationException e) {
×
435
        loadListing = null; // won't be used but prevents compiler from complaining.
×
436
        final String __message = "the `loadListing` field is not valid because:";
×
437
        __errors.add(new ValidationException(__message, e));
×
438
      }
×
439

440
    } else {
441
      loadListing = null;
1✔
442
    }
443
    java.util.Optional<String> label;
444

445
    if (__doc.containsKey("label")) {
1✔
446
      try {
447
        label =
×
448
            LoaderInstances
449
                .optional_StringInstance
450
                .loadField(__doc.get("label"), __baseUri, __loadingOptions);
×
451
      } catch (ValidationException e) {
×
452
        label = null; // won't be used but prevents compiler from complaining.
×
453
        final String __message = "the `label` field is not valid because:";
×
454
        __errors.add(new ValidationException(__message, e));
×
455
      }
×
456

457
    } else {
458
      label = null;
1✔
459
    }
460
    java.util.Optional<Object> default_;
461

462
    if (__doc.containsKey("default")) {
1✔
463
      try {
464
        default_ =
1✔
465
            LoaderInstances
466
                .optional_CWLObjectType
467
                .loadField(__doc.get("default"), __baseUri, __loadingOptions);
1✔
468
      } catch (ValidationException e) {
×
469
        default_ = null; // won't be used but prevents compiler from complaining.
×
470
        final String __message = "the `default` field is not valid because:";
×
471
        __errors.add(new ValidationException(__message, e));
×
472
      }
1✔
473

474
    } else {
475
      default_ = null;
1✔
476
    }
477
    Object valueFrom;
478

479
    if (__doc.containsKey("valueFrom")) {
1✔
480
      try {
481
        valueFrom =
1✔
482
            LoaderInstances
483
                .union_of_NullInstance_or_StringInstance_or_ExpressionLoader
484
                .loadField(__doc.get("valueFrom"), __baseUri, __loadingOptions);
1✔
485
      } catch (ValidationException e) {
×
486
        valueFrom = null; // won't be used but prevents compiler from complaining.
×
487
        final String __message = "the `valueFrom` field is not valid because:";
×
488
        __errors.add(new ValidationException(__message, e));
×
489
      }
1✔
490

491
    } else {
492
      valueFrom = null;
1✔
493
    }
494
    if (!__errors.isEmpty()) {
1✔
495
      throw new ValidationException("Trying 'RecordField'", __errors);
×
496
    }
497
    this.id = (String) id;
1✔
498
    this.source = (Object) source;
1✔
499
    this.linkMerge = (java.util.Optional<LinkMergeMethod>) linkMerge;
1✔
500
    this.pickValue = (java.util.Optional<PickValueMethod>) pickValue;
1✔
501
    this.loadContents = (java.util.Optional<Boolean>) loadContents;
1✔
502
    this.loadListing = (java.util.Optional<LoadListingEnum>) loadListing;
1✔
503
    this.label = (java.util.Optional<String>) label;
1✔
504
    this.default_ = (java.util.Optional<Object>) default_;
1✔
505
    this.valueFrom = (Object) valueFrom;
1✔
506
    for (String field:__doc.keySet()) {
1✔
507
      if (!attrs.contains(field)) {
1✔
508
        if (field.contains(":")) {
×
509
          String expanded_field = __loadingOptions.expandUrl(field, "", false, false, null);
×
510
          extensionFields_.put(expanded_field, __doc.get(field));
×
511
        }
512
      }
513
    }
1✔
514
  }
1✔
515
  private java.util.List<String> attrs = java.util.Arrays.asList("id", "source", "linkMerge", "pickValue", "loadContents", "loadListing", "label", "default", "valueFrom");
1✔
516
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc