redhat-developer / redhat-developer/vscode-yaml

Broken completion for allof inside ref

Open
#1,085 0 comments 0 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

Expected Behavior

Completion returns key:\n\t

Current Behavior

Completion returns key

Steps to Reproduce

  1. Insert # yaml-language-server: $schema=example.schema.json as file header
  2. Try a working example and observe expected behavior:
{
  "title": "Values",
  "type": "object",
  "$schema": "http://json-schema.org/schema#",
  "$ref": "#/$defs/instance",
  "required": [
    "thisinstance"
  ],
  "$defs": {
    "union": {
      "type": "object",
      "properties": {
        "config0": {
          "type": "string"
        }
      }
    },
    "instance": {
      "type": "object",
      "properties": {
        "thisinstance": {
          "$ref": "#/$defs/union"
        }
      }
    }
  }
}
  1. Try a broken example and observe undesired behavior
{
  "title": "Values",
  "type": "object",
  "$schema": "http://json-schema.org/schema#",
  "$ref": "#/$defs/instance",
  "required": [
    "thisinstance"
  ],
  "$defs": {
    "union": {
      "allOf": [
        {
          "type": "object",
          "properties": {
            "config0": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "config1": {
              "type": "string"
            }
          }
        }
      ]
    },
    "instance": {
      "type": "object",
      "properties": {
        "thisinstance": {
          "$ref": "#/$defs/union"
        }
      }
    }
  }
}

Environment

  • Linux

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

Reproduce the completion behavior using the schema examples and the YAML language-server schema header described in the issue. Completion should return key:\n\t for the allOf-inside-$ref case, matching the working example rather than returning only key.

Written by the indexing model from the issue text.

Assessment

Tech stack
json, typescript, yaml
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.