{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://unpkg.com/better-supabase/schemas/doctor-report-v1.json",
  "title": "better-supabase doctor report",
  "description": "Output of `better-supabase doctor --json`.",
  "type": "object",
  "additionalProperties": false,
  "required": ["$schema", "version", "tool", "summary", "findings"],
  "properties": {
    "$schema": { "type": "string" },
    "version": { "const": 1 },
    "tool": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "version"],
      "properties": {
        "name": { "const": "better-supabase" },
        "version": { "type": "string" }
      }
    },
    "summary": {
      "type": "object",
      "additionalProperties": false,
      "required": ["errors", "warnings", "infos"],
      "properties": {
        "errors": { "type": "integer", "minimum": 0 },
        "warnings": { "type": "integer", "minimum": 0 },
        "infos": { "type": "integer", "minimum": 0 }
      }
    },
    "findings": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["code", "severity", "title", "message", "help"],
        "properties": {
          "code": {
            "enum": [
              "BS100",
              "BS103",
              "BS106",
              "BS107",
              "BS108",
              "BS109",
              "BS110",
              "BS111",
              "BS112",
              "BS113",
              "BS114",
              "BS115",
              "BS116",
              "BS200",
              "BS204",
              "BS205",
              "BS206",
              "BS207",
              "BS208",
              "BS209",
              "BS210",
              "BS211",
              "BS212",
              "BS213",
              "BS214",
              "BS215",
              "BS216",
              "BS217",
              "BS218",
              "BS219",
              "BS220",
              "BS221",
              "BS222",
              "BS301",
              "BS302",
              "BS303",
              "BS304",
              "BS305",
              "BS306",
              "BS307",
              "BS308",
              "BS309",
              "BS310",
              "BS311",
              "BS312",
              "BS313",
              "BS314",
              "BS315",
              "BS316",
              "BS317",
              "BS318",
              "BS319",
              "BS320",
              "BS321",
              "BS322",
              "BS323",
              "BS324",
              "BS325",
              "BS326",
              "BS327",
              "BS401",
              "BS402",
              "BS403",
              "BS404",
              "BS405",
              "BS406",
              "BS407",
              "BS408",
              "BS409",
              "BS410",
              "BS411",
              "BS412",
              "BS501",
              "BS502"
            ]
          },
          "severity": { "enum": ["error", "warning", "info"] },
          "title": { "type": "string" },
          "message": { "type": "string" },
          "target": {
            "type": "string",
            "description": "What the finding is about, e.g. `public.customers` or `.env.local:SUPABASE_SECRET_KEY`."
          },
          "location": {
            "type": "object",
            "additionalProperties": false,
            "required": ["file", "line"],
            "properties": {
              "file": {
                "type": "string",
                "description": "Relative to the project root."
              },
              "line": { "type": "integer", "minimum": 1 }
            }
          },
          "object": {
            "type": "object",
            "additionalProperties": false,
            "required": ["kind", "schema", "name"],
            "properties": {
              "kind": { "enum": ["table", "function", "policy"] },
              "schema": { "type": "string" },
              "name": { "type": "string" },
              "table": {
                "description": "The table a policy is on.",
                "type": "string"
              }
            }
          },
          "help": { "type": "string", "format": "uri" }
        }
      }
    }
  }
}
