bids-standard / legacy-validator

Validator for the Brain Imaging Data Structure
https://bids-standard.github.io/legacy-validator/
MIT License
186 stars 111 forks source link

FIX: Disable strictSchema for legacy validator JSON schema validation #2148

Closed rwblair closed 1 month ago

rwblair commented 1 month ago

Pinning to old version of AJV maybe the better path here, not sure.

effigies commented 1 month ago

Do we want to push a beta or something release to npm to test?

rwblair commented 1 month ago

Sure

effigies commented 1 month ago

Pinning to old version of AJV maybe the better path here

That's a technical debt time bomb, so I wouldn't unless we absolutely must.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 87.55%. Comparing base (0a2530b) to head (434733d). Report is 3 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2148 +/- ## ========================================== + Coverage 85.73% 87.55% +1.82% ========================================== Files 91 133 +42 Lines 3785 7006 +3221 Branches 1220 1657 +437 ========================================== + Hits 3245 6134 +2889 - Misses 454 777 +323 - Partials 86 95 +9 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

rwblair commented 1 month ago

Published this branch as bids-validator@1.14.14-dev.0 under the devel tag. Can unpublish once we're done with it.

effigies commented 1 month ago

Seems to work:

1.14.13

❯ npx bids-validator@1.14.13 7t_trt
Need to install the following packages:
bids-validator@1.14.13
Ok to proceed? (y) y

npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
bids-validator@1.14.13
(node:184342) Warning: Closing directory handle on garbage collection
(Use `node --trace-warnings ...` to show where the warning was created)
Unhandled rejection (
  reason: Error: strict mode: unknown keyword: "dependency-definitions"
    at checkStrictMode (/home/chris/.npm/_npx/a6114692d52a75f8/node_modules/bids-validator/dist/commonjs/cli.js:89219:15)
    at checkUnknownRules (/home/chris/.npm/_npx/a6114692d52a75f8/node_modules/bids-validator/dist/commonjs/cli.js:89092:11)
    at checkKeywords (/home/chris/.npm/_npx/a6114692d52a75f8/node_modules/bids-validator/dist/commonjs/cli.js:90443:36)
    at validateFunctionCode (/home/chris/.npm/_npx/a6114692d52a75f8/node_modules/bids-validator/dist/commonjs/cli.js:90346:9)
    at Ajv2.compileSchema (/home/chris/.npm/_npx/a6114692d52a75f8/node_modules/bids-validator/dist/commonjs/cli.js:90944:45)
    at Ajv2._compileSchemaEnv (/home/chris/.npm/_npx/a6114692d52a75f8/node_modules/bids-validator/dist/commonjs/cli.js:92601:35)
    at Ajv2.compile (/home/chris/.npm/_npx/a6114692d52a75f8/node_modules/bids-validator/dist/commonjs/cli.js:92309:37)
    at validateSchema (/home/chris/.npm/_npx/a6114692d52a75f8/node_modules/bids-validator/dist/commonjs/cli.js:104315:28)
    at checkUnits (/home/chris/.npm/_npx/a6114692d52a75f8/node_modules/bids-validator/dist/commonjs/cli.js:104231:28)
    at json_default2 (/home/chris/.npm/_npx/a6114692d52a75f8/node_modules/bids-validator/dist/commonjs/cli.js:104223:30)
).

1.14.14-dev.0

❯ npx bids-validator@1.14.14-dev.0 7t_trt
Need to install the following packages:
bids-validator@1.14.14-dev.0
Ok to proceed? (y) y

npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
bids-validator@1.14.14-dev.0
(node:224887) Warning: Closing directory handle on garbage collection
(Use `node --trace-warnings ...` to show where the warning was created)
    1: [ERR] This file is too small to contain the minimal NIfTI header. (code: 36 - NIFTI_TOO_SMALL)
        ./sub-01/ses-1/anat/sub-01_ses-1_T1map.nii.gz
        ./sub-01/ses-1/anat/sub-01_ses-1_T1w.nii.gz
        ./sub-01/ses-1/fmap/sub-01_ses-1_run-1_magnitude1.nii.gz
        ./sub-01/ses-1/fmap/sub-01_ses-1_run-1_magnitude2.nii.gz
        ./sub-01/ses-1/fmap/sub-01_ses-1_run-1_phasediff.nii.gz
        ./sub-01/ses-1/fmap/sub-01_ses-1_run-2_magnitude1.nii.gz
        ./sub-01/ses-1/fmap/sub-01_ses-1_run-2_magnitude2.nii.gz
        ./sub-01/ses-1/fmap/sub-01_ses-1_run-2_phasediff.nii.gz
        ./sub-01/ses-1/func/sub-01_ses-1_task-rest_acq-fullbrain_run-1_bold.nii.gz
        ./sub-01/ses-1/func/sub-01_ses-1_task-rest_acq-fullbrain_run-2_bold.nii.gz
        ... and 429 more files having this issue (Use --verbose to see them all).

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

    2: [ERR] Empty files not allowed. (code: 99 - EMPTY_FILE)
        ./sub-01/ses-1/anat/sub-01_ses-1_T1map.nii.gz
        ./sub-01/ses-1/anat/sub-01_ses-1_T1w.nii.gz
        ./sub-01/ses-1/fmap/sub-01_ses-1_run-1_magnitude1.nii.gz
        ./sub-01/ses-1/fmap/sub-01_ses-1_run-1_magnitude2.nii.gz
        ./sub-01/ses-1/fmap/sub-01_ses-1_run-1_phasediff.nii.gz
        ./sub-01/ses-1/fmap/sub-01_ses-1_run-2_magnitude1.nii.gz
        ./sub-01/ses-1/fmap/sub-01_ses-1_run-2_magnitude2.nii.gz
        ./sub-01/ses-1/fmap/sub-01_ses-1_run-2_phasediff.nii.gz
        ./sub-01/ses-1/func/sub-01_ses-1_task-rest_acq-fullbrain_run-1_bold.nii.gz
        ./sub-01/ses-1/func/sub-01_ses-1_task-rest_acq-fullbrain_run-2_bold.nii.gz
        ... and 429 more files having this issue (Use --verbose to see them all).

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

    1: [WARN] Not all subjects contain the same files. Each subject should contain the same number of files with the same naming unless some files are known to be missing. (code: 38 - INCONSISTENT_SUBJECTS)
        ./sub-13/ses-1/fmap/sub-13_ses-1_run-1_magnitude2.nii.gz
            Evidence: Subject: sub-13; Missing file: sub-13_ses-1_run-1_magnitude2.nii.gz
        ./sub-19/ses-1/func/sub-19_ses-1_task-rest_acq-fullbrain_run-2_physio.tsv.gz
            Evidence: Subject: sub-19; Missing file: sub-19_ses-1_task-rest_acq-fullbrain_run-2_physio.tsv.gz
        ./sub-19/ses-1/func/sub-19_ses-1_task-rest_acq-prefrontal_physio.tsv.gz
            Evidence: Subject: sub-19; Missing file: sub-19_ses-1_task-rest_acq-prefrontal_physio.tsv.gz

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

    2: [WARN] Tabular file contains custom columns not described in a data dictionary (code: 82 - CUSTOM_COLUMN_WITHOUT_DESCRIPTION)
        ./participants.tsv
            Evidence: Columns: number_of_scans_before, handedness not defined, please define in: /participants.json
        ./sub-01/ses-1/sub-01_ses-1_scans.tsv
            Evidence: Columns: positive, negative, future, past, myself, people, surroundings, vigilance, images, words, specific_vague, intrusive not defined, please define in: /scans.json, /sub-01/sub-01_scans.json,/sub-01/ses-1/sub-01_ses-1_scans.json
        ./sub-01/ses-2/sub-01_ses-2_scans.tsv
            Evidence: Columns: positive, negative, future, past, myself, people, surroundings, vigilance, images, words, specific_vague, intrusive not defined, please define in: /scans.json, /sub-01/sub-01_scans.json,/sub-01/ses-2/sub-01_ses-2_scans.json
        ./sub-01/sub-01_sessions.tsv
            Evidence: Columns: CCPT_avg_succ_RT, CCPT_avg_FP_RT, CCPT_avg_FN_RT, CCPT_succ_count, CCPT_FP_count, CCPT_FN_count, subject_id, panas_cheerful, panas_disgusted, panas_attentive, panas_bashful, panas_sluggish, panas_daring, panas_surprised, panas_strong, panas_scornful, panas_relaxed, panas_irritable, panas_delighted, panas_inspired , panas_fearless, panas_disgusted_with_self, panas_sad, panas_calm, panas_afraid, panas_tired, panas_amazed, panas_shaky, panas_happy, panas_timid, panas_alone, panas_alert, panas_upset, panas_angry, panas_bold, panas_blue, panas_shy, panas_active, panas_guilty, panas_joyful, panas_nervous, panas_lonely, panas_sleepy, panas_excited, panas_hostile, panas_proud, panas_jittery, panas_lively, panas_ashamed, panas_at_ease, panas_scared, panas_drowsy, panas_angry_at_self, panas_enthusiastic, panas_downhearted, panas_sheepish, panas_distressed, panas_blameworthy, panas_determined, panas_frightened, panas_astonished, panas_interested, panas_loathing, panas_confident, panas_energetic, panas_concentrating, panas_dissatisfied_with_self, hours_of_sleep_ussually, hours_of_sleep_last_night, vigilance, quality_of_sleep, thirst, liters_of_water_daily, relative_water_intake, caffeine_daily, relative_caffeine_intake, systolic_blood_pressure_left, diastolic_blood_pressure_left, pulse_left, systolic_blood_pressure_right, diastolic_blood_pressure_right, pulse_right, positive, negative, future, past, myself, people, surroundings, vigilance_nyc-q, images, words, specific_vague, intrusive not defined, please define in: /sessions.json, /sub-01/sub-01_sessions.json
        ./sub-02/ses-1/sub-02_ses-1_scans.tsv
            Evidence: Columns: positive, negative, future, past, myself, people, surroundings, vigilance, images, words, specific_vague, intrusive not defined, please define in: /scans.json, /sub-02/sub-02_scans.json,/sub-02/ses-1/sub-02_ses-1_scans.json
        ./sub-02/ses-2/sub-02_ses-2_scans.tsv
            Evidence: Columns: positive, negative, future, past, myself, people, surroundings, vigilance, images, words, specific_vague, intrusive not defined, please define in: /scans.json, /sub-02/sub-02_scans.json,/sub-02/ses-2/sub-02_ses-2_scans.json
        ./sub-02/sub-02_sessions.tsv
            Evidence: Columns: CCPT_avg_succ_RT, CCPT_avg_FP_RT, CCPT_avg_FN_RT, CCPT_succ_count, CCPT_FP_count, CCPT_FN_count, subject_id, panas_cheerful, panas_disgusted, panas_attentive, panas_bashful, panas_sluggish, panas_daring, panas_surprised, panas_strong, panas_scornful, panas_relaxed, panas_irritable, panas_delighted, panas_inspired , panas_fearless, panas_disgusted_with_self, panas_sad, panas_calm, panas_afraid, panas_tired, panas_amazed, panas_shaky, panas_happy, panas_timid, panas_alone, panas_alert, panas_upset, panas_angry, panas_bold, panas_blue, panas_shy, panas_active, panas_guilty, panas_joyful, panas_nervous, panas_lonely, panas_sleepy, panas_excited, panas_hostile, panas_proud, panas_jittery, panas_lively, panas_ashamed, panas_at_ease, panas_scared, panas_drowsy, panas_angry_at_self, panas_enthusiastic, panas_downhearted, panas_sheepish, panas_distressed, panas_blameworthy, panas_determined, panas_frightened, panas_astonished, panas_interested, panas_loathing, panas_confident, panas_energetic, panas_concentrating, panas_dissatisfied_with_self, hours_of_sleep_ussually, hours_of_sleep_last_night, vigilance, quality_of_sleep, thirst, liters_of_water_daily, relative_water_intake, caffeine_daily, relative_caffeine_intake, systolic_blood_pressure_left, diastolic_blood_pressure_left, pulse_left, systolic_blood_pressure_right, diastolic_blood_pressure_right, pulse_right, positive, negative, future, past, myself, people, surroundings, vigilance_nyc-q, images, words, specific_vague, intrusive not defined, please define in: /sessions.json, /sub-02/sub-02_sessions.json
        ./sub-03/ses-1/sub-03_ses-1_scans.tsv
            Evidence: Columns: positive, negative, future, past, myself, people, surroundings, vigilance, images, words, specific_vague, intrusive not defined, please define in: /scans.json, /sub-03/sub-03_scans.json,/sub-03/ses-1/sub-03_ses-1_scans.json
        ./sub-03/ses-2/sub-03_ses-2_scans.tsv
            Evidence: Columns: positive, negative, future, past, myself, people, surroundings, vigilance, images, words, specific_vague, intrusive not defined, please define in: /scans.json, /sub-03/sub-03_scans.json,/sub-03/ses-2/sub-03_ses-2_scans.json
        ./sub-03/sub-03_sessions.tsv
            Evidence: Columns: CCPT_avg_succ_RT, CCPT_avg_FP_RT, CCPT_avg_FN_RT, CCPT_succ_count, CCPT_FP_count, CCPT_FN_count, subject_id, panas_cheerful, panas_disgusted, panas_attentive, panas_bashful, panas_sluggish, panas_daring, panas_surprised, panas_strong, panas_scornful, panas_relaxed, panas_irritable, panas_delighted, panas_inspired , panas_fearless, panas_disgusted_with_self, panas_sad, panas_calm, panas_afraid, panas_tired, panas_amazed, panas_shaky, panas_happy, panas_timid, panas_alone, panas_alert, panas_upset, panas_angry, panas_bold, panas_blue, panas_shy, panas_active, panas_guilty, panas_joyful, panas_nervous, panas_lonely, panas_sleepy, panas_excited, panas_hostile, panas_proud, panas_jittery, panas_lively, panas_ashamed, panas_at_ease, panas_scared, panas_drowsy, panas_angry_at_self, panas_enthusiastic, panas_downhearted, panas_sheepish, panas_distressed, panas_blameworthy, panas_determined, panas_frightened, panas_astonished, panas_interested, panas_loathing, panas_confident, panas_energetic, panas_concentrating, panas_dissatisfied_with_self, hours_of_sleep_ussually, hours_of_sleep_last_night, vigilance, quality_of_sleep, thirst, liters_of_water_daily, relative_water_intake, caffeine_daily, relative_caffeine_intake, systolic_blood_pressure_left, diastolic_blood_pressure_left, pulse_left, systolic_blood_pressure_right, diastolic_blood_pressure_right, pulse_right, positive, negative, future, past, myself, people, surroundings, vigilance_nyc-q, images, words, specific_vague, intrusive not defined, please define in: /sessions.json, /sub-03/sub-03_sessions.json
        ... and 57 more files having this issue (Use --verbose to see them all).

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

    3: [WARN] The Authors field of dataset_description.json should contain an array of fields - with one author per field. This was triggered because there are no authors, which will make DOI registration from dataset metadata impossible. (code: 113 - NO_AUTHORS)

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

    4: [WARN] The recommended file /README is very small. Please consider expanding it with additional information about the dataset. (code: 213 - README_FILE_SMALL)
        ./README

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

        Summary:                  Available Tasks:        Available Modalities:
        732 Files, 73.86KB        Rest                    MRI
        22 - Subjects
        2 - Sessions