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.

[json] External schemas referenced from schema not updated

See original GitHub issue

Issue Type

Bug

Description

Setup

color-schema.json

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  
  "validColors": {
    "enum": ["Red"]
  }
}

schema.json

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

  "type": "object",
  "properties": {
    "color": { "$ref": "color-schema.json#/validColors" }
  },
  "required": ["color"]
}

test.json

{
  "$schema": "./schema.json",
  "color": "Red"
}

Test 1: Intellisense notices changes in schema.json

Rename the property color to colorx in schema.json -> (Desired) error in test.json: Missing property "colorx".

✔️ That work’s!

Test 2: Intellisense does not notice changes in color-schema.json

Change Red to Yellow in color-schema.json -> no errors!

Restarting VSCode finally gives the desired error in test.json: Value is not accepted. Valid values: "Yellow".

❌ That doesn’t work! (i. e. at least without restarting VSCode after each schema dependency change)

VS Code Info

VS Code version: Code 1.20.1 (f88bbf9137d24d36d968ea6b2911786bfe103002, 2018-02-13T15:31:21.019Z) OS version: Linux x64 4.13.0-36-generic

System Info
Item Value
CPUs Intel® Core™ i5-5200U CPU @ 2.20GHz (4 x 2194)
Load (avg) 1, 1, 1
Memory (System) 7.71GB (1.54GB free)
Process Argv /usr/share/code/code --unity-launch
Screen Reader no
VM 0%
Extensions (6)
Extension Author (truncated) Version
calculate aca 2.0.0
QML bbe 1.0.0
Kotlin mat 1.5.0
cpptools ms- 0.15.0
vetur oct 0.11.7
enumerator swi 0.0.6
Reproduces without extensions

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
Logerfocommented, Oct 23, 2020

Any update on this topic?

2reactions
ehawman-rosenbergcommented, May 6, 2022

@Logerfo Hello from the future. They added an option called “JSON: Clear schema cache” which does the trick now.

image

The best part is that this is just one of many threads on this subject, none of which mentions this “screw it, just reset it yourselves” fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

json - Resolver error when referencing external schema files
The error message is referencing the schema in "pet-full.schema.json", which you did not include here. – Ether. Oct 18, 2021 at 22:43.
Read more >
Structuring a complex schema
It's possible to reference an external subschema, but generally you want to limit a $ref to referencing either an external schema or an...
Read more >
Combining schemas
You can structure your validation logic across multiple schema files and have schemas reference each other using $ref keyword. Example:.
Read more >
Loading Schemas
A JSON schema can reference external schemas. External references are typically a URL that points to where the external schema is publically hosted...
Read more >
JSON Schema Bundling Finally Formalised
Ultimate source of truth matters, and it's often the JSON Schemas. Many tools don't support referencing external resources.
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