feat: [YAML extension] make JSON schema schemes compatible with Web IDE
Issue: Web IDE Extension Marketplace - YAML Extension ... (#407 - closed)
What does this MR do and why?
Our original fix to make the YAML extension compatible with the Web IDE requires prefixing the local schema path with the GitLab Web IDE FS scheme (gitlab-web-ide). As mentioned in this feedback #407 (comment 2397569660), this fails to consider the fact that schema definitions are shared amongst different VSCode configurations (for example: in desktop VsCode) not just Web IDE, so adding the prefix to allow Web IDE compatibility is cumbersome.
This MR addresses that by registering the following schemes as contributors:
-
file: this is the default scheme used when referring to local schemaex: "./my_schema.json" -
schemaservice: this is the appended scheme by VSCode's JSON language server when there are multiple JSON schemas identified.
And replace the following schemes with the compatible FS scheme: gitlab-web-ide such that they are Web IDE compatible.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
| Case | Before | After |
|---|---|---|
| Local schema no scheme prefix |
Default |
Local schema without the |
| Multiple schemas |
The default scheme for this case, |
Local and remote schema loading works |
| Remote schema (Regression) |
This case was working fine before, just including to make sure there are no regressions introduced. |
|
| Local schema with scheme prefix (Regression) |
Those that prefix their local schema with the Web IDE scheme should not have any regressions. |
How to set up and validate locally
-
Start the Example App
-
Load the Web IDE and install the
YAMLextension byRedHat. -
Add the following to your VSCode workspace/user settings:
{ "yaml.schemas": { "./yaml_schema.json": ["*.yaml", "*.yml"], "https://raw.githubusercontent.com/angular/angular-cli/v10.1.6/packages/angular/cli/lib/config/schema.json": ["*.yaml", "*.yml"] } } -
Create a local JSON schema (
yaml_schema.json) in the root directory of your project. You can leave it empty. -
Modify your schema configuration as required to test out the different cases.