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 6b61737
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bids-validator/src/schema/applyRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@ function evalJsonCheck(
for (const [key, requirement] of Object.entries(rule.fields)) {
const severity = getFieldSeverity(requirement, context)
// @ts-expect-error
const keyName: string = schema.objects.metadata[key].name;
const metadataDef = schema.objects.metadata[key];
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 @@ -452,8 +453,7 @@ function evalJsonCheck(
return
}

// @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 6b61737

Please sign in to comment.