@@ -91,6 +91,115 @@ An implementation may formally validate the structure of a CWL document using
91
91
SALAD schemas located at
92
92
https://github.com/common-workflow-language/common-workflow-language/tree/master/v1.1.0-dev1
93
93
94
+ ### ` map<> `
95
+
96
+ The "type: ` array<ComplexType> | map<key_field, ComplexType> ` " syntax in the CWL
97
+ specifications means there are two or more ways to write the given value.
98
+
99
+ Option one is a array and is the most verbose option.
100
+ In our example here we use the generic` ComplexType ` , but
101
+ in reality it would be one of ` InputRecordField ` , ` OutputRecordField ` ,
102
+ ` CommandInputRecordField ` , ` SoftwarePackage ` , ` CommandInputParameter ` ,
103
+ ` CommandOutputParamter ` , ` EnvironmentDef ` , ` WorkflowStepInput ` ,
104
+ ` WorkflowInputParameter ` , ` WorkflowOutputParameter ` , ` WorkflowStep ` ,
105
+ ` ExpressionToolOutputParameter ` , or a specific ` *Requirement ` entry.
106
+
107
+ Generic example:
108
+ ```
109
+ some_cwl_field:
110
+ - key_field: a_complex_type1
111
+ field2: foo
112
+ field3: bar
113
+ - key_field: a_complex_type2
114
+ field2: foo2
115
+ field3: bar2
116
+ ```
117
+
118
+ Specific example using [ Workflow.inputs] ( Workflow.html#InputParameter )
119
+ ```
120
+ inputs:
121
+ - id: workflow_input01
122
+ type: string
123
+ - id: workflow_input02
124
+ type: File
125
+ format: http://edamontology.org/format_2572
126
+ ```
127
+
128
+ Option two is enabled by the ` map<…> ` syntax. Instead of an array of entries we
129
+ use a mapping, where one field of the ` ComplexType ` (here named ` key_field ` )
130
+ becomes the key in the map, and its value is the rest of the ` ComplexType ` .
131
+
132
+ Generic example:
133
+ ```
134
+ some_cwl_field:
135
+ a_complex_type1: # this was the "key_field" from above
136
+ field2: foo
137
+ field3: bar
138
+ a_complex_type2:
139
+ field2: foo2
140
+ field3: bar2
141
+ ```
142
+
143
+ Specific example using [ Workflow.inputs] ( Workflow.html#InputParameter )
144
+ ```
145
+ inputs:
146
+ workflow_input01:
147
+ type: string
148
+ workflow_input02:
149
+ type: File
150
+ format: http://edamontology.org/format_2572
151
+ ```
152
+
153
+ Sometimes we have a third and even more compact option denoted like this:
154
+ "type: ` array<ComplexType> | map<key_field, field2 | ComplexType> ` "
155
+
156
+ For this example, if we only need the ` key_field ` and ` field2 ` when specifying
157
+ our ` ComplexType ` s (because the other fields are optional and we are fine with
158
+ their default values) then we can abbreviate.
159
+
160
+ Here's the generic example:
161
+ ```
162
+ some_cwl_field:
163
+ a_complex_type1: foo # we accept the default value for field3
164
+ a_complex_type2: foo2 # we accept the default value for field3
165
+ ```
166
+
167
+ Specific example using [ Workflow.inputs] ( Workflow.html#InputParameter )
168
+ ```
169
+ inputs:
170
+ workflow_input01: string
171
+ workflow_input02: File # we accept the default of no File format
172
+ ```
173
+
174
+
175
+ What if some entries we want to mix the option 2 and 3? You can!
176
+
177
+ Generic example:
178
+ ```
179
+ some_cwl_field:
180
+ my_complex_type1: foo # we accept the default value for field3
181
+ my_complex_type2:
182
+ field2: foo2
183
+ field3: bar2 # we did not accept the default value for field3
184
+ # so we had to use the slightly expanded syntax
185
+ ```
186
+
187
+ Specific example using [ Workflow.inputs] ( Workflow.html#InputParameter )
188
+ ```
189
+ inputs:
190
+ workflow_input01: string
191
+ workflow_input02: # we use the longer way
192
+ type: File # because we want to specify the format too
193
+ format: http://edamontology.org/format_2572
194
+ ```
195
+
196
+
197
+ Note: The ` map<…> ` version is optional, the verbose option #1 is always allowed,
198
+ but for presentation reasons option 3 and 2 may be preferred by human readers.
199
+
200
+ Another explanation, aimed at implementors, is in the
201
+ [ Schema Salad specification] ( SchemaSalad.html#Identifier_maps ) .
202
+
94
203
## Identifiers
95
204
96
205
If an object contains an ` id ` field, that is used to uniquely identify the
0 commit comments