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

Possible bug in allOf processing #1074

Open
3 tasks
rssh22 opened this issue Dec 11, 2024 · 1 comment
Open
3 tasks

Possible bug in allOf processing #1074

rssh22 opened this issue Dec 11, 2024 · 1 comment

Comments

@rssh22
Copy link

rssh22 commented Dec 11, 2024

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
Copy link
Author

rssh22 commented Dec 11, 2024

This is from the output (YAML Support)

[Trace - 5:40:41 PM] Received response 'textDocument/codeAction - (55)' in 4ms.
Result: [
    {
        "title": "Jump to schema location (test.json)",
        "command": {
            "title": "JumpToSchema",
            "command": "jumpToSchema",
            "arguments": [
                "https://jschemas-gnx-ssp-r01a-id.apps.ocp-ges-pub-01.ocp.ms//schemas/arq-mss-r01/v1/std/test.json"
            ]
        },
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 3,
                        "character": 2
                    },
                    "end": {
                        "line": 3,
                        "character": 4
                    }
                },
                "message": "Property p3 is not allowed.",
                "data": {
                    "schemaUri": [
                        "https://jschemas-gnx-ssp-r01a-id.apps.ocp-ges-pub-01.ocp.ms//schemas/arq-mss-r01/v1/std/test.json"
                    ]
                },
                "code": 0,
                "severity": 1,
                "source": "yaml-schema: test"
            }
        ]
    }
]

[Trace - 5:42:40 PM] Received response 'textDocument/codeAction - (57)' in 1ms.
Result: [
    {
        "title": "Jump to schema location (test.json)",
        "command": {
            "title": "JumpToSchema",
            "command": "jumpToSchema",
            "arguments": [
                "https://jschemas-gnx-ssp-r01a-id.apps.ocp-ges-pub-01.ocp.ms//schemas/arq-mss-r01/v1/std/test.json"
            ]
        },
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 1,
                        "character": 2
                    },
                    "end": {
                        "line": 1,
                        "character": 4
                    }
                },
                "message": "Property p1 is not allowed.",
                "data": {
                    "schemaUri": [
                        "https://jschemas-gnx-ssp-r01a-id.apps.ocp-ges-pub-01.ocp.ms//schemas/arq-mss-r01/v1/std/test.json"
                    ]
                },
                "code": 0,
                "severity": 1,
                "source": "yaml-schema: test"
            }
        ]
    }
]


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