21317: overflow now toggles on and off at the same pixel Arvados-DCO-1.1-Signed-off...
[arvados.git] / services / workbench2 / src / components / workflow-inputs-form / validators.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { CommandInputParameter } from 'models/workflow';
6 import { require } from 'validators/require';
7 import { CWLType } from '../../models/workflow';
8
9
10 const alwaysValid = () => undefined;
11
12 export const required = ({ type }: CommandInputParameter) => {
13     if (type instanceof Array) {
14         for (const t of type) {
15             if (t === CWLType.NULL) {
16                 return alwaysValid;
17             }
18         }
19     }
20     return require;
21 };