Skip to content

Disable schema detection for certain files #245

@riker09

Description

@riker09

First 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.barand 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions