Validation with a custom BIDS schema

Summary of what happened

Hi,

I’m currently working on BIDS BEP028 (BIDS-Prov) and trying to validate datasets using a custom BIDS schema.
I run into the following error TypeError: Invalid URL: 'src/schema.json' (see below) which I do not understand.

Thanks !

Command used (and if a helper script was used, a link to the helper script or the command generated):

# Install deno
curl -fsSL https://deno.land/install.sh | sh

# Clone current version of bids-specification (commit fa2b5d8)
git clone git@github.com/bids-standard/bids-specification.git

# Install bidsschematools (from inside the bids-specification root dir)
cd bids-specification
pip install tools/schemacode/.

# Compile the schema as it is
bst -v export --schema src/schema --output src/schema.json

# Clone current version of bids-validator (commit c28e802)
cd ..
git clone git@github.com:bids-standard/bids-validator.git

# Validate a dataset using the complied schema
cd bids-specification
../bids-validator/local-run -s src/schema.json ~/dataset/

Version:

  • deno 2.2.0 (stable, release, x86_64-unknown-linux-gnu)
    v8 13.4.114.9-rusty
    typescript 5.7.3
  • bids-specification - commit fa2b5d8
  • bids-validator - commit c28e802

Environment (Docker, Singularity / Apptainer, custom installation):

Custom installation on Fedora 36
pip 24.2, python 3.10

Data formatted according to a validatable standard? Please provide the output of the validator:

Output of the validator returns an error, which actually is the reason of my post.

TypeError: Invalid URL: 'src/schema.json'
    at getSerialization (ext:deno_url/00_url.js:98:11)
    at new URL (ext:deno_url/00_url.js:405:27)
    at new Request (ext:deno_fetch/23_request.js:338:25)
    at ext:deno_fetch/26_fetch.js:371:29
    at new Promise (<anonymous>)
    at fetch (ext:deno_fetch/26_fetch.js:367:20)
    at loadSchema (file:///home/user/bids-validator/src/setup/loadSchema.ts:27:34)
    at validate (file:///home/user/bids-validator/src/validators/bids.ts:49:24)
    at main (file:///home/user/bids-validator/src/main.ts:33:30)
    at eventLoopTick (ext:core/01_core.js:177:7)
Warning, could not load schema from src/schema.json, falling back to internal version

It uses the fetch API, so a URL is required. To use relative paths, the easy approach is file://$PWD/<relpath>.

It could be updated to detect local paths and make them absolute and prefix them with file://.

Thanks, it works using a URL for the schema file.