{"id":25171179,"url":"https://github.com/leshaunj/vsc-json-issue","last_synced_at":"2026-05-03T12:32:48.047Z","repository":{"id":129774287,"uuid":"573570694","full_name":"LeShaunJ/vsc-json-issue","owner":"LeShaunJ","description":"json.schema resolution ignores a mapping's \"fileMatch\" if the tail-end of its path mirrors the entirety of another mapping's path","archived":false,"fork":false,"pushed_at":"2022-12-12T02:31:35.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-30T23:07:08.152Z","etag":null,"topics":["json-schema","typescript","vscode","vscode-extension"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LeShaunJ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-12-02T19:39:01.000Z","updated_at":"2022-12-02T19:40:20.000Z","dependencies_parsed_at":"2023-05-21T05:30:18.030Z","dependency_job_id":null,"html_url":"https://github.com/LeShaunJ/vsc-json-issue","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LeShaunJ/vsc-json-issue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeShaunJ%2Fvsc-json-issue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeShaunJ%2Fvsc-json-issue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeShaunJ%2Fvsc-json-issue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeShaunJ%2Fvsc-json-issue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LeShaunJ","download_url":"https://codeload.github.com/LeShaunJ/vsc-json-issue/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeShaunJ%2Fvsc-json-issue/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32569712,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json-schema","typescript","vscode","vscode-extension"],"created_at":"2025-02-09T09:19:30.285Z","updated_at":"2026-05-03T12:32:48.035Z","avatar_url":"https://github.com/LeShaunJ.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ --\u003e\n\u003c!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ --\u003e\n\u003c!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions --\u003e\n\u003c!-- 🔎 Search existing issues to avoid creating duplicates. --\u003e\n\u003c!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ --\u003e\n\u003c!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. --\u003e\n\u003c!-- 🔧 Launch with `code --disable-extensions` to check. --\u003e\n**Does this issue occur when all extensions are disabled?:**\nNo, but because the issue stems with the [`json-language-features`](https://github.com/microsoft/vscode/tree/main/extensions/json-language-features) extention which is an built into `vscode`, such reports must be made to the extension's publisher as directed by the [guidelines](https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions).\n\u003c!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. --\u003e\n\u003c!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help \u003e Report Issue' dialog can assist with this. --\u003e\n| **VS Code** | `1.73.1` |\n|--:|:--|\n| **Commit** | 6261075646f055b99068d3688932416f2346dd3b |\n| **Date** | `2022-11-09T02:22:48.959Z` |\n| **Electron** | `19.0.17` |\n| **Chromium** | `102.0.5005.167` |\n| **Node.js** | `16.14.2` |\n| **V8** | `10.2.154.15-electron.0` |\n| **OS** | `Darwin arm64 22.1.0` |\n| **Sandboxed** | `No` |\n\n## Problem\n\nStrict file-matching within `json.schemas: [...]` is ignored under a specific workspace folder's `/.vscode/settings.json` when the tail-end of a mapping's `fileMatch` path is equal to the entirety of another mapping's `fileMatch` path. This causes validation errors on the `.json` file whose schema is being ignored given that both schema mappings are made to account for different specifications.\n\nWhen I had first brought this up to my colleagues, a few of them suspected it was in regards to microsoft/vscode#147865, microsoft/vscode#124491, microsoft/vscode#107976, etc. But from what I've seemingly discovered, the issue I'm describing goes a bit deeper than that.\n\n### Steps to Reproduce:\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003e\u003ccode\u003eTL;DR\u003c/code\u003e\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n\u003e 1. Create an empty workspace.\n\u003e 2. Perform [Step 2](#repr.step.2), below.\n\u003e 3. Clone [this repo](https://github.com/LeShaunJ/vsc-json-issue.git) into the workspace.\n\u003e 4. Perform [Step 6](#repr.step.6) and onward.\n\n\u003c/p\u003e\n\u003c/details\u003e\u003cbr/\u003e\n\n1. Create the following folder structure:\n   ```\n   MyWorkspace/\n   └─ MyProject/\n      ├─ .vscode/\n      ├─ configs/\n      └─ container/\n         └─ configs/\n   ```\n2. \u003ca id=\"repr.step.2\"\u003e\u003c/a\u003eSet `[Workspace ]Settings \u003e Extensions \u003e JSON \u003e Trace: Server` to `verbose`:\n   * In `MyWorkspace/MyWorkspace.code-workspace`:\n     ```json\n     {\n         \"json.trace.server\": \"verbose\"\n     }\n     ```\n3. Under [`MyProject/configs/`](https://github.com/LeShaunJ/vsc-json-issue/blob/main/configs):\n   1. Create the file, [`config.schema.json`](https://github.com/LeShaunJ/vsc-json-issue/blob/main/configs/config.schema.json):\n      ```json\n      {\n          \"$schema\": \"http://json-schema.org/draft-07/schema\",\n          \"$id\": \"https://domain.com/schemas/MyProject/config/schema.json\",\n          \"title\": \"config.json\",\n          \"description\": \"Basic Config\",\n          \"type\": \"object\",\n          \"properties\": {\n              \"env\": { \"type\": \"string\" },\n              \"prefix\": { \"type\": \"string\" },\n              \"suffix\": { \"type\": \"string\" }\n          },\n          \"required\": [\"env\"],\n          \"additionalProperties\": false\n      }\n      ```\n   2. Create the file, [`config.json`](https://github.com/LeShaunJ/vsc-json-issue/blob/main/configs/config.json):\n      ```json\n      {\n          \"env\": \"staging\"\n      }\n      ```\n4. Under [`MyProject/container/configs/`](https://github.com/LeShaunJ/vsc-json-issue/blob/main/container/configs):\n   1. Create the file, [`config.schema.json`](https://github.com/LeShaunJ/vsc-json-issue/blob/main/container/configs/config.schema.json):\n      ```json\n      {\n          \"$schema\": \"http://json-schema.org/draft-07/schema\",\n          \"$id\": \"https://domain.com/schemas/MyProject/container/config/schema.json\",\n          \"title\": \"config.json\",\n          \"description\": \"Container Config\",\n          \"type\": \"object\",\n          \"properties\": {\n              \"container_name\": { \"type\": \"string\" },\n              \"image_location\": { \"type\": \"string\", \"format\": \"uri-reference\" },\n              \"arch\": { \"type\": \"string\" }\n          },\n          \"required\": [\"container_name\",\"image_location\",\"public_key\"],\n          \"additionalProperties\": true\n      }\n      ```\n   2. Create the file, [`config.json`](https://github.com/LeShaunJ/vsc-json-issue/blob/main/container/configs/config.json):\n      ```json\n      {\n          \"container_name\": \"ansible-runner\",\n          \"image_location\": \"https://domain.com/images/ansible-runner:2.13\",\n          \"arch\": \"amd64\"\n      }\n      ```\n5. Under [`MyProject/.vscode/`](https://github.com/LeShaunJ/vsc-json-issue/blob/main/.vscode), create the [`settings.json`](https://github.com/LeShaunJ/vsc-json-issue/blob/main/.vscode/settings.json) file with the following `json.schema` mappings:\n   ```json\n   {\n       \"json.schemas\": [\n           {\n               \"fileMatch\": [\n                   \"/configs/config.json\",\n               ],\n               \"url\": \"/configs/config.schema.json\"\n           },\n           {\n               \"fileMatch\": [\n                   \"/container/configs/config.json\",\n               ],\n               \"url\": \"/container/configs/config.schema.json\"\n           }\n       ]\n   }\n   ```\n6. \u003ca id=\"repr.step.6\"\u003e\u003c/a\u003eOpen [`MyProject/container/configs/config.json`](https://github.com/LeShaunJ/vsc-json-issue/blob/main/container/configs/config.json):\n   * Note the validation errors highlighted on each property.\n   * Note how the file is highlighted yellow in the `Explore` sidebar.\n7. \u003ca id=\"repr.step.7\"\u003e\u003c/a\u003eOpen the `PROBLEMS` and note the **second** validation error for [`MyProject/container/configs/config.json`](https://github.com/LeShaunJ/vsc-json-issue/blob/main/container/configs/config.json) (_more on this [later](#diagnosis.bug)_):\n   ```\n   ˅ {…} config.json MyProject • container/configs ➎\n         ⚠️ Missing property \"env\". [Ln 1, Col 1]\n         ⚠️ Missing property \"public_key\". [Ln 1, Col 1]\n         ⚠️ Property container_name is not allowed. [Ln 2, Col 5]\n         ⚠️ Property image_location is not allowed. [Ln 3, Col 5]\n         ⚠️ Property arch is not allowed. [Ln 4, Col 5]\n   ```\n8. \u003ca id=\"repr.step.8\"\u003e\u003c/a\u003eAdd a second folder to the workspace.\n   1. Open the `OUTPUT` tab.\n   2. \u003ca id=\"repr.step.8.2\"\u003e\u003c/a\u003eIn the log source drop down, select `JSON Language Server`.\n   3. \u003ckbd\u003ectrl\u003c/kbd\u003e+\u003ckbd\u003ef\u003c/kbd\u003e (_or \u003ckbd\u003e⌘\u003c/kbd\u003e+\u003ckbd\u003ef\u003c/kbd\u003e_) to search:\n      1. Select the \u003ckbd\u003e.*\u003c/kbd\u003e icon to enable `regex`.\n      2. Search for, `\"settings\": \\{`.\n   4. Cycle from the last search-match until you find the following (_file-path roots are truncated as they'd differ depending on the reproduction location_):\n      ```json\n      {\n          \"settings\": {\n              \"http\": {\n                  \"proxy\": \"\",\n                  \"proxyStrictSSL\": true\n              },\n              \"json\": {\n                  \"validate\": {\n                      \"enable\": true\n                  },\n                  \"format\": {\n                      \"enable\": true\n                  },\n                  \"keepLines\": {\n                      \"enable\": false\n                  },\n                  \"schemas\": [\n                      {\n                          \"url\": \"file:///MyWorkspace/MyProject/config/config.schema.json\",\n                          \"fileMatch\": [\n                              \"file:///MyWorkspace/MyProject/config/config.json\",\n                              \"file:///MyWorkspace/MyProject/*/config/config.json\" /* root cause */\n                          ]\n                      },\n                      {\n                          \"url\": \"file:///MyWorkspace/MyProject/container/config/config.schema.json\",\n                          \"fileMatch\": [\n                              \"file:///MyWorkspace/MyProject/container/config/config.json\",\n                              \"file:///MyWorkspace/MyProject/*/container/config/config.json\"\n                          ]\n                      }\n                  ],\n                  \"resultLimit\": 5001,\n                  \"jsonFoldingLimit\": 5001,\n                  \"jsoncFoldingLimit\": 5001\n              }\n          }\n      }\n      ```\n      * Note the how the mappings are instructed to resolve.\n\n## Diagnosis\n\nAt this point, I thought I'd figured it out––that any path with `configs/config.json` was instructed to map to [`/configs/config.schema.json`](https://github.com/LeShaunJ/vsc-json-issue/blob/main/configs/config.schema.json). This theory came from what appeared to be unintentional greed as a result of the way the mappings are globalized:\n\nhttps://github.com/microsoft/vscode/blob/3c83412a4fc8d316aefb2385850564d7a21dc9f6/extensions/json-language-features/client/src/jsonClient.ts#L521-L527\n\nWhich is fine in terms of globally mapping a schema; however, it means that stricter mappings are ignored if the tail-end of one mapping's `fileMatch` path equal to the entirety of another mapping's `fileMatch` path.\n\n\u003ca id=\"diagnosis.bug\"\u003e\u003c/a\u003eSurely, this is *mostly* by design, but if you recall `PROBLEMS` that are raised ([Reproduction Step 7](#repr.step.7)), the validation is in fact validating against *both* schemas––as if one schema is the *parent* of the other. This is confirmed by the appearance of, `Missing property \"public_key\". [Ln 1, Col 1]`, which stems from a [`requirement`](https://github.com/LeShaunJ/vsc-json-issue/blob/25b468beb5920b20560db68a5811807f4089d31c/container/configs/config.schema.json#L12) in [`container/configs/config.schema.json`](https://github.com/LeShaunJ/vsc-json-issue/blob/main/container/configs/config.schema.json) that was *intentionally* left out of [`container/configs/config.json`](https://github.com/LeShaunJ/vsc-json-issue/blob/main/container/configs/config.json) to prove the claim as a **bug**. What we're seeing is what one can only assume is **unintentional inheritance**, as this quirk would have otherwise been [explained](https://code.visualstudio.com/docs/languages/json) in some detail or another.\n\n### Roadblock\n\nOnly thing is that, while the bug claim is true in all regards, my theory was **incorrect**. If you remove the second folder from [Reproduction Step 8](#repr.step.8) and redo [Reproduction Steps 8.2](#repr.step.8.2) and onward ([`MyProject2`](#)), you'll not only find the issue remains prevelant, but that it has nothing to do with what I'd thought were attempts to globalize the schema resolutions:\n\n```json\n{\n    \"settings\": {\n        \"http\": {\n            \"proxy\": \"\",\n            \"proxyStrictSSL\": true\n        },\n        \"json\": {\n            \"validate\": {\n                \"enable\": true\n            },\n            \"format\": {\n                \"enable\": true\n            },\n            \"keepLines\": {\n                \"enable\": false\n            },\n            \"schemas\": [\n                {\n                    \"url\": \"file:///MyWorkspace/MyProject/config/config.schema.json\",\n                    \"fileMatch\": [\n                        \"file:///MyWorkspace/MyProject/config/config.json\"\n                    ]\n                },\n                {\n                    \"url\": \"file:///MyWorkspace/MyProject/container/config/config.schema.json\",\n                    \"fileMatch\": [\n                        \"file:///MyWorkspace/MyProject/container/config/config.json\"\n                    ]\n                }\n            ],\n            \"resultLimit\": 5001,\n            \"jsonFoldingLimit\": 5001,\n            \"jsoncFoldingLimit\": 5001\n        }\n    }\n}\n```\n\nWhat I'd identified as the root cause is actually just the way mappings are globalized with regards to the scope of a folder in a multi-root workspace setting. That said, the issues laid out above still stand. In fact, if you rename [`MyProject/container/configs/`](https://github.com/LeShaunJ/vsc-json-issue/blob/main/container/configs) to `MyProject/container/config/`, because `'config/config.schema.json' != 'configs/config.schema.json'` the issues above are gone.\n\nIn the logs, you'll find this:\n```\n[Trace - ##:##:## AP] Received response 'json/languageStatus - (###)' in #ms.\nResult: {\n    \"schemas\": [\n        \"file:///Users/arian/src/Workspaces/MyWorkspace/MyProject/container/config/config.schema.json\"\n    ]\n}\n```\n\nInstead of what you'd see when both `./` and `./container` have their own separate `configs/config.schema.json` files:\n```\n[Trace - ##:##:## AP] Received response 'json/languageStatus - (###)' in #ms.\nResult: {\n    \"schemas\": [\n        \"file:///Users/arian/src/Workspaces/MyWorkspace/MyProject/configs/config.schema.json\",\n        \"file:///Users/arian/src/Workspaces/MyWorkspace/MyProject/container/configs/config.schema.json\"\n    ]\n}\n```\n\nSo we know for sure that either the extension itself or the language server are grouping schema mappings so long as the entirety of one mapping's `filePath[]` is contained at the tail-end of another––albeit, separate––mapping's `filePath[]`. To further affirm what I mean here [`MyProject3`](#) shows that if the tail-end of different mapping's `filePath[]` are the same, but both paths are nested within their own unique folders, the issue does not occur\n\n## Solution\n\n* While it is true that `$schema` directly in the `.json` files supersedes the the above, this is insufficient if the `.json` file is used by a 3rd-party module/package/app that does not allow foreign properties.\n* Asking the user to simply make unique folder structure is also insufficient, as there may be operational reasons that require a consistant folder structure and config file name across multiple directories/nests within the same project, but whose individual config files follow different schemas.\n* Besides that, there's always a chance that two configuration files required by two separate 3rd-party modules/packages/apps may clash if they follow similar folder structures and file names––in spite of where one is nested in lieu of the other.\n* I believe `fileMatch` paths should make a clear distinction between `directory/file.json` and `/directory/file.json`:\n  * A path within `fileMatch` is **relative** if it *does not* start with `/`.\n    * Relative `fileMatch` paths are *still* matched as both `/project/directory/file.json` and `/project/*/directory/file.json`.\n  * A path within `fileMatch` is **absolute** when it *does* begin with `/`:\n    * Absolute `fileMatch` paths are matched *only* as `/project/directory/file.json`.\n\nSo instead of:\n\nhttps://github.com/microsoft/vscode/blob/3c83412a4fc8d316aefb2385850564d7a21dc9f6/extensions/json-language-features/client/src/jsonClient.ts#L519-L531\n\nWe simply remove the globalization of paths that start with `/`:\n\n```ts\n\tfor (const fileMatch of fileMatches) { \n\t\tif (fileMatchPrefix) { \n\t\t\tif (fileMatch[0] === '/') { \n\t\t\t\taddMatch(fileMatchPrefix + fileMatch); \n\t\t\t} else { \n\t\t\t\taddMatch(fileMatchPrefix + '/' + fileMatch); \n\t\t\t\taddMatch(fileMatchPrefix + '/*/' + fileMatch); \n\t\t\t} \n\t\t} else { \n\t\t\taddMatch(fileMatch); \n\t\t}\n\t}\n```\n\nWith this, any cross-pollination is a matter of how the end-user has configured their mappings. Unless there's something I'm missing as to why it was specifically done this way, I don't otherwise see why this cannot be done.\n\n### Except The Above Does Not Work\n\nHaving [tested](https://github.com/microsoft/vscode/tree/main/.devcontainer) my suggested change, it became clear that there seems to be no need for `addMatch(fileMatchPrefix + '/*' + fileMatch)` and `addMatch(fileMatchPrefix + '/*/' + fileMatch)`. The language server appears to globalize the mappings on its own terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleshaunj%2Fvsc-json-issue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleshaunj%2Fvsc-json-issue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleshaunj%2Fvsc-json-issue/lists"}