Partial JSON Schema 2020-12 support results in failuer to highlight invalid schema features?

Open
#149 13 comments 55 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
json, typescript
Domain
devtools

Research direction

The report names only the VS Code editor validation behavior and a JSON Schema 2020-12 example, not a source file or test. Reproduce the example in the JSON language service and trace how the schema is processed; done means the handling of array-valued items is clarified or validated consistently with the reported prefixItems diagnostic.

Written by the indexing model from the issue text.

Description

feature-request

Imagine the following JSON Schema...

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": "",
  "items": [1,2,3],
  "prefixItems": 123
}

In 2020-12, the tuple form of items was replaced with prefixItems. items can now only be an object and not an array.
However when we look at the in editor validation result...

Screenshot 2022-08-04 at 13 44 55

The value of prefixItems is correctly identified as not allowed to be a number. It must be an array.

However, the value of items is not identified as not allowed to be an array.

The VSCode site says

The JSON support shipped with VS Code supports all draft versions from Draft 4 to JSON Schema Draft 2020-12.

But that doesn't seem to be exactly accurate, especially when a Schema can't be validated as the meta-schema can't be used.

What processing model IS being used when JSON documents identify as using 2020-12?

Don't get me wrong, I'm glad you're working on this!
As always, the JSON Schema team is more than happy to answer questions, and may now even have some time to help fix things if allowed.

Dominant language
TypeScript
Stars
326
Forks
145
Avg merge
22h 10m
Merged PRs (30d)
9

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode-json-languageservice

All issues in microsoft/vscode-json-languageservice

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.