question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[json] support meta-schema features

See original GitHub issue

Issue Type: Bug

So basically I have a VS Code extension that provides JSON file validation based on the built in JSON validator. The schema that I’m validating against (OpenAPI 3.1.x) uses meta-schema features, i.e. $dynamicRef, which I also need to use, since I reference the OpenAPI schema.

When defining a custom schema like the following, I get a warning stating that the validator doesn’t support meta-schema features yet. Needless to say, validation does really not work. When using normal $ref, most of the schema work but not properties that use $dynamicRef. So I’m forced to reference the schema by $dynamicRef as well.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "OpenApiPathObject",
  "type": "object",
  "additionalProperties": {
    "$dynamicRef": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json#/$defs/path-item-or-reference"
  }
}
The schema uses meta-schema features ($dynamicRef) that are not yet supported by the validator.

I’m using VS Code 1.69.0 and changed the required engine of my extension to ^1.68.0, which should include support for schema verion Draft 2020-12 as stated in the May 2022 release notes. What are my options here and how can I come around this warning?

Here’s an excerpt of the extension package.json

...
"engines": {
    "vscode": "^1.68.0"
},
...

VS Code version: Code 1.69.0 (92d25e35d9bf1a6b16f7d0758f25d48ace11e5b9, 2022-07-07T05:28:36.503Z) OS version: Windows_NT x64 10.0.22000 Restricted Mode: No Remote OS version: Linux x64 5.10.102.1-microsoft-standard-WSL2

System Info
Item Value
CPUs AMD Ryzen 5 2600X Six-Core Processor (12 x 3593)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.93GB (4.25GB free)
Process Argv –crash-reporter-id 807faa54-048f-4bca-b099-f3700536fcc8
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu
OS Linux x64 5.10.102.1-microsoft-standard-WSL2
CPUs AMD Ryzen 5 2600X Six-Core Processor (12 x 3593)
Memory (System) 7.73GB (4.17GB free)
VM 0%
Extensions (72)
Extension Author (truncated) Version
better-comments aar 3.0.0
project-manager ale 12.6.0
es7-react-js-snippets dsz 4.4.3
lex-flex-yacc-bison fau 0.0.3
auto-rename-tag for 0.1.10
remotehub Git 0.36.0
better-cpp-syntax jef 1.15.19
jupyter-keymap ms- 1.0.0
remote-ssh-edit ms- 0.80.0
remote-wsl ms- 0.66.3
remote-repositories ms- 0.14.0
vscode-openapi 42C 4.11.3
vscode-css-formatter aes 1.0.2
turbo-console-log Cha 2.3.2
npm-intellisense chr 1.4.2
path-intellisense chr 2.8.1
doxdocgen csc 1.4.0
vscode-svgviewer css 2.0.0
vscode-markdownlint Dav 0.47.0
vscode-eslint dba 2.2.6
githistory don 0.6.19
vscode-generate-getter-setter DSK 0.5.0
gitlens eam 12.1.2
prettier-vscode esb 9.5.0
shell-format fox 7.2.2
c-cpp-runner fra 4.0.3
copilot Git 1.31.6194
vscode-pull-request-github Git 0.46.0
latex-workshop Jam 8.27.2
better-cpp-syntax jef 1.15.19
vscode-github-actions me- 3.0.1
vscode-todo-parser min 1.9.1
csharp ms- 1.25.0
python ms- 2022.10.1
vscode-pylance ms- 2022.7.30
jupyter ms- 2022.6.1201981810
jupyter-keymap ms- 1.0.0
jupyter-renderers ms- 1.0.8
cmake-tools ms- 1.11.26
cpptools ms- 1.10.8
cpptools-extension-pack ms- 1.2.0
gradle-language nac 0.2.3
color-highlight nau 2.5.0
vscode-jest Ort 4.6.0
peggy-language Peg 2.3.0
vscode-boot-dev-pack Piv 0.1.0
vscode-spring-boot Piv 1.36.0
openapi-snippets pro 0.0.9
quicktype qui 12.0.46
typescript-hero rbb 3.0.0
java red 1.8.0
vscode-commons red 0.0.6
vscode-xml red 0.21.0
vscode-yaml red 1.9.1
vscode-gradle-extension-pack ric 0.0.4
LiveServer rit 5.7.5
rust-analyzer rus 0.3.1123
sonarlint-vscode Son 3.7.0
svelte-vscode sve 105.18.1
cmake twx 0.0.17
vscode-lldb vad 1.7.1
vscode-ltex val 13.1.0
vscodeintellicode Vis 1.2.22
vscode-gradle vsc 3.12.2
vscode-java-debug vsc 0.42.0
vscode-java-dependency vsc 0.20.0
vscode-java-pack vsc 0.24.0
vscode-java-test vsc 0.35.2
vscode-maven vsc 0.36.0
vscode-spring-boot-dashboard vsc 0.5.0
vscode-spring-initializr vsc 0.10.0
glean wix 5.2.2

(2 theme extensions excluded)

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:62
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
proohitcommented, Sep 1, 2022

@JustinGrote Using the spec, which uses $dynamicRef, could lead to unintended behaviour or not work at all, so suppressing the warning wouldn’t be a good idea imho.

0reactions
JustinGrotecommented, Sep 1, 2022

@aeschli oh, fair point, maybe filter these notices when you’re referencing the actual schema spec? 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Specification - JSON Schema
The meta-schemas are schemas against which other schemas can be validated. It is self-descriptive: the JSON Schema meta-schema validates itself. The latest meta...
Read more >
json - meta-schema features in VS Code extension warning in ...
When defining a custom schema like the following, I get a warning stating that the validator doesn't support meta-schema features yet.
Read more >
JSON Schema Overview
Json supports draft 04 and later. Meta-schemas. Each draft defines a meta-schema. This is a special JSON Schema that describes all of the...
Read more >
Metaschema Syntax - NIST Pages
This makes JSON and YAML formatted data more concise. ... here can be used to indicate the alignment of cells; OSCAL HTML does...
Read more >
Choosing schema language - Ajv JSON schema validator
Optionally, you can add draft-07 meta-schema, to use both draft-07 and draft-2019-09 schemas in ... With this import Ajv supports the following features:....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found