redhat-developer / redhat-developer/vscode-yaml

Valid YML causes schema validation problems

Open
#1,227 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

needs-info
Dominant language
TypeScript
Stars
830
Forks
260
Avg merge
5h 43m
Merged PRs (30d)
1

Description

Describe the bug

I'm getting an Unexpected property validation error for a Google Cloud Workflows yaml file (actually all files of this type generate the same problem). The YAML file seems to be valid according to the schema (which I'm setting explicitly in the file). Disabling the validation doesn't work either.

It looks like this has to do with the top level property, the validation works just fine (and detects real problems) in the rest of the file and I can also disable the validation in those parts.

Expected Behavior

No validation error should be generated.

Current Behavior

There's an incorrect Unexpected property for the top level property.

Image

Steps to Reproduce

See below the snippet that causes this problem (although all my workflows files have the same behavior):

# yaml-language-server: $schema=https://www.schemastore.org/workflows.json
main:
  params: [input]
  steps:
    - init:
        assign:
          - message: "Hello World"
          - count: 0
    - check_condition:
        switch:
          - condition: ${count < 5}
            next: log_message
        next: finish
    - log_message:
        call: sys.log
        args:
          text: ${message + " " + count}
          severity: "INFO"
        next: increment
    - increment:
        assign:
          - count: ${count + 1}
        next: check_condition
    - finish:
        return: ${"Done. Counted to " + count}

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)

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 provided Google Cloud Workflows YAML snippet and the referenced workflows.json schema, then trace how the top-level property is validated and why validation cannot be disabled there. Done means the valid workflow produces no false Unexpected property error while genuine nested validation errors and disabling validation continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
vscode, yaml
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.