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

IntelliSence shows just enum subschema value when there is the same named property as the single enum value #1024

Open
1 of 4 tasks
EmilyGraceSeville7cf opened this issue May 26, 2024 · 0 comments

Comments

@EmilyGraceSeville7cf
Copy link

EmilyGraceSeville7cf commented May 26, 2024

Describe the bug

IntelliSence shows just one of two oneOf branches when both should be shown. oneOf branches:

  • a branch with a single-valued enum with some value (referred later as {{value}})
  • a branch with an object with a property named as {{value}}

image

Note: the same applies for anyOf too.

Expected Behavior

Both branches suggested in IntelliSence.

Current Behavior

A branch with a single-valued enum suggested.

Steps to Reproduce

  1. Create schema schema.json with this content:
{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "array",
    "items": {
        "oneOf": [
            {
                "$comment": "A branch with a single-valued enum which is shown in IntelliSense suggestions",
                "type": "string",
                "enum": [
                    "something"
                ]
            },
            {
                "$comment": "A branch with a single-valued enum which is hidden from IntelliSense suggestions",
                "type": "object",
                "properties": {
                    "something": {
                        "$comment": "Note that enum value 'something' named the same as this property, which is the source of an issue",
                        "title": "something",
                        "default": "default"
                    }
                },
                "additionalProperties": false
            }
        ]
    }
}
  1. Create test.yaml file and refer inside it to schema.json:
# yaml-language-server: $schema=schema.json

- # cursor is right before the hash sign
  1. Press Ctrl+Space and get just one oneOf branch suggested.

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)
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

1 participant