-
Notifications
You must be signed in to change notification settings - Fork 169
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
[INFRA] Introduce metaschema #1787
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1787 +/- ##
==========================================
+ Coverage 87.79% 87.92% +0.13%
==========================================
Files 16 16
Lines 1360 1375 +15
==========================================
+ Hits 1194 1209 +15
Misses 166 166 ☔ View full report in Codecov by Sentry. |
depends on #1790 |
phew, sorry about all the commits here. It's ready for another round of review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK so if I read this correclty the schema gets validated in CI wiht the metaschema, so the latter won't get out of synch.
Do you think you could add a couple of line of doc about all this?
Made a few small changes that were easier to do than suggest. Please have a look and let me know if you disagree. |
@@ -0,0 +1 @@ | |||
../../../../src/metaschema.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gets resolved by setuptools during sdist
build, so it's safe to use a symlink here.
) as file: | ||
file.write(str(e)) | ||
# ValidationError does not have an add_note method yet | ||
# e.add_note(f"See {file.name} for full error log.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently this is a 3.11+ builtin:
https://docs.python.org/3/library/exceptions.html#BaseException.add_note
It would be nice to display. Not sure if there's a way to hack this until 3.11 is our minimum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good with me. thanks @bendichter
@bendichter Please add yourself to https://github.com/bids-standard/bids-specification/wiki/Recent-Contributors if you aren't already on the contributors list. |
This PR contains:
metaschema.json
: A json schema document that specifies the entire schema languagevalidate_schema.py
: code for loading the schema, dereferencing it, and validating against the metaschemaWhen I started this at the meeting in Seattle I did not expect the metaschema to be >700 lines, but there it is. I used definitions a bit to make it more concise. It's possible this could benefit from more definitions.