Skip to content

chore: upgrade vscode-json-languageservice from 4.1.8 to 5.7.2#1209

Open
kujon wants to merge 3 commits intoredhat-developer:mainfrom
kujon:chore/upgrade-vscode-json-languageservice-5.7.2
Open

chore: upgrade vscode-json-languageservice from 4.1.8 to 5.7.2#1209
kujon wants to merge 3 commits intoredhat-developer:mainfrom
kujon:chore/upgrade-vscode-json-languageservice-5.7.2

Conversation

@kujon
Copy link

@kujon kujon commented Mar 6, 2026

Summary

  • Upgrades vscode-json-languageservice from 4.1.8 to 5.7.2 (major version bump)
  • Adapts all breaking API changes in the upstream JSON language service
  • All 1276 tests pass

Closes #1069
Relates to #856 (the upgrade brings draft 2019-09 and 2020-12 support via the upstream library)

Breaking changes addressed

Change Fix
registerExternalSchema takes config object Wrapped positional args in { uri, fileMatch, schema }
resolveSchemaContent(schema, url, deps)(schema, handle) Updated signature, read .uri and .dependencies from handle
SchemaDependencies type removed Replaced with Set<string>, .add() instead of [key] = true
SchemaHandle.url.uri Renamed usage
FilePatternAssociation.uris.getURIs() Changed to method call
Error format: string[] → diagnostic objects Added _toDiagErrors normalizer, handle both formats
ResolvedSchema now has warnings field Multi-schema allOf combination now uses new ResolvedSchema(...)
normalizeId adds trailing slashes to bare HTTP URIs Updated test expectations
Default schema draft changed from draft-07 to 2020-12 Added explicit $schema to affected test schemas

Test plan

  • All 1276 existing tests pass
  • TypeScript compilation clean (tsc --noEmit)

🤖 Generated with Claude Code

This is a major version bump that required adapting to several breaking
changes in the upstream JSON language service:

- registerExternalSchema now takes a config object instead of positional args
- resolveSchemaContent signature changed from (schema, url, deps) to (schema, handle)
- SchemaDependencies type removed in favor of Set<string>
- SchemaHandle.url renamed to .uri
- FilePatternAssociation.uris replaced by .getURIs() method
- UnresolvedSchema/ResolvedSchema errors changed from string[] to diagnostic objects
- ResolvedSchema now requires warnings field (multi-schema allOf combination
  updated to use proper ResolvedSchema constructor)
- normalizeId now uses URI.parse().toString() adding trailing slashes to bare
  HTTP URIs
- Default JSON Schema draft changed from draft-07 to draft-2020-12

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@datho7561
Copy link
Contributor

This seems like a really good idea, and I was dreading trying to implement the migration myself (I tried it at least once and it wasn't working properly).

Looks like there's some prettier formatting errors.

(the upgrade brings draft 2019-09 and 2020-12 support via the upstream library)

JSON schema-based validation isn't tied to the vscode-json-langaugeservice version. The implementation is in this repository. Support for drafts 2019-09 and 2020-12 were implemented in #1166 and released in 1.20.0. I'll make sure to close the linked issue.

Copy link
Contributor

@datho7561 datho7561 left a comment

Choose a reason for hiding this comment

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

After I fixed the formatting changes locally, I ran the tests locally. There were 651 test failures.

Ooops nope all tests passing, just forgot to run npm i


const schema: JsonSchema.JSONSchema = { type: 'object', required: ['foo'] };
res = await ls.doValidation(textDoc, jsonDoc, { trailingCommas: 'ignore' }, schema);
res = await ls.doValidation(textDoc, jsonDoc, { trailingCommas: 'ignore' }, schema as any);
Copy link
Contributor

Choose a reason for hiding this comment

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

This change isn't needed (schema has the correct type already) and it upsets the linter, since using any explicitly is a bad habit.

Copy link
Author

Choose a reason for hiding this comment

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

haven't even reviewed what claude did myself 🤣 will fix

Copy link
Author

Choose a reason for hiding this comment

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

done

Use vscode-json-languageservice's JSONSchema type for doValidation call
to fix TS2345 without casting to any. Prettier reformatted
yamlSchemaService.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kujon
Copy link
Author

kujon commented Mar 6, 2026

@datho7561 all problems should be addressed now

@datho7561
Copy link
Contributor

datho7561 commented Mar 7, 2026

Seems pretty decent overall, something weird is happening with bundling yaml-language-server for web after the upgrade though. Figuring that out...

  • at the very least vscode-yaml needs webpack updated

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.

Update vscode-json-languageservice to latest version

2 participants