microsoft / microsoft/monaco-editor
[Bug] Monaco bundles outdated vscode-json-languageservice causing Draft 2020-12 schema errors in browser
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
Reproducible in vscode.dev or in VS Code Desktop?
- Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
- Not reproducible in the monaco editor playground
Monaco Editor Playground Link
Monaco Editor Playground Code
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
validate: true,
schemas: [{
uri: "https://json-schema.org/draft/2020-12/schema",
fileMatch: ["*"],
}]
});
monaco.editor.create(document.getElementById("container"), {
value: JSON.stringify({
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object"
}, null, 2),
language: "json"
});
Reproduction Steps
- Open the Monaco Editor Playground.
- Set the JSON diagnostics to use the Draft 2020-12 meta-schema URI.
- Create a JSON file using that $schema.
- Observe the validation markers.
Actual (Problematic) Behavior
Monaco 0.55.1 bundles vscode-json-languageservice@5.3.11.
When editing JSON schemas using Draft 2020-12, the editor:
- attempts to fetch the meta-schema in the browser, resulting in
No schema request service available - emits
$dynamicRefwarnings that were removed in newer language service versions
Expected Behavior
Monaco should bundle a version of vscode-json-languageservice that includes the Draft 2020-12 fixes (>= 5.6.3), as already shipped in VS Code, so that:
- the Draft 2020-12 meta-schema is bundled locally
- the
$dynamicRefwarning is removed - no remote schema fetch is attempted in browser environments
Additional Context
This is caused by the version of vscode-json-languageservice currently bundled in Monaco (v0.55.1 uses v5.3.11).
The fixes for native Draft 2020-12 support (including the bundled flat schema and warning removal) were implemented in vscode-json-languageservice v5.6.3 (see PRs 294(https://github.com/microsoft/vscode-json-languageservice/pull/294) and 295( https://github.com/microsoft/vscode-json-languageservice/pull/295 ) in that repository).
This issue was identified during development for the JSON Schema Organization (see: json-schema-org/tour#103). Upgrading this dependency will significantly improve the experience for anyone using modern JSON Schema drafts in standalone Monaco environments.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Monaco's dependency declaration for vscode-json-languageservice and reproduce the supplied Monaco Editor Playground example. Done means the bundled version is at least 5.6.3, Draft 2020-12 is handled locally, and the browser no longer reports a missing schema request service or the obsolete $dynamicRef warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- devtools, frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100