From 675c62de7d49c538194cfbc1f37f3e5b987c38e2 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Mon, 29 Jul 2024 18:43:10 -0400 Subject: [PATCH] FIX: Compile correct metadata definition --- bids-validator/src/schema/applyRules.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bids-validator/src/schema/applyRules.ts b/bids-validator/src/schema/applyRules.ts index 950f83c55..d3a123b64 100644 --- a/bids-validator/src/schema/applyRules.ts +++ b/bids-validator/src/schema/applyRules.ts @@ -414,8 +414,9 @@ function evalJsonCheck( ): void { for (const [key, requirement] of Object.entries(rule.fields)) { const severity = getFieldSeverity(requirement, context) + const metadataDef = schema.objects.metadata[key]; // @ts-expect-error - const keyName: string = schema.objects.metadata[key].name; + const keyName: string = metadataDef.name; if (severity && severity !== "ignore" && !(keyName in context.sidecar)) { if (requirement.issue?.code && requirement.issue?.message) { context.issues.add({ @@ -453,7 +454,7 @@ function evalJsonCheck( } // @ts-expect-error - const validate = context.dataset.ajv.compile(schema.objects.metadata[keyName]) + const validate = context.dataset.ajv.compile(metadataDef) const result = validate(context.sidecar[keyName]) if (result === false) { const evidenceBase = `Failed for this file.key: ${originFileKey} Schema path: ${schemaPath}`