Skip to content

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

@yaaraze

Description

@yaaraze

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions