If you want to use a relative path to something in a workspace folder for the url property of a JSON schema setting item, you need to define that setting in the workspace settings (<workspace-folder-path>/.vscode/settings.json) instead of in the user settings. Related docs are here.

If you insist to define it in the user settings.json, I think you need to use an absolute path.

I think this is a sensible design. User settings apply to all workspaces, so if if relative paths were supported there, it would be an assumption that every single folder you open as a workspace would have a schema file that you'd want to use at such a path (presumably relative to the workspace folder, which I think would be a rather poor assumption, or lead to surprising users (in a bad way)).

Also note that if you want to specify schema files on a per-JSON-file-basis, you can use the $schema property in the JSON file you want to be validated to specify the schema to use.

Answer from starball on Stack Overflow
Discussions

visual studio code - VSCode json.schemas - run validator on command line - Stack Overflow
You can see a VSCode inline warning screenshot as an example. My question is: How can I run this custom validator through the command line? Is it possible to integrate it with ESLint or something? My end goal is to integrate it on CI/CD to run during Pull Requests and log the warnings (or even mark them as errors). ... JSON Schema ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
September 17, 2019
visual studio code - VSCode dynamic JSON schema validation - Stack Overflow
I have built project for a web application configuration. It includes generated (from TypeScript) JSONSchemas. To simplify - user can configure things like forms - field order (string[]), hidden fi... More on stackoverflow.com
๐ŸŒ stackoverflow.com
visual studio code - How does vscode support automatic json validation using https://schemastore.org/json/? - Stack Overflow
Should VSCode have automatic intellisense in JSON files? If so, how does it work? I know it works for well-known JSON files, like tsconfig.json, but what about other resources like stryker.conf.jso... More on stackoverflow.com
๐ŸŒ stackoverflow.com
How do I configure VS Code to enable code completion on .json files (jsonschema support)? - Stack Overflow
This answer is still valid! ... Good point so here is the resource to adding a schema directly to a JSON file code.visualstudio.com/docs/languages/json#_mapping-in-the-json 2019-08-08T13:23:39.853Z+00:00 ... Schema ids are just URIs. So unless VSCode can lookup the schema from some global server ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
GitHub
github.com โ€บ Karan-Palan โ€บ jsonschema-blaze-vscode
GitHub - Karan-Palan/jsonschema-blaze-vscode: High-performance JSON Schema validator and linter for VS Code powered by Blaze. ยท GitHub
A high-performance JSON Schema validator and linter for Visual Studio Code, powered by sourcemeta/jsonschema (a cli that uses sourcemeta/blaze).
Author ย  Karan-Palan
๐ŸŒ
Visual Studio Marketplace
marketplace.visualstudio.com โ€บ items
JSON Schema Diagnostics - Visual Studio Marketplace
Extension for Visual Studio Code - Validates JSON documents against schemas (up to draft/2020-12) with live diagnostics in VS Code
๐ŸŒ
GitHub
github.com โ€บ remcohaszing โ€บ vscode-schemastore
GitHub - remcohaszing/vscode-schemastore: Use the JSON Schema Store catalog for JSON schema validation. ยท GitHub
Use the JSON Schema Store catalog for JSON schema validation. - remcohaszing/vscode-schemastore
Starred by 33 users
Forked by 3 users
Languages ย  JavaScript
๐ŸŒ
Visual Studio Marketplace
marketplace.visualstudio.com โ€บ items
JSON Schema Validator Blaze - Visual Studio Marketplace
Extension for Visual Studio Code - High-performance JSON Schema validator and linter for VS Code
๐ŸŒ
Visual Studio Code
code.visualstudio.com โ€บ docs โ€บ languages โ€บ json
Editing JSON with Visual Studio Code
November 3, 2021 - We also perform structural and value verification based on an associated JSON schema giving you red squiggles. To disable validation, use the json.validate.enable Open in VS Code Open in VS Code Insiders setting.
Find elsewhere
๐ŸŒ
Visual Studio Marketplace
marketplace.visualstudio.com โ€บ items
JSON Schema 2020-12 Draft Validator - Visual Studio Marketplace
November 5, 2025 - Extension for Visual Studio Code - JSON Schema validator for Schema 2020-12 draft
๐ŸŒ
Joshuatz
docs.joshuatz.com โ€บ cheatsheets โ€บ js โ€บ json-schema
JSON Schema - Resources, Notes, and VSCode Tips | Joshua's Docs
They added something called JSON language indicator, which is an indicator / button in the bottom status bar - it shows you the current schema being used, and if you hover over it, even provides a link to open the exact schema definition files being used for validation. ๐Ÿ’ก If you want the full schema name to always be displayed in the status bar, you need to pin it. Hover over the indicator, then click the pin button. Some older (and much harder) approaches can still serve some purpose, if you are looking for lower-level info. One hard way is to built VSCode from source, and debug the JSON language service.
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 72672786 โ€บ vscode-json-schemas-run-validator-on-command-line
visual studio code - VSCode json.schemas - run validator on command line - Stack Overflow
September 17, 2019 - "json.schemas": [ { "fileMatch": ["src/super_jsons/**"], "url": "./.vscode/superJsonConfig.json" } ] It works fine on my JSON files, adding autocomplete (IntelliSense) and inline validation of the allowed properties.
๐ŸŒ
YouTube
youtube.com โ€บ code 2020
VS Code tips โ€” JSON schemas for IntelliSense - YouTube
Set the "$scheme" property in any json file to apply a schema to it. Schemas validate your json and provide IntelliSense while writing it.The "$schema" can b...
Published ย  November 15, 2020
Views ย  17K
๐ŸŒ
Netlify
nickymeuleman.netlify.app โ€บ blog โ€บ json-schema
JSON-schemas are awesome - Nicky Meuleman - Netlify
December 19, 2018 - // in VSCode workspace settings .json file (ctrl/cmd+shift+p to search for it) ... A schema doesnโ€™t need to be remote. You can also link your file of choice to a self written and/or local schema. In this json file, we point to the schema used to validate against.
Top answer
1 of 1
5

