Skip to content

Commit

Permalink
FIX: Compile correct metadata definition
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Jul 29, 2024
1 parent aaaff98 commit 675c62d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bids-validator/src/schema/applyRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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}`
Expand Down

0 comments on commit 675c62d

Please sign in to comment.