Skip to content

Enhancement request: provide specific documentation on how to make schema validation use only local files #1308

Description

@rohan0rtiz0

I want to make Schema validation use only local files on the filesystem, even if the "$id" field has an HTTP URL. (So that my script doesn't continuously hit the website.) I can't figure out how to do that based on the current documentation. My request is that you include documentation about how to perform this specific type of usage.

(Note: local-file-only validation works for me with check-jsonschema --base-uri ., but because the check-jsonschema code is too object-oriented and complicated, I can't figure out how to do the same thing with just.

Also note: ChatGPT has absorbed only the older RefResolver approach, which gives a deprecation warning. (Probably from places like StackOverflow where old reference to that from 2019 are the top hit.). And it's not able to figure out / help me with doing this the right way either.)

Activity

  1. Julian commented on Oct 23, 2024

    @Julian
    Member

    Hi there -- within this library, or as far as referencing.Registry is concerned, nothing will make an HTTP request unless you yourself have done so, so there's not much to document. It's possible you're using something downstream of this library where you're making HTTP requests, e.g. the jsonschema library will do so for backwards compatibility reasons until version 5 is released, but will emit a warning if you rely on this behavior (and it sounds like you're using check-jsonschema, so you may want to consult there instead.

  2. rohan0rtiz0 commented on Oct 23, 2024

    @rohan0rtiz0
    Author

    Hello and thanks for the quick reply. I was specifically using jsonschema validate() in my own python script. I was concerned that if I filed this ticket against jsonschema it would be said that the correct solution is to use referencing since that's what the deprecation warning says. I only mention check-jsonschema because it's an example of having something that documents how to stop network lookup. Should this instead be re-filed as a documentation request against jsonschema?

  3. Julian commented on Oct 23, 2024

    @Julian
    Member

    Got it, then the docs you should have a look at are here -- specifically as long as you provide your own referencing.Registry, no HTTP requests are made -- that's specifically called out at the bottom here.

  4. locked and limited conversation to collaborators on Oct 23, 2024
  5. converted this issue into a discussion #1309 on Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions