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] Override/disable json-schema for package.json

See original GitHub issue

I would like to override the default json-schema used by VSCode on some files with my own json-schema (example: VSCode use a json-schema for the Node’s “package.json”, but I want to be able to override it), like when configuring any other json-schema in settings.json:

//settings.json - currently this doesn't work and VSCode keep applying the Node's package.json json-schema
"json.schemas": [{
	"fileMatch": ["*/package.json"],
	"url": "./schemas/package.json"
}]

Reason is: I’m working on a project where there’s a file called “package.json” which is not related to Node: it’s something completely different and internal to the project, and it’s not even in the root directory, but I can’t rename it and VSCode wrongly use the Node’s json-schema and everything become an error.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:17
  • Comments:7

github_iconTop GitHub Comments

2reactions
feryardiantcommented, Jul 8, 2021

I am not sure is my situation related with this issue, but I can get any files under .github/workflows directory validated correctly if it have the same name with another tool’s config file. E.g deploy.yml (deployer), build.yml (hammerkit), etc

DtSQfQ3DlB

I’ve tried to add this to my settings.json, but no luck

{
  "json.schemas": [
    {
      "fileMatch": [
        ".github/workflows/*.yml"
      ],
      "url": "https://json.schemastore.org/github-workflow.json"
    }
  ]
}
1reaction
feryardiantcommented, Sep 20, 2021

Awesome! Thank you @octoman90, I didn’t realize that we could use that such format. Anyway,

I can confirm that your suggestion is working perfectly for per-project settings, but I can’t get its working as global (workspace) settings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

All of my .json files have problems loading reference/schema ...
Here's the exact error I'm getting. Problems loading reference 'https://schemastore.azurewebsites.net/schemas/json/package.json': Unable to load ...
Read more >
JSON editing in Visual Studio Code
To disable validation, use the json.validate.enable setting. IntelliSense. Package and project dependencies. We also offer IntelliSense for specific value sets ...
Read more >
Understanding JSON Schema
JSON Schema is a powerful tool for validating the structure of JSON data. However, learning to use it by reading its.
Read more >
package.json - npm Docs
Specifics of npm's package.json handling. ... At the root of your package it will not override the "files" field, but in subdirectories it...
Read more >
The composer.json schema
Files from the root package are always loaded last, and you cannot use files autoloading yourself to override functions from your dependencies. If...
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