Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to properly interpret github workflows schema #691

Open
ssbarnea opened this issue Feb 4, 2022 · 7 comments
Open

Failure to properly interpret github workflows schema #691

ssbarnea opened this issue Feb 4, 2022 · 7 comments

Comments

@ssbarnea
Copy link
Member

ssbarnea commented Feb 4, 2022

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

  1. create a file under .github/workflows/sample.yml
  2. put the snipped above in it
  3. check for false positive result
@gorkem
Copy link
Collaborator

gorkem commented Feb 21, 2022

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

@ssbarnea
Copy link
Member Author

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.

@ssbarnea
Copy link
Member Author

ssbarnea commented Feb 22, 2022

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:
      - "**"

@ssbarnea
Copy link
Member Author

ssbarnea commented Mar 4, 2022

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.

@ssbarnea
Copy link
Member Author

ssbarnea commented Apr 4, 2022

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

@oleksandr-ivanov-ah
Copy link

oleksandr-ivanov-ah commented Nov 19, 2022

Do you have any updates on this bug. Yaml extension doesn't work with GitHub Workflows

@oleksandr-ivanov-ah
Copy link

I have this issue when "yaml.disableAdditionalProperties": true. If i set "yaml.disableAdditionalProperties": false, yaml extension works as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants