-
Notifications
You must be signed in to change notification settings - Fork 172
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
[FIX] Enable format validation in validating BIDS schemas #2077
base: master
Are you sure you want to change the base?
[FIX] Enable format validation in validating BIDS schemas #2077
Conversation
7597bb7
to
f8043f5
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2077 +/- ##
==========================================
+ Coverage 82.92% 83.07% +0.14%
==========================================
Files 17 17
Lines 1511 1524 +13
==========================================
+ Hits 1253 1266 +13
Misses 258 258 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There aren't any changes to the schema or metaschema being proposed, so I don't see how this addresses the stated problem. I note that this is having problems with the schema in |
You are right. This PR doesn't correct the problems in the BIDS schema. It only ensures subsequent validations of the BIDS schemas are done with format validation enabled. I don't think I am the right person to correct any existing problems in the BIDS schema at this point. |
I ran Given that you're not fixing the regexes, shouldn't the goal be for this PR be for CI to fail until they're fixed? I have a patch that will fix the regexes, but it doesn't make much sense to apply it before we have a test that fails. |
(Clicked the wrong comment button.) |
You are right. The errors are result of 'regular expression interpretation in "pattern", "patternProperties", and "format": "regex" usages now uses unicode-mode JS regular expressions by default' in (tmp) ➜ tmp check-jsonschema --regex-variant python --schemafile metaschema.json schema.json
ok -- validation done
(tmp) ➜ tmp check-jsonschema --regex-variant nonunicode --schemafile metaschema.json schema.json
ok -- validation done
I just tried using the There is an existing test that tests the validation of the BIDS schema against the metaschema, Though the observed errors that initiated this PR are no longer applicable. I still think the changes in this PR should be included since without them format validation would not run at all in validation of BIDS schemas. |
They are still applicable:
That's why I was hoping we could get to the point of having them appear before I fixed them, so we know the check works. |
I will give it another shot, possibly sometime next week though. |
This func returns a jsonschema validator that is bound to the meta schema for validating BIDS schemas. Format validation is enabled in this validator. Additionally, the validator is cached.
This schema validator have format validation enabled which is needed to correctly validate a BIDS schema against the meta schema
To make format validation available in the `jsonschema` package, the `format` extra must be included. See https://python-jsonschema.readthedocs.io/en/latest/validate/#validating-formats for more details.
2b64162
to
280ac9a
Compare
The stable version of
schema.json
fails to validate against the stable version ofmetaschema.json
if format validation is enabled.Specifically, running
check-jsonschema --schemafile metaschema.json schema.json
produces the following outputwhere
check-jsonschema
is at0.31.2
, and by default, it validates with format validation enabled.My guess is that BIDS schemas are intended to be validated against the meta schema with format validation enabled. This PR provides a solution to ensure validations of BIDS schemas are done with format validation enabled. Specifically, this PR includes the following changes.
format
extra in thejsonschema
package as a dependency to enable format validation when using the package. (See https://python-jsonschema.readthedocs.io/en/latest/validate/#validating-formats for details)