Skip to content
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

Extend dynamicRef keyword #886

Merged
merged 1 commit into from
Jan 14, 2022
Merged

Conversation

nezhar
Copy link
Contributor

@nezhar nezhar commented Nov 30, 2021

The description in https://stackoverflow.com/a/69774520/5382179 helped me better understand how the keyword should actually work and the PR extends the missing parts of the current implementation of the keyword.

There might be a better way to implement this, but it would require bigger changes in the way the scopes and the validator functions are handled.

@codecov
Copy link

codecov bot commented Nov 30, 2021

Codecov Report

Merging #886 (12c791e) into main (eed6d8b) will increase coverage by 0.15%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #886      +/-   ##
==========================================
+ Coverage   96.90%   97.05%   +0.15%     
==========================================
  Files          20       20              
  Lines        3259     3290      +31     
  Branches      446      457      +11     
==========================================
+ Hits         3158     3193      +35     
+ Misses         79       77       -2     
+ Partials       22       20       -2     
Impacted Files Coverage Δ
jsonschema/tests/test_jsonschema_test_suite.py 82.35% <ø> (ø)
jsonschema/_utils.py 97.61% <100.00%> (+0.56%) ⬆️
jsonschema/_validators.py 100.00% <100.00%> (+1.53%) ⬆️
jsonschema/validators.py 97.41% <100.00%> (-0.13%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eed6d8b...12c791e. Read the comment docs.

@Julian
Copy link
Member

Julian commented Dec 20, 2021

@nezhar can you have a look at resolving the conflicts here now that the performance issues with the implementation have been addressed?

@nezhar nezhar force-pushed the dynamicRef branch 2 times, most recently from ab759d5 to 2bec8b4 Compare December 21, 2021 09:53
@nezhar nezhar requested a review from Julian December 21, 2021 10:23
@Julian
Copy link
Member

Julian commented Dec 27, 2021

Thanks @nezhar. I'm about ready to merge this (sorry for the delay), but to be extra safe I'd like to re-run the benchmarks that @Stranger6667 optimized from #853 -- can you rerun the two they left in that issue there just to be sure we don't regress on them by merging this?

@Stranger6667
Copy link
Contributor

FWIW, some of the work done during ref resolving is only relevant for newer drafts (after Draft 7), so maybe as a follow-up from this PR it would be nice to explore adding some conditional logic to avoid unnecessary work (e.g. the $dynamicAnchor keyword is not a part of Draft 7, so could be skipped during resolving) for older drafts. Not sure how much benefit it would yield though

@nezhar
Copy link
Contributor Author

nezhar commented Jan 10, 2022

@Julian also sorry for the delay 🙂. I made another rebase and run the test from the linked issue. This are my results:

$ python --version; pip freeze | grep json; python test.py
Python 3.8.10
jsonschema==4.3.3
10.12309193611145 sec

$ python --version; pip freeze | grep json; python test.py
Python 3.8.10
jsonschema @ file:///home/hnezbeda/DEV/jsonschema
10.206285238265991 sec

@Julian Julian merged commit 10ad755 into python-jsonschema:main Jan 14, 2022
@Julian
Copy link
Member

Julian commented Jan 14, 2022

No worries! Will merge I think. Thanks! If you manage to figure out the remaining 2 skipped tests in draft2020 a PR would of course would be very much appreciated. So long as they still fail, my suspicion is that the implementation is still not 100% correct (even in the parts that pass), but it's definitely an improvement. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants