json-schema-validator icon indicating copy to clipboard operation
json-schema-validator copied to clipboard

Support for non-existent $id URLs?

Open davidpricedev opened this issue 3 years ago • 3 comments

My json-schema has $ids that aren't "real" urls that can be requested. I also use json-schema bundling.

It seems this library doesn't support bundled schemas - at least it doesn't follow the $ref to the $defs - it still tries to make requests out to the web to fetch the $ids of the items that are in the $defs section.

I've been able to work around this sort of limitation in other libraries by one of these tactics:

  • pre-loading all the individual json-schema documents into an internal storage provided by the library
  • changing out the document fetching with a custom component that can do a file-system lookup

Does this library support either of those options? I've had a look through the docs and looked around a bit in the code too, but nothing is jumping out at me.

davidpricedev avatar Feb 28 '22 16:02 davidpricedev

@davidpricedev I am wondering if you could submit a PR with a test case to reproduce the issue? I need to see what is your schema and what is your json. We are using the bundler all the time and there is no issue at all. We have an openapi-bundler in the networknt organization.

stevehu avatar Feb 28 '22 16:02 stevehu

@stevehu thanks for taking a look. I have a PR out now with a reproduction of the issue.

davidpricedev avatar Feb 28 '22 21:02 davidpricedev

Any progress on this? I'm stuck with the issue. Can't seem to hack a workaround.

claussni avatar Sep 01 '22 11:09 claussni