Vscode-yaml: Fetch module complains about missing property "path", which has been renamed

Created on 10 May 2019  路  5Comments  路  Source: redhat-developer/vscode-yaml

Environment

  • Extension version: 0.4.0
  • OS Type: Linux, Ubuntu 18.04.2 LTS

Summary

I have role which uses fetch module (documentation is here https://docs.ansible.com/ansible/latest/modules/fetch_module.html), where only required fields are dest and src. When I open yaml file with this module, VSCode is complaining about 'Missing property "path" '. I am using Ansible 2.6.3. I am getting this error while editing role. Also I tried restart VSCode, but the problem persists. When I disabled this module, problem disappeared. Here is the screenshot of mentioned problem
Screenshot from 2019-04-16 12-20-33

Reproduce steps

Create Ansible role with fetch module with installed VSCode and YAML extension.

Expected Results

Fetch module check looks for the "src" and "dest" properties.

Actual Results

Fetch module check looks only for the "path" property.

bug schema_issue upstream

Most helpful comment

Any movement on this? I'm seeing the same thing for the template module now on Ansible 2.8

All 5 comments

Hi, after looking at the schema that was set it looks like the schema is wrong, not this extension. You can verify this by searching for "fetch" in the schema and it looks like for some reason path is required. Since we are automatically pulling in schemas from the schema store we don't have control over the schemas themselves so you'll have to file the issue here.

However, I've noticed that the default version that is pulled in is ansible 2.5 and you are using ansible 2.6 so perhaps using this schema might work better.

You can set this by adding:

yaml.schemas: {
    "http://json.schemastore.org/ansible-stable-2.6": "my_file_name"
}

into your settings and it should pick it up. Let me know if it works!

You might have to disable the schema store setting via yaml.schemaStore.enable setting if you are still seeing the error and have set the schema like above, otherwise both schemas will apply to the file.

Hi, thank you for your response.

When I disabled schema store via yaml.schemaStore, the issue disappeared. When I tried to change yaml.schema to use Ansible 2.6 schema, issue persists. I also tried to restart VS code after changing settings.json. I also tried substitute my_file_name with different values, but without any effect. Do you have any suggestions, what regex should I use for all my YAML files?

yaml.schemas: {
    "http://json.schemastore.org/ansible-stable-2.6": "/*"
}

or

yaml.schemas: {
    "http://json.schemastore.org/ansible-stable-2.6": "main.yml"
}

or

yaml.schemas: {
    "http://json.schemastore.org/ansible-stable-2.6": "*.yml"
}

Thanks for getting this far @matus-cuper - same thing here. I add this to my settings so that YAML files in my host_vars don't throw errors:

    "yaml.schemas": {
      "http://json.schemastore.org/ansible-stable-2.7": "playbooks/roles/*"
    }

But fetch still shows the error for path. Many ansible users also use latest, though the newest schema is 2.7 and it looks like there are no scripts here that generate the schemas nor did I find them as a resource somewhere else. Rather, it looks like they are contributed as the pull request of The Beast: https://github.com/SchemaStore/schemastore/pull/666

Perhaps the author will be able to help... I'll ask.

Any movement on this? I'm seeing the same thing for the template module now on Ansible 2.8

I also found a few more places and with no solution here I just installed the Ansible extension and then switch the file type (bottom-right of Code) to Ansible in stead of YAML.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kace91 picture kace91  路  7Comments

tracker1 picture tracker1  路  5Comments

shadowzen1978 picture shadowzen1978  路  7Comments

rylnd picture rylnd  路  3Comments

data-ux picture data-ux  路  7Comments