From e11a6fa13214f91ffc602e53574736174ca6e8e9 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Thu, 11 May 2023 14:23:52 -0400 Subject: [PATCH] 20493: isArrayOfType handles union type (optional) arrays Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- src/models/workflow.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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') { -- 2.30.2