-
Notifications
You must be signed in to change notification settings - Fork 122
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
Implement validation #139
Merged
Merged
Implement validation #139
Conversation
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
Reading http and https can be accomplished via the stdlib; enable it in the STAC_IO.default_read_text_method and remove the override from the unittests.
Also import it into the top level package, so users can use as `pystac.STACObjectType`.
This makes it easier to pass information along to methods that need to work on serialized versions of the object. This was implemented in preperation of the `validate` method on STACObject
simonkassel
requested changes
Aug 13, 2020
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.
We discussed this in person. I think just one change to validate moethods and some minor bug fixes, otherwise looks good.
Also remove the test version of SchemaValidator and move to the core PySTAC implementation in all unit tests.
This makes installing jsonschema along with PySTAC optional, keeping PySTAC lightweight for users that don't need validation.
Also fix up some API docs for pystac.serialization
lossyrob
force-pushed
the
feature/rde/validation
branch
from
August 14, 2020 02:33
984ade9
to
2167a47
Compare
simonkassel
approved these changes
Aug 14, 2020
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR implements validation in PySTAC.
Catalog
,Collection
andItem
have avalidate()
method that will validate their serialized versions against STAC schema json hosted at https://schemas.stacspec.org/. There's also apystac.validation.validate_json
method that can validate STAC from earlier versions, back to 0.6.0.The design of this feature allows for users to write their own implementations of
STACValidator
and register it with PySTAC via thepystac.validation.set_validator
method. Users can also override theDefaultSchemaUriMap
to provide custom mappings between STAC object types and extensions to schema URIs.This feature requires
jsonschema
to be installed if using the default validator. This can be accomplished by specifying the 'validation' extras on install:Also included in this PR is moving the
urllib
capability for readinghttp
andhttps
URIs from the unit tests to the default implementations inSTAC_IO
, and so allowinghttp
andhttps
STAC to be read by default without a custom read implementation.Fixes #118