Skip to content

support for jsonValidationCatalogs - #327104

Merged
Martin Aeschlimann (aeschli) merged 8 commits into
mainfrom
aeschli/asleep-lynx-707
Jul 24, 2026
Merged

support for jsonValidationCatalogs#327104
Martin Aeschlimann (aeschli) merged 8 commits into
mainfrom
aeschli/asleep-lynx-707

Conversation

@aeschli

@aeschli Martin Aeschlimann (aeschli) commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #96120

Copilot AI review requested due to automatic review settings July 23, 2026 09:36
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Raymond Zhao (@rzhao271)

Matched files:

  • src/vs/workbench/contrib/preferences/common/settingsFilesystemProvider.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds extension-contributed, dynamically watched JSON validation catalogs.

Changes:

  • Registers and types jsonValidationCatalogs.
  • Loads and watches catalog resources in the JSON language client.
  • Converts built-in schema associations to the catalog format.
Show a summary per file
File Description
extensionPoints.json Registers the contribution point.
extensionManifestPropertiesService.ts Allows it in Sessions.
settingsFilesystemProvider.ts Emits catalog-formatted associations.
jsonValidationExtensionPoint.ts Defines and validates contributions.
extensions.ts Adds manifest typings.
package.json Contributes the built-in catalog.
jsonClient.ts Loads, watches, and forwards catalogs.

Review details

Comments suppressed due to low confidence (1)

extensions/json-language-features/client/src/jsonClient.ts:857

  • A catalog is runtime JSON, so schemas can contain null. Accessing schema.url then throws into the outer catch and skips every valid association that follows it in this catalog. Use a null-safe item check so malformed entries are ignored individually as intended.
					if (typeof schema.url === 'string' && Array.isArray(schema.fileMatch) && schema.fileMatch.every(fileMatch => typeof fileMatch === 'string')) {
  • Files reviewed: 7/7 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment thread src/vs/workbench/api/common/jsonValidationExtensionPoint.ts Outdated
Comment on lines +562 to +564
const refresh = async () => {
client.sendNotification(SchemaAssociationNotification.type, await getSchemaAssociations(true));
};
Comment thread extensions/json-language-features/client/src/jsonClient.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
}

async function getDynamicSchemaAssociations(): Promise<ISchemaAssociation[]> {
function getSchemaCatalogUris(): Uri[] {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is the catalog set to the https://www.schemastore.org/api/json/catalog.json default value? I'm not seeing this anywhere.

@aeschli Martin Aeschlimann (aeschli) Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the current form it's not for loading directly 'https://www.schemastore.org/api/json/catalog.json', but for extensions to dynamically provide associations. The URI that an extension can pass is either a static resource that is part of the extension, or a dynamic URI from a virtual file system that is set up by the extension.
An extension could use it to feed associations from https://www.schemastore.org/api/json/catalog.json, via such a file system dapter.
We can extend this to also allow loading from URI, but we want users to have control over which associations are used. So I would not suggest to use this contribution point directly on the http URI.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so any user would still need to install an additional extension that'd get the schema store catalog and feed it to the JSON language extension with this design? (assuming such an extension ever gets built)

While I understand the "taking a dependency on a 3rd party service in a first party extension" concern, I'm questioning the parity aspect with the YAML extension. This extension supports the schema store natively (no additional extension/configuration required from the user). Are you planning to implement the schema store extension as a first party one?

Also, with this approach, would the user still have to manually map the file to schema association in the settings, even though the "partner extension" already provided all the associations? Or would that be automatic?

@aeschli Martin Aeschlimann (aeschli) Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this PR is not directly related to adding support from reading https://www.schemastore.org/api/json/catalog.json. The contribution point name catalog is misguiding.
It's been a longstanding request that extension can dynamically contribute schema associations: #96120

You could add support for loading 'https://www.schemastore.org/api/json/catalog.json'' via that contribution point (from a built-in or from an external extension), but you can also directly add it in code at the same place where then new extension point is read.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly this last comment, you wouldn't be opposed to having the "load from json schema catalog to the contribution point" also implemented in the first party extension?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Martin Aeschlimann (@aeschli) I can see your thumb up, so should I essentially rebase and cleanup my other PR onto this one? Or are you planning to fast follow yourself?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had copilot put this together #327297

One thing I'm not sure about is the new entry under the one you added for the contribution. In this case where this is internal, would you expect a new entry here? or the extension to publish to its own subscription?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to start fresh once this PR has been merged. Please aim for a minimal PR.

debuggers?: IDebugger[];
grammars?: IGrammar[];
jsonValidation?: IJSONValidation[];
jsonValidationCatalogs?: IJSONValidationCatalog[];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "catalog" a standard term for a collection of json validators? It's not a term we use elsewhere.

@alexr00

Copy link
Copy Markdown
Member

TylerLeonhardt FYI, I'll add you to the codeowners.

roblourens
roblourens previously approved these changes Jul 23, 2026

@alexr00 Alex Ross (alexr00) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for changing!

@aeschli
Martin Aeschlimann (aeschli) merged commit 96ef7a5 into main Jul 24, 2026
31 checks passed
@aeschli
Martin Aeschlimann (aeschli) deleted the aeschli/asleep-lynx-707 branch July 24, 2026 21:31
@vs-code-engineering vs-code-engineering Bot added this to the 1.131.0 milestone Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[json] support setting schema associations at runtime

6 participants