-
Notifications
You must be signed in to change notification settings - Fork 13
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 index adjustment for rel json ptr #47
Conversation
It looks like the tests being run on this change are hitting the issue that PR #49 works around. |
|
Adds support for index adjustment to RelativeJSONPointer per the most recent draft, as modified by the proposed fixes at handrews/json-schema-spec@main...handrews:json-schema-spec:relptr-more-fixes
This test needed to check against the string '0' rather than the number 0. Since the review feedback changed the code to allow the empty string for the over parameter, this also reworks the default value testing to handle any combination of parameters that match their default values, including combinations with the ref parameter as a JSONPointer instance.
bafb16a
to
ab7cac4
Compare
@marksparkza I've incorporated your feedback, rebased on top of the workaround for the testing issue, and also fixed a bug I noticed in the test case for creating relative JSON pointers — |
An index adjustment needs an additional parent (the array).
Codecov ReportBase: 90.60% // Head: 90.72% // Increases project coverage by
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## main #47 +/- ##
==========================================
+ Coverage 90.60% 90.72% +0.12%
==========================================
Files 21 21
Lines 1958 1973 +15
Branches 373 378 +5
==========================================
+ Hits 1774 1790 +16
+ Misses 122 121 -1
Partials 62 62
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Ensure that evaluating a the pointer part of a Relative JSON Pointer that goes outside of the document produces an error.
Fixes #23 : Adds support for index adjustment to class
RelativeJSONPointer
per the most recent draft, as modified by recently proposed fixes that correct errors in the original wording for index adjustment.@marksparkza I've tried to match styles, but I'm perfectly happy to change formatting or wording or whatever so feel free to nitpick. I've not used type hinting in Python before so if I missed something obvious that I should have done with types it's because I don't know what I'm doing :-)
For the tests, I matched the sort of tests that were already present. I noticed some things that were not covered, such as some syntax error conditions, but I have filed those ideas as issue #48.
I started writing a tutorial page for
RelativeJSONPointer
, but decided to submit it as a separate PR.With the adjustment to hypothesis 6.0.3 per #45 , all tests run and pass on Python 3.8, 3.9, 3.10, and 3.11.
jsonpointer.py coverage HTML page header before:
jsonpointer.py coverage HTML page header after:
Test & coverage report before:
Test & coverage report after: