Vscode-yaml: Having `tasks` as folder suffix in hierarchy causes Incorrect Type error

Created on 17 Dec 2018  路  8Comments  路  Source: redhat-developer/vscode-yaml

If you have a folder (anywhere in the hierarchy of the file) suffixed with tasks then you get Incorrect type. Expected "array"..

Examples:

|- foo.yaml (fine)
|- tasks.yaml (fine)
|- tasks
  |- foo.yaml (Incorrect type)
|- tasks-test
  |- foo.yaml (fine)
|- test-tasks
  |- foo.yaml (Incorrect type)
  |- subdir
    |- foo.yaml (Incorrect type)
|- subdir
  |- tasks
    |- foo.yaml (Incorrect type)
  |- tasks.yaml (fine)

The files must have something in; I've been testing with AWSTemplateFormatVersion: "2010-09-09"

Error copied from VS Problems pane

{
    "resource": "/c:/jake.hendy/dev/tasks/task.yaml",
    "owner": "_generated_diagnostic_collection_name_#0",
    "severity": 8,
    "message": "Incorrect type. Expected \"array\".",
    "startLineNumber": 1,
    "startColumn": 1,
    "endLineNumber": 15,
    "endColumn": 1
}

Result from langauge server:

Params: {
    "textDocument": {
        "uri": "file:///c%3A/jake.hendy/dev/tasks/task.yaml",
        "languageId": "yaml",
        "version": 1,
        "text": "AWSTemplateFormatVersion: \"2010-09-09\"\r"
    }
}
schema_issue

Most helpful comment

I believe it's because when we are pulling from the json schema store someone made a different schema match every YAML file underneath a tasks folder. If you set yaml.schemaStore.enable to false it won't automatically grab schemas from the schema store and you shouldn't run into this issue.

All 8 comments

It looks like this is because when schemas are pulled from the schema store it tries to match folder structure/files to a schema. In this case, the tasks folder is trying to match tasks/foo.yaml to the ansible schema (http://schemastore.org/api/json/catalog.json).

Eventually, I'd like to see if its possible to manually override schemas so that if its pulled from the schema store and you have that structure (but aren't using it for ansible) then you can either set the schema for that file to no schema or set it to a different schema

This has been driving me nuts. I am using concourse-ci, and have task definition files orgranized matching the recommended best practices:

|- ci
   |- pipeline.yml
   |- tasks
      |- task1.yml
      |- task2.yml

All my task files are showing up with this error like this. How can I make this extension properly recognize the valid YAML syntax?

I believe it's because when we are pulling from the json schema store someone made a different schema match every YAML file underneath a tasks folder. If you set yaml.schemaStore.enable to false it won't automatically grab schemas from the schema store and you shouldn't run into this issue.

still getting this and is 1/2 way through 2020

I can confirm that this is still present in v0.10.1 - are there any workarounds?

@darioleanbit https://github.com/redhat-developer/vscode-yaml/issues/145#issuecomment-478665119

"yaml.schemaStore": false

@JPinkney as stated in your first comment, the enable part is needed in the key:

"yaml.schemaStore.enable": false

@JPinkney as stated in your first comment, the enable part is needed in the key:

"yaml.schemaStore.enable": false

This worked for me. Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joshuaavalon picture joshuaavalon  路  4Comments

ssbarnea picture ssbarnea  路  3Comments

shadowzen1978 picture shadowzen1978  路  7Comments

Chagrilled picture Chagrilled  路  4Comments

nicholas-devlin picture nicholas-devlin  路  4Comments