diff --git a/bids-validator/src/setup/options.ts b/bids-validator/src/setup/options.ts index 34fb03944..76aa10f1d 100644 --- a/bids-validator/src/setup/options.ts +++ b/bids-validator/src/setup/options.ts @@ -3,6 +3,7 @@ import type { LevelName } from '@std/log' import { Command, EnumType } from '@cliffy/command' import { getVersion } from '../version.ts' import type { Issue, Severity } from '../types/issues.ts' +import { schema } from '@bids/schema' /** * BIDS Validator config file object definition @@ -31,7 +32,7 @@ export type ValidatorOptions = { } const modalityType = new EnumType( - ['MRI', 'PET', 'MEG', 'EEG', 'iEEG', 'Microscopy', 'NIRS', 'MRS'], + Object.keys(schema.rules.modalities) ) /** Extendable Cliffy Command with built in BIDS validator options */ diff --git a/bids-validator/src/validators/bids.ts b/bids-validator/src/validators/bids.ts index 4f5b8cc20..c51b94855 100644 --- a/bids-validator/src/validators/bids.ts +++ b/bids-validator/src/validators/bids.ts @@ -18,6 +18,7 @@ import { type BIDSContext, BIDSContextDataset } from '../schema/context.ts' import type { parseOptions } from '../setup/options.ts' import { hedValidate } from './hed.ts' import { citationValidate } from './citation.ts' +import { logger } from '../utils/logger.ts' /** * Ordering of checks to apply @@ -121,8 +122,12 @@ export async function validate( // Map blacklisted datatypes back to the modality that generated them for (const modality of options.blacklistModalities) { const datatypes = modalitiesRule[modality.toLowerCase()]?.datatypes as string[] - for (const datatype of datatypes) { - blacklistedDatatypes.set(datatype, modality) + if (datatypes) { + for (const datatype of datatypes) { + blacklistedDatatypes.set(datatype, modality) + } + } else { + logger.warn(`Attempted to blacklist unknown modality: ${modality}`) } } }