vscode-yaml icon indicating copy to clipboard operation
vscode-yaml copied to clipboard

Possible bug in allOf processing

Open rssh22 opened this issue 10 months ago • 1 comments

Describe the bug

vscode linter shows an incorrect message of "Property x is not allowed" if the property is defined in an object referenced in an allOf statement

Expected Behavior

o3:
  p1: www
  p2: 2
  p3: false

validator shouldn't show errors (Property p1 is not allowed, Property p2 is not allowed, Property p3 is not allowed)

for this schema:

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "additionalProperties": false,
    "definitions": {
        "o1": {
            "type": "object",
            "properties": {
                "p1": {
                    "type": "string"
                },
                "p2": {
                    "type": "number"
                }
            },
            "required": [
                "p1",
                "p2"
            ]
        },
        "o2": {
            "type": "object",
            "properties": {
                "p3": {
                    "type": "boolean"
                }
            },
            "required": [
                "p3"
            ]
        }
    },
    "properties": {
        "o3": {
            "type": "object",
            "allOf": [
                {
                    "$ref": "#/definitions/o1"
                },
                {
                    "$ref": "#/definitions/o2"
                }
            ]
        }
    },
    "required": [
        "o3"
    ]
}

Current Behavior

The validator shows the manifest as incorrect.

Steps to Reproduce

  1. Define the schema an associate it to the manifest a.test.yaml
  2. fill the manifest with the above manifest example
  3. check the errors

Environment

  • [ ] Windows
  • [ ] Mac
  • [X ] Linux
  • [ ] other (please specify)

rssh22 avatar Dec 11 '24 14:12 rssh22