-
Notifications
You must be signed in to change notification settings - Fork 57
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
Initial validate support, with --strict option #142
Closed
Closed
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
ef746b1
Initial validate support, with --warnings option
will-moore ace592a
Add jsonschema to deps in setup.py
will-moore 7d26157
Copy schemas from ngff. Use LocalRefResolver to load schemas
will-moore 145b938
Add validation tests to test_cli.py
will-moore 4888698
Add jsonschema to requirements-test.txt
will-moore a20c8aa
Fix jsonschema dependency
will-moore 7520081
Remove .DS_Store files
will-moore cbd4ee6
Add .DS_Store to .gitignore
will-moore f0683a6
Use latest schema version by default
will-moore d093cda
Use logging instead of print
will-moore 33298bd
Move top-level /schemas to ome_zarr/schemas
will-moore 4c28024
remove get_strict_schema(). use get_schema(strict)
will-moore b388a3a
fix duplicate validate()
will-moore 674ebb7
Import schemas from ngff
will-moore 7b3ab42
Delete schemas
will-moore e380451
Merge remote-tracking branch 'origin/master' into validate_json_schema
will-moore d301229
Update to use 'ome_ngff' package
will-moore c37e116
visit(path: str, func: callable)
will-moore c1ed016
Remove use of ngff repo. Use cached_path instead
will-moore 9ccebe0
Merge remote-tracking branch 'origin/master' into validate_json_schema
will-moore e3abc33
Remove ome_ngff dependency
will-moore 5fef946
Add cached_path to dependencies in environment.yml
will-moore 3ad5315
Rename --warnings to --strict. Support Plate and Well
will-moore 5fcfe94
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 6774922
Update test to use --strict
will-moore 2bbce18
Support --clear_cache argument for validate
will-moore 96961bd
Replace spec.get_schema() with SCHEMA_NAME
will-moore c03b0a0
Use format.get_metadata_version(data) to get version
will-moore File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,6 @@ var | |
build | ||
dist/ | ||
target/ | ||
*.DS_Store | ||
*/.DS_Store | ||
docs/build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
In addition to logging errors at a WARN level, what is the expected contract of
self.validate(strict=True)
if the JSON does not meet the strict schema? Should an error be thrown?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.
As in #142 (comment) above, I'm thinking of separating the reporting of errors from the validation itself. So, the cli
validate
command can log or print errors, but theSpec.validate()
andutils.validate()
would only return errors / messages (and maybe log at INFO level)?It could get tricky to give the user an accurate picture of what failed: eg. when you validate an Image with Labels, the
image
schema is used for both, so you can get an output like this and it's hard to know which object was missing "name":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.
In the spirit of
jsonschema.validate
vsjsonschema.iter_errors
, I concur with the idea of having an API that returns an iterable of all exceptions.Will the contract be the same for the default and the strict schemas? In the current implementation, the base schema raises an exception but the strict schema does not.
Also I assume since the strict schema extends the base schema, it is not necessary to have 2 validation calls?