Disable schema detection for certain files
See original GitHub issueFirst of all, great extension. It is really useful to have yaml files validated (and auto-completed).
However, I have a file in my codebase called some.thing-sam.yml
and I get red squiggle marks (linting errors) on valid properties. I believe what happens is that this extension treats the file as a AWS CloudFormation Serverless Application Model (SAM) file, which it isn’t.
I have found a similar issue #98 where the schemaStore validation is disabled completely. But this is not what I want. Ideally I could provide a re-mapping of the file extension, as I believe the filename pattern is the culprit. Renaming the file to anything else but *sam.yml
works.
Paraphrasing: Naming a yaml file *sam.yml
will trick this extension (or the yaml-language-server) into treating the file as an AWS CloudFormation Serverless Application Model. There should be a way to fix this for the user.
I tried to provide a mapping in my VSCode settings myself, but without any luck:
{
"yaml.schemas": {
"https://raw.githubusercontent.com/awslabs/goformation/master/schema/sam.schema.json": "foo.bar"
}
}
Also noteworthy, the catalog.json
has this configuration in place:
[...]
{
"name": "AWS CloudFormation Serverless Application Model (SAM)",
"description": "The AWS Serverless Application Model (AWS SAM, previously known as Project Flourish) extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application.",
"fileMatch": [
"*.sam.json",
"*.sam.yml",
"*.sam.yaml",
"sam.json",
"sam.yml",
"sam.yaml"
],
"url": "https://raw.githubusercontent.com/awslabs/goformation/master/schema/sam.schema.json"
},
[...]
Judging from the glob patterns my file (some.thing-sam.yml
) shouldn’t have been picked up for linting with that schema in the first place, should it?
[EDIT]
It seems the user configuration is merged. I can successfully create a file foo.bar
and change the file type to YAML
and the linting errors are the same. Changing the file extension mapping to foo.foo
makes the squiggle lines disappear.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:17
- Comments:7
Top GitHub Comments
So I just tried setting the schema to itself and it worked (surprisingly), no more errors… and no need for a blank file.
# yaml-language-server: $schema=./[current file].yaml
build.yaml
Same issue here with a file called
something.deploy.yml
, seems to think my file should match “https://raw.githubusercontent.com/deployphp/deployer/master/src/schema.json”, but it is just a GitHub Actions workflow…