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

deno: could --schema be made to take src/schema yaml tree as input? #1946

Closed
yarikoptic opened this issue Apr 19, 2024 · 5 comments
Closed

Comments

@yarikoptic
Copy link
Contributor

Somewhat a continuation to #1930 . For development purposes it would be easier if I could just point to src/schema of the bids-specification instead of requiring to "compile" schema.org using python tooling. I thought I even saw within bids-validator functionality to load schema from yamls but I could be wrong. My attempt though didn't work out:

❯ bids-validator-deno ds000246/ --schema file:///home/yoh/proj/bids/bids-specification-master/src/schema
TypeError: Is a directory (os error 21)
    at async loadSchema (file:///home/yoh/proj/bids/bids-validator/bids-validator/src/setup/loadSchema.ts:21:26)
    at async validate (file:///home/yoh/proj/bids/bids-validator/bids-validator/src/validators/bids.ts:37:18)
    at async main (file:///home/yoh/proj/bids/bids-validator/bids-validator/src/main.ts:16:24)
    at async file:///home/yoh/proj/bids/bids-validator/bids-validator/src/bids-validator.ts:3:1 {
  code: "ERR_MODULE_NOT_FOUND"
}
Warning, could not load schema from file:///home/yoh/proj/bids/bids-specification-master/src/schema, falling back to internal version
...

although works for the .json:

❯ bids-validator-deno ds000246/ --schema file:///home/yoh/proj/bids/bids-specification-master/src/schema.json
	[WARNING] Task scans should have a corresponding 'events.tsv' file.
...
but only using that `-deno` executor on top of `.ts` and not direct one over the "compiled" JS version -- which is the https://github.com//issues/1943
❯ bids-validator ds000246/ --schema file:///home/yoh/proj/bids/bids-specification-master/src/schema.json
TypeError: Attempted to load JSON module without specifying "type": "json" attribute in the import statement.
    at async loadSchema (file:///tmp/bids-validator/bids-validator.js:8513:26)
    at async validate (file:///tmp/bids-validator/bids-validator.js:9254:18)
    at async main (file:///tmp/bids-validator/bids-validator.js:9458:24)
    at async file:///tmp/bids-validator/bids-validator.js:9479:1 {
  code: "ERR_MODULE_NOT_FOUND"
}
Warning, could not load schema from file:///home/yoh/proj/bids/bids-specification-master/src/schema.json, falling back to internal version
	[WARNING] Task scans should have a corresponding 'events.tsv' file.
If this is a resting state scan you can ignore this warning or rename the task to include the word "rest".
 (EVENTS_TSV_MISSING)

		./sub-0001/meg/sub-0001_task-AEF_run-01_channels.tsv
			Evidence: schema.rules.checks.events.EventsMissing
		./sub-0001/meg/sub-0001_task-AEF_run-02_channels.tsv
			Evidence: schema.rules.checks.events.EventsMissing
		./sub-0001/meg/sub-0001_task-AEF_run-01_meg.json
			Evidence: schema.rules.checks.events.EventsMissing

		6 more files with the same issue

	Please visit https://neurostars.org/search?q=EVENTS_TSV_MISSING for existing conversations about this issue.


          Summary:                         Available Tasks:        Available Modalities:
          18 Files, 171 kB                 AEF                     MEG                  
          2 - Subjects 1 - Sessions        noise                   MRI                  

	If you have any questions, please post on https://neurostars.org/tags/bids.

❯ bids-validator -V
v1.14.6-dev.0-9-gdc61d0f3.deno
@effigies
Copy link
Collaborator

We did write the Python tooling to do the dereferencing once and spit out the result, to avoid having to implement it consistently. You're welcome to reimplement it, but we should add tests that ensure that the Javascript implementation doesn't diverge from the Python one.

@yarikoptic
Copy link
Contributor Author

if it is not implemented, I guess fine with me. I just saw

bids-validator/src/setup/loadSchema.test.ts:Deno.test('schema yaml loader', async (t) => {

and assumed that it was but may be just not interfaced. If you confirm that the machinery is not actually here or should not be used -- we can just forget that I asked ;)

@effigies
Copy link
Collaborator

I don't think it is, but @rwblair or @nellh might say otherwise. We certainly have fixed up the Python implementation a couple times...

@nellh
Copy link
Member

nellh commented Apr 20, 2024

I did write a direct yaml loader at first but it couldn't load the current schema or do all of the dereferencing required, that would all need to be implemented still.

@yarikoptic
Copy link
Contributor Author

ok, let's then consider it not there and not needed for now ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants