redhat-developer / redhat-developer/vscode-yaml

Failure to properly interpret github workflows schema

Open
#691 7 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
829
Forks
260
Avg merge
5h 43m
Merged PRs (30d)
1

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproducer in .github/workflows/sample.yml and compare it with the linked github-workflow.json schema and positive test 918.json. Trace how the YAML language server interprets the on.create.tags value; done means the valid workflow passes validation without the Property tags is not allowed. diagnostic.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.