Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have filenameIdentify use datasetContext to determine which filename rules to use. #1939

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bids-validator/src/schema/applyRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function applyRules(
rootSchema = schema
}
if (!schemaPath) {
schemaPath = 'schema'
schemaPath = 'schema.rules'
}
Object.assign(context, expressionFunctions)
// @ts-expect-error
Expand Down
1 change: 1 addition & 0 deletions bids-validator/src/schema/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export class BIDSContext implements Context {
if (this.extension !== '.tsv') {
return
}

this.columns = await this.file
.text()
.then((text) => parseTSV(text))
Expand Down
6 changes: 6 additions & 0 deletions bids-validator/src/validators/filenameIdentify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ export async function filenameIdentify(schema, context) {
function findRuleMatches(schema, context) {
const schemaPath = 'rules.files'
Object.keys(schema[schemaPath]).map((key) => {
if (
key == 'deriv' &&
context.dataset.dataset_description.DatasetType != 'derivative'
) {
return
}
const path = `${schemaPath}.${key}`
_findRuleMatches(schema[path], path, context)
})
Expand Down
Loading