Found an answer by digging through vscode source code. Searched all files, that contains package.json and dependencies (regex search (package.json[\s\S\n]*dependencies)|(dependencies[\s\S\n]*package.json)) and found a class PackageJSONContribution and this was exactly what I was looking for.

Then I made a simple extension using yo code (as from the example of Your first extension).

Some interfaces and classes I was unable to import from vscode, I just made a local copies for my extension. Made my own class FooJSONContribution with the only difference - it's getDocumentSelector() function changed to

    public getDocumentSelector(): vscode.DocumentSelector {
        return [{ language: 'json', scheme: '*', pattern: '**/foo.json' }];
    }

Adjusted extensions package.json activationEvents and added "onLanguage:json" (this could be optimised).

Adjusted activate event of the extension by adding

    const contribution = new FooJSONContribution(xhr, true);
    const disposableCompletionItemProvider = vscode.languages.registerCompletionItemProvider(
        contribution.getDocumentSelector(),
        new JSONCompletionItemProvider(contribution),
        '"',
        ':'
    );
    context.subscriptions.push(disposableCompletionItemProvider);

And that's it. All of the foo.json files now work like package.json files -

Things I need to do now - adjust the code of FooJSONContribution.ts to work for my own needs, for my own API's, for my own files.

I Uploaded this example here https://github.com/leqwasd/VsCodeAsyncJsonAutocomplete

๐ŸŒ
Read the Docs
vscode-docs.readthedocs.io โ€บ en โ€บ stable โ€บ languages โ€บ json
Json - vscode-docs
We also perform structural and value verification based on an associated JSON schema giving you red squigglies.
๐ŸŒ
Frontaid
frontaid.io โ€บ blog โ€บ json-schema-vscode
How to set up JSON Schema with VSCode
November 15, 2020 - Then open the IDE settings and search for "JSON Schema". Find "JSON: Schemas" and click on "Edit in settings.json". The settings.json will be opened with the corresponding setting already prefilled. The fileMatch property is a list of file name patters that should be validated against the schema.
๐ŸŒ
Visual Studio Marketplace
marketplace.visualstudio.com โ€บ items
JSON Validate - Visual Studio Marketplace
Extension for Visual Studio Code - Validate JSON when part of other files as strings.