Skip to content

Make it easier to create ref resolvers that don't do any remote lookup #693

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
jaredgrubb opened this issue May 26, 2020 · 3 comments
Closed
Labels
Enhancement Some new desired functionality

Comments

@jaredgrubb
Copy link

I enjoy using the $ref stuff (and $id) but I really never want my validators to actually access the network. I used a RefResolver instance to map some schemas together, but I can't figure out how to permanently disable actual network access (and only use the local store provided).

I looked through the sources and didn't see anything obviously. If this is already possible, maybe it'd be worth a FAQ entry or something?

@Julian Julian added the Enhancement Some new desired functionality label Jun 3, 2020
@Julian
Copy link
Member

Julian commented Jun 6, 2020

It's possible, though not easily and not in a great way. Doing so more easily is part of python-jsonschema/referencing#3. Happy to keep this open as a way to track the request individually though, it's a common request to make this easier. The test suite for this library itself in fact needs this to ensure it doesn't make remote requests while running.

@Julian Julian changed the title Enhancement: option to forbid network traffic Make it easier to create ref resolvers that don't do any remote lookup Jul 1, 2020
@willson-chen
Copy link
Contributor

@jaredgrubb Maybe the PR #717 could solve your problem.

Julian added a commit that referenced this issue Aug 5, 2022
This is obviously non-ideal, and hits the same issue #693 asks
to fix.
@Julian
Copy link
Member

Julian commented Feb 23, 2023

Hello there!

This, along with many many other $ref-related issues, is now finally being handled in #1049 with the introduction of a new referencing library which is fully compliant and has APIs which I hope are a lot easier to understand and customize.

The next release of jsonschema (v4.18.0) will contain a merged version of that PR, and should be released shortly in beta, and followed quickly by a regular release, assuming no critical issues are reported.

The new APIs do not have this bad behavior -- they don't make HTTP requests by default!

If you still care to, I'd love it if you tried out the beta once it is released, or certainly it'd be hugely helpful to immediately install the branch containing this work (https://github.com/python-jsonschema/jsonschema/tree/referencing) and confirm. You can in the interim find documentation for the change in a preview page here.

I'm going to close this given it indeed seems like it is addressed by #1049, but feel free to follow up with any comments. Sorry for the delay in getting to these, but hopefully this new release will bring lots of benefit!

@Julian Julian closed this as completed Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Some new desired functionality
Projects
None yet
Development

No branches or pull requests

3 participants