-
Notifications
You must be signed in to change notification settings - Fork 284
Support draft-04 schemas #1065
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
base: main
Are you sure you want to change the base?
Support draft-04 schemas #1065
Conversation
Adding the warning is much harder than I anticipated. We depend on vscode-json-languageservice and use some if its internal code. vscode-json-languageservice doesn't support reporting warnings on schemas until the next major version. A lot of the internals have changed, so by bumping vscode-json-languageservice, I prevent the extension from being able to compile. |
This helps to support the schema for openapi 3.0.0, among others, that use an older draft of JSON schema that has some type differences that make it incompatible with JSON schema draft 07. See redhat-developer#1006 , I think the root cause for the issues that PR caused is that we were trying to download and cache the metaschema from the "URL" instead of using the copy that's bundled with `ajv`. Fixes redhat-developer#780, Fixes redhat-developer#752 (and many, many duplicates we'll have to find and clean up) Signed-off-by: David Thompson <davthomp@redhat.com>
d4c0017
to
0400d2a
Compare
The primary motivation for doing this is to allow warnings to be reported on schemas. I would like to report warnings on schemas as a part of redhat-developer#1065. When updating the json language service, there were many API changes that I needed to adapt to, and some tests that I changed. Notably, I needed to copy a lot of the implementation of `JSONSchemaService` into our subclass of `JSONSchemaService`. `JSONSchemaService` turns all schema identifiers into URIs and escapes all `/` in the fragment, and does this in the private `normalizeId` method that we can't override Combined, these behaviours cause many tests to fail. Closes redhat-developer#1069 Signed-off-by: David Thompson <davthomp@redhat.com>
See #1072 ; ideally we get that merged, then we can supply the warning through json-languageservice |
What does this PR do?
This helps to support the schema for openapi 3.0.0, among others, that use an older draft of JSON schema that has some type differences that make it incompatible with JSON schema draft 07.
See #1006 , the root cause for the issues that PR caused is that some schemas reference the metaschema using
https
, eg.https://json-schema.org/draft-07/schema#
, which is invalid according to the spec. This PR suppresses this error, because in practice many schemas usehttps
for the metaschema reference, and that shouldn't prevent validation of the YAML document.https
issue in the schema so they can fix the schema or file an issue to get the schema fixed.What issues does this PR fix or reference?
Fixes #780, Fixes #752
(and many, many duplicates we'll have to find and clean up)
Is it tested? How?
Unit test