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

[object Object] with malformed type definition on hover #788

Closed
1 of 4 tasks
sbdchd opened this issue Jun 26, 2022 · 0 comments · Fixed by redhat-developer/yaml-language-server#740
Closed
1 of 4 tasks
Assignees
Labels
Milestone

Comments

@sbdchd
Copy link

sbdchd commented Jun 26, 2022

Describe the bug

With the following malformed schema:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.com/product.schema.json",
  "title": "servers",
  "type": "object",
  "additionalProperties": {
    "type": {
      "$ref": "#/$defs/server"
    }
  },
  "$defs": {
    "server": {
      "type": "object",
      "required": [
        "id",
        "cpu",
        "mem",
        "storage"
      ],
      "properties": {
        "id": {
          "description": "The unique identifier for a product",
          "type": "string"
        },
        "cpu": {
          "description": "The unique identifier for a product",
          "type": "number"
        },
        "mem": {
          "description": "The unique identifier for a product",
          "type": "string"
        },
        "storage": {
          "description": "The unique identifier for a product",
          "type": "string"
        }
      }
    }
  }
}

where we are using:

  "additionalProperties": {
    "type": {
      "$ref": "#/$defs/server"
    }
  },

instead of

  "additionalProperties": {
    "$ref": "#/$defs/server"
  },

with the following yaml

foo:
  id: foo-1
  cpu: 1
  mem: 12GB
  storage: 200GB

on hover we get:

Incorrect type. Expected "[object Object]". yaml-schema: servers

Expected Behavior

the editor should show something besides [object Object] maybe unknown or error!

Current Behavior

on hover with malformed schema the tooltip shows [object Object]

Steps to Reproduce

  1. create yaml and json schema
  2. setup vscode to connect the two
  3. open yaml and see incorrect error message on hover

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants