From: Peter Amstutz Date: Thu, 11 May 2023 18:23:52 +0000 (-0400) Subject: 20493: isArrayOfType handles union type (optional) arrays X-Git-Tag: 2.6.2^2 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/e11a6fa13214f91ffc602e53574736174ca6e8e9 20493: isArrayOfType handles union type (optional) arrays Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- diff --git a/src/models/workflow.ts b/src/models/workflow.ts index e85dce7a..59b81a1d 100644 --- a/src/models/workflow.ts +++ b/src/models/workflow.ts @@ -185,10 +185,13 @@ export const isPrimitiveOfType = (input: GenericCommandInputParameter, : input.type === type; export const isArrayOfType = (input: GenericCommandInputParameter, type: CWLType) => - typeof input.type === 'object' && - input.type.type === 'array' - ? input.type.items === type - : false; + input.type instanceof Array + ? (input.type.filter(t => typeof t === 'object' && + t.type === 'array' && + t.items === type).length > 0) + : (typeof input.type === 'object' && + input.type.type === 'array' && + input.type.items === type); export const stringifyInputType = ({ type }: CommandInputParameter) => { if (typeof type === 'string') {