-
Notifications
You must be signed in to change notification settings - Fork 0
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
refactor: schema validation #1
refactor: schema validation #1
Conversation
446b86c
to
5a79977
Compare
3af4407
to
6f099b5
Compare
The previous version would actually require an argument.
6f099b5
to
133fe34
Compare
@vyasr This is ready for 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.
Thanks Simon! This is a definite improvement. The use of references is very helpful. I do worry a little bit about some of the reference names being too generic and overlapping (for instance, Requirement vs Requirements given that they're used in different package lists, or that Matrices is not an array of Matrix). It might be better to use longer, more precise names at the expense of brevity. I'm also OK with waiting to rename until we put the PR into the main branch up for review, though, so that we can get a fresh set of eyes on it.
@@ -0,0 +1,160 @@ | |||
{ | |||
"$schema": "http://json-schema.org/draft-07/schema#", | |||
"$id": "https://raw.githubusercontent.com/rapidsai/dependency-file-generator/v1.0.0/src/rapids_dependency_file_generator/schema.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.
Just FYI, due to the use of semantic-release
in maintaining this package, I think the merge of this PR will immediately make this link out of date since the sha won't be v1.0.0 but instead v1.1.0 (assuming we treat this PR as a new feature). We'll need to update this URL accordingly when we merge my PR into the main branch.
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.
Could we automatically update this URL to match the release version?
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.
@ajschmidt8 you have more familiarity with what we can do with semantic-release
, do you have any recommendations on how we could handle this? Specifically, what we want is for the version number in the "$id"
URL to be updated to match the current version during a release. My concern was that the PR to update the version number would itself trigger a new version, thus immediately rendering the version in the URL out of date.
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.
@vyasr, @csadorf, yes. we can do that with https://github.com/semantic-release/git.
We'll have to figure out how to configure it, but it will commit "release assets" back to the repository (with a [skip ci]
tag) after a release has occurred.
In this case, schema.json
would be categorized as a "release asset" since it depends on the release version.
src/rapids_dependency_file_generator/rapids_dependency_file_validator.py
Show resolved
Hide resolved
@csadorf I have one other request with this PR. Could you modify some of the test dependencies.yaml files to invalidate them and show some examples of the output? I am not sure how the refactoring of the schema into components affects the generated error output, and I want to make sure that it's still readable and user-friendly for RAPIDS devs who need to modify dependencies.yaml files without having any knowledge of jsonschema. It's fine for developers of dfg to need to know how this works, but I wouldn't want to reduce the readability of the error output for others. I assume this isn't an issue (or if it is, it's one we can mitigate), just want to confirm. |
I ran some tests and here is an example for the new error message:
And the way it would look like previously:
The header message is the same and while the context is maybe slightly more obfuscated, I think it is actually more readable and it is easier to understand the context of the error. |
I agree, in this case it seems more readable. If there error was one level deeper in the |
I replaced one of the dependencies with a number (should be a string) and it is not:
But I am not convinced that simply following all validator = jsonschema.Draft7Validator(SCHEMA)
print(best_match(validator.iter_errors(dependencies))) will yield
The |
@vyasr This should be ready for another review iteration. |
I wasn't aware of |
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.
These changes look great! I'm going to go ahead and merge this now, and we can handle any follow-ups in the PR merging my branch into the main repo.
No description provided.