bids-validator
bids-validator copied to clipboard
BUG: Specify schema version with `-s "v1.6.0"` option is failing
Dear all,
I tried to use the BIDS validator 1.9.9 with the option -s "v1.6.0" to use a specific schema version. However, it is failing with the error below.
Error
Error: ENOENT: no such file or directory, open 'https://raw.githubusercontent.com/bids-standard/bids-specification/v1.6.0/src/schema/rules/top_level_files.yaml
Reason
I took some time to investigate the problem and found the cause: the rules folder was indeed created in v1.7.0 but it is not existing in v1.6.0. So, in other words, the correct paths would be for:
-
v1.7.0: -
v1.6.0:
Possible fixes
While I would be happy to help and provide a fix, but before taking the initiative, I would like to hear your feedback. Here are two easy fix options that came to my mind to make this beta feature working as expected:
- option 1: we keep
v1.6.0in the choices (in code shown for option 1 but we removerules/(code shown in option 2) - option 2: change
'v1.6.0'to'v1.7.0'in: https://github.com/bids-standard/bids-validator/blob/bdf2e72a0a51ffda49ae02384127d05d70bd757b/bids-validator/validators/options.js#L69-L74 (Updatet: it seems entities have been re-ordered alphabetically which break the correct order of the entities ingenerateRegex(), which will need to be reviewed) - option 3: add
'v1.7.0'to thechoiceslist above and add a condition in the implicated code below to create the path appropriately either for v1.6.0 or for v1.7.0 https://github.com/bids-standard/bids-validator/blob/bdf2e72a0a51ffda49ae02384127d05d70bd757b/bids-validator/validators/schemaTypes.js#L55-L71 (Update:generateRegex()will also have to be reviewed)
What do you think would make the most sense?
In the future
Note that this would work only for v1.6.0 and v1.7.0 but not for v1.8.0 and after. In these cases, the schema organization and the content of yaml files changed more dramatically (there is not anymore a top_level_files.yaml for instance), and so it seems this would require more changes. The new files and structure can be consulted directly on the main repo here.
So regarding this, would anyone have some insights about which changes in the BIDS validator need to performed to support the latest schema files?
Thanks a lot in advance and all best wishes for 2023 ✨✨✨