chore: upgrade vscode-json-languageservice from 4.1.8 to 5.7.2#1209
chore: upgrade vscode-json-languageservice from 4.1.8 to 5.7.2#1209kujon wants to merge 3 commits intoredhat-developer:mainfrom
Conversation
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>
|
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.
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. |
test/jsonParser.test.ts
Outdated
|
|
||
| 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); |
There was a problem hiding this comment.
This change isn't needed (schema has the correct type already) and it upsets the linter, since using any explicitly is a bad habit.
There was a problem hiding this comment.
haven't even reviewed what claude did myself 🤣 will fix
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>
|
@datho7561 all problems should be addressed now |
|
Seems pretty decent overall, something weird is happening with bundling yaml-language-server for web after the upgrade though. Figuring that out...
|
Summary
vscode-json-languageservicefrom 4.1.8 to 5.7.2 (major version bump)Closes #1069
Relates to #856 (the upgrade brings draft 2019-09 and 2020-12 support via the upstream library)
Breaking changes addressed
registerExternalSchematakes config object{ uri, fileMatch, schema }resolveSchemaContent(schema, url, deps)→(schema, handle).uriand.dependenciesfrom handleSchemaDependenciestype removedSet<string>,.add()instead of[key] = trueSchemaHandle.url→.uriFilePatternAssociation.uris→.getURIs()string[]→ diagnostic objects_toDiagErrorsnormalizer, handle both formatsResolvedSchemanow haswarningsfieldallOfcombination now usesnew ResolvedSchema(...)normalizeIdadds trailing slashes to bare HTTP URIs$schemato affected test schemasTest plan
tsc --noEmit)🤖 Generated with Claude Code