bids-standard / bids-specification

Brain Imaging Data Structure (BIDS) Specification
https://bids-specification.readthedocs.io/
Creative Commons Attribution 4.0 International
279 stars 163 forks source link

implement 'bst validate' #1367

Open yarikoptic opened 1 year ago

yarikoptic commented 1 year ago

Your idea

There is already

❯ bst export --help
Usage: bst export [OPTIONS]

  Export BIDS schema to JSON document

Options:
  --schema TEXT
  --output TEXT
  --help         Show this message and exit.

which is used https://github.com/bids-standard/bids-specification/blob/ada2c5d445f1c0eab306e7a0d691e1889f1ffe4c/readthedocs.yml#L8-L9 .

Next command IMHO should be validate [--schema PATH] PATH(s) which would do basic validation of the PATH(s). If no --schema specified -- should validate against schema corresponding to the BIDS version found in the dataset in the PATH. Could get that version from https://github.com/bids-standard/bids-schema/ or may be loaded from .json representation as made available from a single file like https://bids-specification.readthedocs.io/en/v1.8.0/schema.json .

Unlikely it is feasible to compete with implementation in bids-validator, but could be at least basic validation of path filenames for now.

effigies commented 1 year ago

It occurs to me that we might want to make --schema an argument to any command.

bst [--schema PATH] {export,validate} ...
effigies commented 1 year ago

https://github.com/bids-standard/bids-specification/blob/master/tools/schemacode/bidsschematools/__main__.py

TheChymera commented 1 year ago

so do we want to integrate the validator into the bst CLI? I had a separate repo for that which I thought would serve best in the interest of keeping bst as small as possible to justify its continued co-development with the schema.