vscode-yaml: Uses the wrong schema, even when yaml.schemas is set
Describe the bug

I’m using this extension and the GitHub Actions YAML extension. The last three error messages (using the proper schema) are from that other extension. The erroneous errors above them are from this extension. Disabling the GitHub Actions extension makes those last three (correct, proper) errors disappear, leaving the false errors this extension is reporting.
The problem: this extension thinks my GitHub Actions workflow file is a “deploy php” file and so uses the wrong schema… simply because it has the word “deploy” in its file name. Change the name to build-test-deplox.yml and everything works. I can’t make this extension ignore YAML files and I can’t force this extension to use the correct schema (on the right, you can see the yaml.schemas setting being completely ignored).
Unfortunately for my .github/dependabot.yml file, I’ve had to disable this extension for now. Am I doing something wrong here?
Expected Behavior
Use https://json.schemastore.org/github-workflow for build-test-deploy.yml like I told it to
Current Behavior
Uses https://raw.githubusercontent.com/deployphp/deployer/master/src/schema.json instead
Steps to Reproduce
- Have
.github/workflows/build-test-deploy.ymlfile in your project - Observe this extension invoke the wrong schema
- Try to override the schema for that file (using both full path and simple file name)
- Observe this extension continue to invoke the wrong schema
Bonus: replace “https://json.schemastore.org/github-workflow” with “https://json.schemastore.org/github-workflowfdsfdsff”
in yaml.schemas and the extension recognizes that the schema does not exist, so it is receiving the proper schema from settings.json!
Environment
- Windows
- Mac
- Linux
- other (please specify)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 40
- Comments: 29 (1 by maintainers)
Commits related to this issue
- This is still an issue: https://github.com/redhat-developer/vscode-yaml/issues/397 — committed to johnbillion/user-switching by johnbillion 3 years ago
- feat: add multiple schema deletions (#397) * feat: add multiple schema deletions * fix: typing MODIFICATION_ACTIONS.deleteAll Co-authored-by: Petr Spacek <p-spacek@email.cz> — committed to bleach31/vscode-yaml by p-spacek 3 years ago
- Multi-parameters YAML File https://github.com/redhat-developer/vscode-yaml/issues/397 — committed to sha-cmd/Dyadic by sha-cmd 2 years ago
For those who don’t know how to set the schema settings with:
Simply press Ctrl+, in visual code > Extentions > Yaml > Edit in settings.json right after Yaml: completion
It looks like
"/.githhub/workflows/**/*.yml"is spelt wrong, it should probably be"/.github/workflows/**/*.yml". This issue is going to be fixed in the next release@czmola I’ve used the following work-around: add the following line on top of the yaml file that fails (usually one with
deployin the name, in my casedeploy.yml):That should do the trick until it’s fixed 😎
Interestingly enough, this issue only happens if the action is named
deploy.yml. It works perfectly fordeploy-dev.ymlor my build actions.Having the same problem, with any github workflow file named ‘*deploy*’. I’m unable to set the schema with:
I had the same issue but with another schema. For me,
hammerkit.jsonwas auto chosen when creating mybuild.ymlThe issue was solved by adding this at the top:
# yaml-language-server: $schema=https://json-schema.org/draft-07/schema#This was the schema that my other yaml file were using.
@evidolob with the fixed version of yaml-language-server installed, this issue is not resolved. Files named
deploy.ymlstill get the incorrect schema match.Looks like it is related to https://github.com/redhat-developer/yaml-language-server/issues/250
This seems like exactly what I should need, since the proper schema was not being found. But I tried it and it did not help. In the screenshot below, I have hovered over a variable in the
envsection. It should expect a list of any key-value pairs:I then double checked json.schemastore.org/github-workflow and it says that it should work, but it still doesn’t. The relevant snippet:
I’m not sure what I’m doing wrong. Is no one else having this syntax highlighting problem?
For now, I have just turned it off via:
in my
settings.jsonfile.I just ran into this same issue, and it definitely seems related to not only having
deployin the file name, but also position (maybe relative to symbol-separators?).docker_deploy.yml
deploy.yml
deploy_docker.yml
I’m having a similar issue with GitLab CI configuration file, which contains
deployin its name. I have tried adding gitlab schema into yaml.schemas, but it makes no difference.EDIT: It would be preferred if
yaml.schemaswould have higher priority than schema store.@fastlorenzo This doesn’t work for me, I’m getting another error:
FYI @JPinkney I still have issues for some templates
What is weird is that the descriptions are fine, but it still gives an error on the validation.
@piotr-cz for Ansible, it’s using this now https://raw.githubusercontent.com/ansible-community/schemas/main/f/ansible.json
@lazarillo it looks like the latest version has introduced some issues with how it interprets the GitHub Workflow schema: #691.
or the
ansible-role-2.9.jsonschema. if it is a tasklist in a role.Any luck on this? I just ran into it creating a github workflow called
deploy.yaml