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

Docs: Example importing json schema from file #1054

Closed
LecrisUT opened this issue Mar 13, 2023 · 2 comments
Closed

Docs: Example importing json schema from file #1054

LecrisUT opened this issue Mar 13, 2023 · 2 comments

Comments

@LecrisUT
Copy link

LecrisUT commented Mar 13, 2023

It is not obvious how one should be importing a json schema from a local file, e.g.:

--- root
 |-- schema
   |-- schema_root.json
   |-- schema_other.json

where schema_root.json refers to schema_other.json, e.g.:

{
  "$id": "resource:/schema/schema_root.json",
  "$schema": "http://json-schema.org/draft-07/schema",
  "properties": {
    "other": {
      "$ref": "schema_other.json"
    }
}

Is it sufficient to just json.load()? How does it know the BaseRef and if it's loaded as a file or an URL?

@Julian
Copy link
Member

Julian commented Mar 13, 2023

Hi there! This is changing alongside #1049 which should be merged any day now (and then in a beta release).

Specifically it should be documented here: https://python-jsonschema--1049.org.readthedocs.build/en/1049/referencing/#making-additional-in-memory-schemas-available

Have a look and feel free to follow up if you still feel more documentation is needed for it!

@Julian Julian closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2023
@Julian
Copy link
Member

Julian commented Mar 13, 2023

(Note that so long as that branch isn't merged yet if you want to try it out you'll have to install from the branch of course.)

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