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

Add Option for Forcing Validation against Schema Draft 2020-12 #122

Closed
BalduinLandolt opened this issue Jan 7, 2022 · 4 comments
Closed

Comments

@BalduinLandolt
Copy link

As described in #116, the error-prone validation against drafts 2019-09 and 2020-12 (the latter being the one I care about) has been dropped, instead the message is shown, that these drafts are not supported.

I understand the necessity of this behaviour, but as a user of VSCode who is relying on schemata that so happen to be draft 2020-12, it's also not very useful, and essentially forces me to use a different editor instead.
Would it be an option to prompt the user the question, if they want to have validation anyways, acknowledging that it may result in false positives? It would presumably require a option for "force validating non-supported schema versions".

@aeschli
Copy link
Contributor

aeschli commented May 13, 2022

The message Draft 2019-09 schemas are not yet fully supported. is just a warning. the validation still happens, it's just that some new properties are not recognized,

I just pushed more support and most of new properties are now supported: #133

@VanessaRussell
Copy link

The message Draft 2019-09 schemas are not yet fully supported. is just a warning. the validation still happens, it's just that some new properties are not recognized,

This used to be true; however, it unfortunately has not been true since at least the beginning of 2022.

Using this sample schema:

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "additionalProperties": false,
    "required": [
        "requiredProp"
    ],
    "properties": {
        "$schema": {
            "description": "Denotes which schema to validate json against",
            "$comment": "Currently only used by example to verify it is valid within VS Code",
            "type": "string"
        },
        "requiredProp": {
            "description": "Sample required prop",
            "type": "string"
        }
    }
}

and this sample example:

{
    "$schema": "./jsonschema.json",
    "additionalProp": "This should be an error."
}

within:
image

only presents the following problems:
image

meanwhile, if I change the schema version to something supported such as http://json-schema.org/draft-07/schema, I get the list of expected validation problems:
image

@BalduinLandolt
Copy link
Author

I can confirm that the behaviour described in detail by @VanessaRussell has already been in place by the time I opened this suggestion in early January - this is exactly why I did so. :)
If the warning was shown alongside the actual validation, the issue would be solved for me.

But thank you for working on the new drafts, @aeschli, this will be a nice improvement to have!

@aeschli
Copy link
Contributor

aeschli commented Jul 13, 2022

This got fixed in the meantime. You will only see a warning when the schema uses a feature that we don't support.

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

3 participants