vscode-yaml
vscode-yaml copied to clipboard
Failure to properly interpret github workflows schema
Describe the bug
I discovered a bug in yaml language server which makes it confused and report a false positive with current github-workflows schemas, even if these schemas are valid, tested (ajv) to ensure they accept that values.
on:
create:
tags: # <-- this is valid but extension believes create should only allow arrays
- "**"
Schema: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json
postive-test file for that schema that includes the our bug https://github.com/SchemaStore/schemastore/blob/master/src/test/github-workflow/918.json#L5
Expected Behavior
Pass validating with schemas that are already tested.
Current Behavior
Property tags is not allowed.
is reported when it should not be.
Steps to Reproduce
- create a file under
.github/workflows/sample.yml
- put the snipped above in it
- check for false positive result
Are you still able to reproduce the issue? I do not seem to get the same problem. I am on vscode-yaml 1.4.0
I was trying to reproduce the bug again with the newer version but I got stuck on another new issue, it reports "Multiple JSON Schemas..." and I am unable to deselect them in any way.
I even removed the local schema patterns and reloaded the window but it still does the same thing. I have no idea on how to make it use a single schema file. I guess that might be a regression introduced by the new version of yaml extension or vscode update.
I figured it out where the double assignment came from (user config and workspace config, still disabling or unselecting from the dropdown not possible).
So basically, I removed local schemas assignments and reset the schema cache and I was able to reproduce the issue. tags
still gets highlighted as not allowed, even if schema allows it. There is even a test that is passing at https://github.com/SchemaStore/schemastore/blob/master/src/test/github-workflow/918.json with their schema verifications, but our vscode-yaml reports that as not accepted.
on:
create:
tags:
- "**"
I can confirm that another schema that is incorrectly loaded is https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/prettierrc.json --- any prettier config reports as broken, even if is correct. Another case of anyOf
not working as expected.
This but still reproduces with version 1.6.0, I am also adding some test files for these schemas and they are passing schema testing. Still, our extension gets totally confused by the use of anyOf
.
See https://github.com/SchemaStore/schemastore/pull/2162/files
Do you have any updates on this bug. Yaml extension doesn't work with GitHub Workflows
I have this issue when "yaml.disableAdditionalProperties": true. If i set "yaml.disableAdditionalProperties": false, yaml extension works as expected