Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Relequestual opened this issue Aug 4, 2022 · 12 comments

Comments

@Relequestual
Copy link
Contributor

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.

@gregsdennis
Copy link

In the meantime, users can install https://marketplace.visualstudio.com/items?itemName=prosser.json-schema-2020-validation, which is powered by https://www.nuget.org/packages/JsonSchema.Net/, which is fully 2020-12 compliant.

@cahaseler
Copy link

Adding my vote here, VSCode's lack of support for the latest JSON Schema formats is making things harder for my team at the Department of Energy too.

@proohit
Copy link

proohit commented Sep 23, 2022

Also requested in microsoft/vscode#155379 to be picked up by the VS Code team. Currently in backlog

@WilliamLeara
Copy link

Vote +1 for fixing this

@weissjoh
Copy link

+1 upvote to provide a solution for this

1 similar comment
@Ten-Wang
Copy link

+1 upvote to provide a solution for this

@Kai-Herzig-VW
Copy link

+1 upvote to support the latest JSON Schema

@EgizianoEG
Copy link

+1 Bump

@dsaladacision
Copy link

In the meantime, users can install https://marketplace.visualstudio.com/items?itemName=prosser.json-schema-2020-validation, which is powered by https://www.nuget.org/packages/JsonSchema.Net/, which is fully 2020-12 compliant.

@gregsdennis How do you get that extension to override the default validator for JSON files?

@gregsdennis
Copy link

I don't know. I didn't build the extension. My understanding is that it hasn't been maintained for a while either. There are a few outstanding issues in the GitHub repo.

@unicornzero
Copy link

+1 bump

@rolivares
Copy link

+1

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

No branches or pull requests