question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SchemaLoader downloads external resources

See original GitHub issue

My application includes a local copy of the JSON schema metaschema, which looks like this:

{
    "id": "http://json-schema.org/draft-04/schema#",
    "$schema": "http://json-schema.org/draft-04/schema#",

Now when SchemaLoader is instructed to load this schema (from a local file), it attempts to fetch the resource given by the URL in the id property.

In a certain installation, my application is supposed to work offline, so this HTTP request is intercepted by the firewall, leading to an exception.

When I remove the "id" property, SchemaLoader does not attempt to fetch that resource.

I believe that this behavior is wrong, as per the following text in the JSON Schema spec (emphasis mine):

http://json-schema.org/latest/json-schema-core.html#rfc.section.8

The URI is not a network locator, only an identifier. A schema need not be downloadable from the address if it is a network-addressable URL, and implementations SHOULD NOT assume they should perform a network operation when they encounter a network-addressable URI.

http://json-schema.org/latest/json-schema-core.html#rfc.section.9.2.2

To differentiate schemas between each other in a vast ecosystem, schemas are identified by URI. As specified above, this does not necessarily mean anything is downloaded, but instead JSON Schema implementations SHOULD already understand the schemas they will be using, including the URIs that identify them.

Also, I wonder why the "id" property gets any special treatment: unless I’m mistaken, the spec assigns no specific meaning to this property, only to the "$id" property.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
erosbcommented, Oct 14, 2018

Hello @JakimLi , thanks for your kind words.

The process to deploy an artifact to the central repository is simpler now as it used to be, so I published the latest version as com.github.erosb:everit-json-schema:1.9.2 . I’d still like to keep jitpack as the primary distibution channel though.

0reactions
erosbcommented, May 24, 2019

Hello @raphw , currently we distribute the library on maven central too, though it lags a bit behind the jitpack version. The latest coordinates are com.github.erosb:everit-json-schema:1.9.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

SchemaLoader
org.apache.directory.server.core.configuration. Interface SchemaLoader ... Can be implemented by classes wishing to load schemas dynamically at server startup ( ...
Read more >
How to validate the JSON response with expected JSON ...
I have swagger JSON schema URL, when I get JSON response from the server, I need to validate with the JSON schema to...
Read more >
capability.policy.mailnews.SchemaLoader ... - ADMX Help
Registry Hive, HKEY_LOCAL_MACHINE. Registry Path, Software\Policies\Mozilla\lockPref. Value Name, capability.policy.mailnews.SchemaLoader.
Read more >
Chapter 177. JSON Schema Validator Component
schemaLoader (advanced). To use a custom schema loader allowing for adding custom format validation. The default implementation will create a schema loader with ......
Read more >
Releases - Apache Xerces
Re-built, "XML Commons External" and "XML Commons Resolver" codebases (which ... Xerces-J was previously not building from sources when Java 9+ was used....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found