redhat-developer / yaml-language-server

Language Server for YAML Files
MIT License
1.06k stars 260 forks source link

Cannot Load content for: schema.json Unknown schema: file #948

Open ghost opened 8 months ago

ghost commented 8 months ago

Describe the bug

Getting this error when any validation error occurs in yaml. It shows a highlight to jump to schema location. When clicking on it, then it is giving this error.

Expected Behavior

It should jump to the schema location.

Current Behavior

Getting this error: Cannot Load content for: /schemas/event.json. Unknown schema: 'file'

Steps to Reproduce

Here is the schema:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Godspeed Event Delaration",
  "description": "A recipe for Godspeed events.",
  "type": "object",
  "patternProperties": {
    "(kafka)(.)(options)(.)([a-zA-Z0-9:/-]+){1}": {
      "description": "eventKey",
      "type": "object",
      "examples": [
        {
          "summary": "summary of the event"
        }
      ],
      "additionalProperties": false,
      "properties": {
        "description": {
          "$ref": "#/definitions/description"
        },
        "summary": {
          "$ref": "#/definitions/summary"
        },
        "fn": {
          "$ref": "#/definitions/fn"
        },
        "abc": {
          "type": "object"
        }
      }
    },
    "(http)(.)(get|put|post|delete)(.)([a-zA-Z0-9:/-]+){1}": {
      "description": "eventKey",
      "type": "object",
      "examples": [
        {
          "summary": "summary of the event"
        }
      ],
      "properties": {
        "description": {
          "$ref": "#/definitions/description"
        },
        "summary": {
          "$ref": "#/definitions/summary"
        },
        "fn": {
          "$ref": "#/definitions/fn"
        },
        "params": {
          "$ref": "#/definitions/params"
        },
        "body": {
          "$ref": "#/definitions/body"
        },
        "authn": {
          "$ref": "#/definitions/authn"
        },
        "on_validation_error": {
          "$ref": "#/definitions/on_validation_error"
        },
        "responses": {
          "$ref": "#/definitions/responses"
        }
      }
    }
  },
  "definitions": {
    "params": {
      "type": "array",
      "title": "Params",
      "description": "Define list of params from path, query, cookie or header",
      "items": {
        "$ref": "#/definitions/param"
      },
      "minItems": 1
    },
    "param": {
      "type": "object",
      "additionalItems": false,
      "properties": {
        "name": {
          "type": "string",
          "title": "Name",
          "description": "Name of Params",
          "default": "name_one"
        },
        "in": {
          "$ref": "#/definitions/in"
        },
        "required": {
          "type": "boolean",
          "default": false
        },
        "description": {
          "type": "string",
          "title": "Description",
          "description": "Detail description of Params",
          "default": "Detailed description of the Params",
          "maxLength": 50,
          "minLength": 2
        },
        "schema": {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "string"
            }
          }
        },
        "examples": {
          "type": "object"
        }
      },
      "required": [
        "name",
        "in"
      ]
    },
    "description": {
      "type": "string",
      "title": "Description",
      "description": "Detail description of Event",
      "default": "Detailed description of the Event",
      "maxLength": 50,
      "minLength": 2
    },
    "summary": {
      "type": "string",
      "title": "Summary",
      "description": "Quick summary of Event",
      "default": "Quick summary of the Event",
      "maxLength": 50,
      "minLength": 2
    },
    "fn": {
      "type": "string"
    },
    "in": {
      "type": "string",
      "default": "query",
      "oneOf": [
        {
          "const": "query",
          "title": "Query"
        },
        {
          "const": "path",
          "title": "Path"
        },
        {
          "const": "header",
          "title": "Header"
        }
      ]
    },
    "body": {
      "type": "object",
      "properties": {
        "description": {
          "type": "string",
          "title": "Description",
          "default": "This is the Description of body"
        },
        "required": {
          "type": "boolean",
          "title": "Required or Not",
          "description": "if this param is required then set it to true else false",
          "default": false
        },
        "content": {
          "type": "object",
          "properties": {
            "application/json": {
              "type": "object",
              "properties": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "default": "string"
                    }
                  },
                  "required": [
                    "type"
                  ]
                },
                "properties": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "default": "string"
                        }
                      }
                    },
                    "email": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "default": "string"
                        }
                      }
                    }
                  },
                  "required": []
                }
              },
              "required": [
                "schema"
              ]
            }
          },
          "required": [
            "application/json"
          ]
        }
      },
      "required": [
        "content"
      ]
    },
    "authn": {
      "type": "boolean",
      "title": "Authentication and Authorization",
      "description": "You can add JWT Token verification, details of how to do it is in https://docs.godspeed.systems/docs/microservices/authen-author",
      "default": false
    },
    "on_validation_error": {
      "type": "string",
      "default": "com.jfs.handle_validation_error"
    },
    "responses": {
      "type": "object",
      "properties": {
        "200": {
          "type": "object",
          "properties": {
            "description": {
              "type": "string",
              "default": "OK"
            },
            "content": {
              "type": "object",
              "properties": {
                "application/json": {
                  "type": "object",
                  "properties": {
                    "schema": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "default": "object"
                        }
                      },
                      "required": [
                        "type"
                      ]
                    }
                  },
                  "required": [
                    "schema"
                  ]
                }
              },
              "required": [
                "application/json"
              ]
            }
          },
          "required": [
            "content"
          ]
        }
      },
      "required": [
        "200"
      ]
    }
  }
}

This is the highlighter image: image

Environment