-
Notifications
You must be signed in to change notification settings - Fork 28
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
Some general improvements / discussion #243
Some general improvements / discussion #243
Conversation
fb75fca
to
e37cf56
Compare
e37cf56
to
acffbf1
Compare
Force pushed a fix for the Mypy issues and updated existing tests as well. |
Hi @cpaulik all good ideas here :) |
d988288
to
7c60300
Compare
Thanks. Tests should hopefully pass after the latest push. I forgot a |
I'll add tests for the |
This also adds a schema property to make sure the validation message references the overridden schema and not the original one
I've added another test for making sure references to sub-schemas also are replaced by the |
Hi @cpaulik. Looks really good. Just a couple of things. 1. An explanation and an example of a schema map, how to use them, to the readme. 2. An entry in the changelog, highlighting these changes. The changes would be added under the |
Thanks, I added both. Let me know if that is what you had in mind. |
I did just discover a small bug - stac-validator doesn't seem to validate extensions for collections if |
That was just a matter of not keeping all the |
I did just find another issue. It seems in I'll fix that as well. |
The last commit should fix recursive reporting of errors for collections. I do have a question about error reporting in the recursive case. At the moment in recursive mode we could print out 100s of messages that are valid which makes it hard to find the ones that actually cause the error. |
@cpaulik You are right about recursive messaging. People may want some feedback so they can see the validation is working. An optional verbose mode for recursive would probably be the best. |
the last commit does the following in recursive mode
Exitcode is unchanged and verbose mode with no errors is also unchanged. |
I found another bug when validating a catalog with multiple child collections. Previously the |
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.
Hi. Great work here. What do you think about a config json (maybe containing key value pairs) that could be used instead of specifying numerous --schema-map pairs. It wouldn't replace what you are doing here, it would just be another option.
README.md
Outdated
default mode. | ||
-c, --custom TEXT Validate against a custom schema (local | ||
filepath or remote schema). | ||
--schema-map <TEXT TEXT>... Schema path to replaced by (local) schema path |
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.
Maybe there should be a -s option for example, to make it a little easier.
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.
Done.
tests/test_extensions.py
Outdated
"schema": [ | ||
"https://cdn.staclint.com/v1.0.0-beta.1/collection.json", | ||
], | ||
"schema": [], |
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.
It would be nice to still show the schema here that was validated against,
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.
I'm not sure actually. This is an interesting case. This test runs with extensions = True
which means only validate extensions
if I understand correctly.
The json file we validate against here has an empty list in stac_extensions
so in this case it seems correct to not validate against anything.
I've changed this to fall back on the core-validator
in this case but I would argue that at least a warning should be logged in this case.
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.
If only extensions are to be validated you are correct. Otherwise, every item validates against the relevant item spec schema by default. You can change this back if you would like.
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.
--extensions is for extensions only, so we should change this back before we merge
I think it could be useful but I would want to make that a separate MR. We could take some inspiration from the config file from stac-node-validator |
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.
Really great work here, thank you!
The config file from stac-node-validator looks really useful. A separate PR would be better. |
Thanks for merging and making a release. |
This adds three things
I'm happy to open separate MRs if one of the features is not wanted.
I'm also happy to add tests once we agree that a feature is going to be included.