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

Error "Matches multiple schemas" is recognized in v1.2.2 but not in v1.3.0 #683

Closed
yaaraze opened this issue Jan 30, 2022 · 1 comment
Closed
Assignees
Milestone

Comments

@yaaraze
Copy link

yaaraze commented Jan 30, 2022

Describe the bug

On version 1.2.2 the extension shows the problem in my YAML, but in version 1.3.0 it doesn't anymore.
This is my schema (some stuff removed):

{
  "$schema": "http://json-schema.org/draft-07/schema",
  "definitions": {
    "Object": {
      "type": "object",
      "properties": {
        "object": {
          "type": "string"
        },
        "properties": {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "$ref": "#/definitions/Property"
              }
            ]
          }
        }
      },
      "required": ["object"],
      "additionalProperties": false
    },
    "Property": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "name": {
              "type": "string"
            },
            "source": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/PropertySource"
              }
            }
          },
          "required": ["name"],
          "additionalProperties": false
        }
      ]
    },
    "PropertySource": {
      "type": "object",
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "field": {"type": "string"},
            "if": {"type": ["string", "boolean"]}
          },
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "value": true,
            "if": {"type": ["boolean"]}
          },
          "additionalProperties": false
        }
      ]
    }
  },
  "type": "object",
  "properties": {
    "config": {
      "type": "object"
    },
    "objects": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/Object"
      }
    }
  },
  "additionalProperties": false
}

And this is the yaml:

objects:
  - object: OBJ
    properties:
      - name: PROP
        source:
          - if: true
          - value: true

Expected Behavior

The first item under "source" in the yaml is illegal under the schema ("Matches multiple schemas when only one must validate").
When I downgrade the yaml extension to 1.2.2 in vscode it marks it red with the error message

Current Behavior

On 1.3.0 it doesn't find the issue.
Other errors in 1.3.0 are recognized, like if the yaml is:

objects:
  - object: OBJ
    properties:
      - name: PROP
        source:
          - blabla: true
          - value: true

It errors "Property blabla is not allowed".

Environment

  • [v] Mac
@gorkem
Copy link
Collaborator

gorkem commented Jan 31, 2022

I guess redhat-developer/yaml-language-server#623 has changed this behavior. @evidolob is this intended?

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

4 participants