{
  "$defs": {
    "CaseResult": {
      "additionalProperties": false,
      "properties": {
        "after": {
          "anyOf": [
            {
              "$ref": "#/$defs/Snapshot"
            },
            {
              "type": "null"
            }
          ]
        },
        "before": {
          "anyOf": [
            {
              "$ref": "#/$defs/Snapshot"
            },
            {
              "type": "null"
            }
          ]
        },
        "errors": {
          "items": {
            "$ref": "#/$defs/ExecutionError"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "failures": {
          "items": {
            "$ref": "#/$defs/Failure"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "fixed": {
          "anyOf": [
            {
              "$ref": "#/$defs/Snapshot"
            },
            {
              "type": "null"
            }
          ]
        },
        "id": {
          "type": "string"
        },
        "rules": {
          "additionalProperties": {
            "anyOf": [
              {
                "$ref": "#/$defs/Rule"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": "object"
        },
        "secondFix": {
          "anyOf": [
            {
              "$ref": "#/$defs/Snapshot"
            },
            {
              "type": "null"
            }
          ]
        },
        "status": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "status",
        "failures",
        "errors"
      ],
      "type": "object"
    },
    "Diagnostic": {
      "additionalProperties": false,
      "properties": {
        "column": {
          "type": "integer"
        },
        "line": {
          "type": "integer"
        },
        "message": {
          "type": "string"
        },
        "path": {
          "type": "string"
        },
        "paths": {
          "items": {
            "type": "string"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "pathsTruncated": {
          "type": "boolean"
        },
        "rule": {
          "type": "string"
        },
        "severity": {
          "type": "string"
        },
        "source": {
          "type": "string"
        }
      },
      "required": [
        "rule",
        "severity",
        "path",
        "source",
        "line",
        "column",
        "message"
      ],
      "type": "object"
    },
    "EvidenceLocation": {
      "additionalProperties": false,
      "properties": {
        "column": {
          "type": "integer"
        },
        "line": {
          "type": "integer"
        }
      },
      "required": [
        "line",
        "column"
      ],
      "type": "object"
    },
    "ExecutionError": {
      "additionalProperties": false,
      "properties": {
        "caseId": {
          "type": "string"
        },
        "code": {
          "enum": [
            "invalid_suite",
            "invalid_selection",
            "input_error",
            "invalid_document",
            "ruleset_error",
            "function_load_error",
            "unknown_function",
            "rule_configuration",
            "function_error",
            "autofix_error",
            "rule_panic",
            "rule_timeout",
            "lookup_error",
            "cancelled",
            "deadline_exceeded",
            "execution_error",
            "missing_evidence",
            "incomplete_paths",
            "dependency_error",
            "ignore_file_error",
            "bundle_error",
            "invalid_arguments",
            "worker_error",
            "internal_error"
          ]
        },
        "function": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "phase": {
          "enum": [
            "load",
            "before",
            "after",
            "fixed",
            "secondFix",
            "change",
            "fixOutput",
            "bundle",
            "command"
          ]
        },
        "ruleId": {
          "type": "string"
        },
        "source": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message",
        "phase"
      ],
      "type": "object"
    },
    "Failure": {
      "additionalProperties": false,
      "properties": {
        "actual": {},
        "assertion": {
          "type": "string"
        },
        "code": {
          "type": "string"
        },
        "expected": {}
      },
      "required": [
        "assertion",
        "code",
        "expected",
        "actual"
      ],
      "type": "object"
    },
    "FileIdentity": {
      "additionalProperties": false,
      "properties": {
        "path": {
          "type": "string"
        },
        "sha256": {
          "type": "string"
        }
      },
      "required": [
        "path",
        "sha256"
      ],
      "type": "object"
    },
    "Manifest": {
      "additionalProperties": false,
      "properties": {
        "caseIds": {
          "items": {
            "type": "string"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "files": {
          "items": {
            "$ref": "#/$defs/FileIdentity"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "limitations": {
          "items": {
            "type": "string"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "options": {
          "$ref": "#/$defs/Options"
        },
        "reproducible": {
          "type": "boolean"
        },
        "sampleLimit": {
          "type": "integer"
        },
        "suite": {
          "type": "string"
        },
        "suiteSha256": {
          "type": "string"
        },
        "vacuumVersion": {
          "type": "string"
        }
      },
      "required": [
        "suiteSha256",
        "caseIds",
        "sampleLimit",
        "vacuumVersion",
        "suite",
        "options",
        "files",
        "reproducible",
        "limitations"
      ],
      "type": "object"
    },
    "Options": {
      "additionalProperties": false,
      "properties": {
        "lookupTimeoutMs": {
          "minimum": 0,
          "type": "integer"
        },
        "maxRuleConcurrency": {
          "minimum": 0,
          "type": "integer"
        },
        "nestedRefsDocContext": {
          "type": "boolean"
        },
        "remote": {
          "type": "boolean"
        },
        "resolveAllRefs": {
          "type": "boolean"
        },
        "runTimeoutMs": {
          "minimum": 0,
          "type": "integer"
        },
        "timeoutMs": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "type": "object"
    },
    "Rule": {
      "additionalProperties": false,
      "properties": {
        "autoFixFunction": {
          "type": "string"
        },
        "category": {
          "anyOf": [
            {
              "$ref": "#/$defs/RuleCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "description": {
          "type": "string"
        },
        "documentationUrl": {
          "type": "string"
        },
        "formats": {
          "items": {
            "type": "string"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "given": {},
        "howToFix": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "recommended": {
          "type": "boolean"
        },
        "resolved": {
          "type": "boolean"
        },
        "severity": {
          "type": "string"
        },
        "then": {},
        "type": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "RuleCategory": {
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "id"
      ],
      "type": "object"
    },
    "RuleEvidence": {
      "additionalProperties": false,
      "properties": {
        "findings": {
          "type": "integer"
        },
        "fixed": {
          "type": "integer"
        },
        "ignored": {
          "type": "integer"
        },
        "invocations": {
          "type": "integer"
        },
        "matches": {
          "type": "integer"
        },
        "reason": {
          "type": "string"
        },
        "resolved": {
          "type": "boolean"
        },
        "ruleId": {
          "type": "string"
        },
        "selectors": {
          "items": {
            "$ref": "#/$defs/SelectorEvidence"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "status": {
          "type": "string"
        }
      },
      "required": [
        "ruleId",
        "status",
        "resolved",
        "selectors",
        "matches",
        "invocations",
        "findings",
        "ignored",
        "fixed"
      ],
      "type": "object"
    },
    "SelectorEvidence": {
      "additionalProperties": false,
      "properties": {
        "given": {
          "type": "string"
        },
        "matches": {
          "type": "integer"
        },
        "samples": {
          "items": {
            "$ref": "#/$defs/EvidenceLocation"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "truncated": {
          "type": "boolean"
        }
      },
      "required": [
        "given",
        "matches"
      ],
      "type": "object"
    },
    "Snapshot": {
      "additionalProperties": false,
      "properties": {
        "diagnostics": {
          "items": {
            "$ref": "#/$defs/Diagnostic"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "evidence": {
          "items": {
            "$ref": "#/$defs/RuleEvidence"
          },
          "type": [
            "array",
            "null"
          ]
        }
      },
      "required": [
        "diagnostics",
        "evidence"
      ],
      "type": "object"
    }
  },
  "$id": "https://quobix.com/vacuum/schemas/test-result-v1.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "cases": {
      "items": {
        "$ref": "#/$defs/CaseResult"
      },
      "type": [
        "array",
        "null"
      ]
    },
    "errors": {
      "items": {
        "$ref": "#/$defs/ExecutionError"
      },
      "type": [
        "array",
        "null"
      ]
    },
    "exitCode": {
      "enum": [
        0,
        1,
        2
      ]
    },
    "manifest": {
      "$ref": "#/$defs/Manifest"
    },
    "status": {
      "enum": [
        "passed",
        "failed",
        "error"
      ]
    },
    "version": {
      "const": 1
    }
  },
  "required": [
    "version",
    "status",
    "exitCode",
    "cases",
    "errors",
    "manifest"
  ],
  "title": "vacuum test result v1",
  "type": "object"
}
