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

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

Open
ghost opened this issue Jan 18, 2024 · 0 comments
Open

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

ghost opened this issue Jan 18, 2024 · 0 comments

Comments

@ghost
Copy link

ghost commented Jan 18, 2024

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"
      ]
    }
  }
}
  • settings.json:
"yaml.schemas": {
    "<local absolute path>/schemas/event.json": "src/events/**/*.yaml",
    "https://raw.githubusercontent.com/godspeedsystems/language-tools/main/schemas/workflow.json": "src/functions/**/*.yaml",
    "https://raw.githubusercontent.com/godspeedsystems/language-tools/main/schemas/datasource.json": "src/datasources/**/*.yaml"
  }

This is the highlighter image:
image

Environment

  • Linux
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

0 participants