Skip to content

IntelliSense incorrectly narrows anyOf branches when one variant requires additional properties #307

@Jazcash

Description

@Jazcash

When authoring against a schema that can branch into a route that requires more properties, or a route that requires no additional properties, VSCode's intellisense has some unexpected behaviour:

Schema:

{
    "anyOf": [
        {
            "type": "object",
            "required": [
                "type",
                "thing"
            ],
            "properties": {
                "type": {
                    "type": "string",
                    "const": "A"
                },
                "thing": {
                    "type": "number"
                }
            }
        },
        {
            "type": "object",
            "required": [
                "type"
            ],
            "properties": {
                "type": {
                    "type": "string",
                    "const": "B"
                }
            }
        }
    ]
}

Expected behaviour:

Should show both "A" and "B" as possibilities.

Actual behaviour:

Image

Yet, when hovering over the yellow squiggle, it shows this, which is also not true:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions