Skip to content

Docs on resolver are out of date #189

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

Closed
samskiter opened this issue Nov 6, 2014 · 3 comments
Closed

Docs on resolver are out of date #189

samskiter opened this issue Nov 6, 2014 · 3 comments

Comments

@samskiter
Copy link

Does not check the store first, but stores the retrieved document in the store if :attr:RefResolver.cache_remote is True.

In fact, by the time this has been called, the store has already been checked.

To help anyone out here, our approach is to make 1 resolver for the whole app and pass the constructor an empty string and none for the first two args and then hand it a handler. like so:

resolver = jsonschema.RefResolver("", None)

This resolver will then fetch and cache any schema that are ref'd. If we share this instance of resolver across all our validate calls when we will share the cache too.

@Julian
Copy link
Member

Julian commented Nov 6, 2014

Hm, if I understand what you mean, this is correct, but obviously confusing. It's true, that method (which is public, and callable), does not check the store. Validators, when using ref resolvers though, go via a path that will check the store and then call that method, but that docstring is documentation for that particular method. Suggestions welcome on how to clarify that.

@samskiter
Copy link
Author

I think the confusion arose from reading the docs here:

http://python-jsonschema.readthedocs.org/en/latest/references/

I wasn't sure whether the intention was to overload that method to resolve remotes locally. (in fact the way to do this is to use a handler or init with a dict).

Maybe just remove the reference to the store. Or maybe bundle the store check into this method so it does everything related to resolving a remote ref? (where "remote" means: "not in this current schema file")

@Julian
Copy link
Member

Julian commented Dec 7, 2014

There's definitely a need for some clearer ref docs -- I've very slightly clarified the wording here, but hopefully once we have those stuff like this will be a bit clearer.

@Julian Julian closed this as completed Dec 7, 2014
Julian added a commit that referenced this issue Nov 5, 2017
9567c58 Merge pull request #189 from blackivory86/uri_formats
1066f7f Merge pull request #192 from furstenheim/master
0b71ddd Update README.md
82db537 Merge pull request #191 from korzio/master
1aecb7b feat(const): Add validation tests for arrays
b9d4dbd set unique descriptions for test-cases
aaa3ef7 adds more valid and invalid URI testcases
728066f Merge pull request #188 from json-schema-org/sequences-and-objects
c47341a Flesh out some more ignore cases for object validators.
f339360 make test descriptions unique and no longer than 60 chars
6820a83 Merge branch 'CroniD-master'
aaa32d8 test: update "json-pointer" format to exclude fragments
85a552f added some more tests for json-pointer format
b7b79fc extended tests for json-pointer format

git-subtree-dir: json
git-subtree-split: 9567c588bc9d1705b4840ee9d9f3f268f40c1e68
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

No branches or pull requests

2 participants