Skip to content

Conversation

@ryanobjc
Copy link

Schema sets are sometimes entirely on disk, and we don't want to visit the network, or perhaps the URI doesn't even load. This function will allow the program to parse and store schemas.

Schema sets are sometimes entirely on disk, and we don't want to visit
the network, or perhaps the URI doesn't even load.  This function will
allow the program to parse and store schemas.
@fisxoj
Copy link
Owner

fisxoj commented Jul 13, 2024

Thanks for the PR!

I've been trying to think about this and how I'd like it to fit with the API in general. Do you mind sharing how you use it? Are you only adding a single schema or would it be more useful if you could add many files?

@ryanobjc
Copy link
Author

My code works something like this:

(defun load-all-schemas (&optional (path-pattern "~/json-schemas/**/*.json"))
  (json-schema.reference:with-context (*context*)
    (loop for p in (directory path-pattern)
          do (json-schema.reference:store-reference (json-schema.parse:parse p)))))

something like that.

In my case, the schemas I'm working with aren't formally published so it's impossible to retrieve them from the URIs provided. I have about 30 files here.

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.

2 participants