{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/squirrelscan-com/json-schema/squirrelscan-com-audit-comparison-schema.json",
  "title": "AuditComparison",
  "description": "What changed between two completed audits of a website. Only the fields a CI client needs are listed; others may be present.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/squirrelscan-com-openapi.json#/components/schemas/AuditComparison",
  "type": "object",
  "properties": {
    "base": {
      "type": [
        "object",
        "null"
      ],
      "description": "The older run (`runId`, `reportId`, `auditedAt`, `healthScore`), or null for the first audit."
    },
    "head": {
      "type": "object",
      "description": "The newer run (`runId`, `reportId`, `auditedAt`, `healthScore`, `failed`, `warnings`, `passed`, `totalPages`, `status`, and `statusReasonCode` when the audit is `failed`, `blocked` or `partial`: `dns`, `tls`, `connection`, `timeout`, `http_4xx`, `http_5xx`, `redirect`, `robots`, `unknown`, `max_duration` or `crawl_timeout`)."
    },
    "firstRun": {
      "type": "boolean",
      "description": "True when there is no earlier completed audit: nothing is compared."
    },
    "changed": {
      "type": "boolean"
    },
    "totals": {
      "type": "object",
      "description": "Findings per kind, counted over every finding.",
      "additionalProperties": {
        "type": "integer"
      }
    },
    "newBySeverity": {
      "type": "object",
      "description": "Findings of kind `new` by rule severity (`error`, `warning`, `info`), counted over every finding.",
      "additionalProperties": {
        "type": "integer"
      }
    },
    "findings": {
      "type": "array",
      "description": "Rows, ordered new, worsened, resolved, improved, then the kinds asked for with `include`; clipped by `limit`.",
      "items": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "new",
              "resolved",
              "worsened",
              "improved",
              "unchanged",
              "still_open",
              "not_crawled",
              "not_checked"
            ]
          },
          "ruleId": {
            "type": "string"
          },
          "ruleName": {
            "type": "string"
          },
          "severity": {
            "type": "string",
            "enum": [
              "error",
              "warning",
              "info"
            ]
          },
          "pageUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "locator": {
            "type": [
              "string",
              "null"
            ]
          },
          "skipReason": {
            "type": "string",
            "description": "Why a `not_checked` finding was not judged."
          }
        },
        "additionalProperties": true
      }
    },
    "findingsTruncated": {
      "type": "boolean"
    },
    "comparisonIncomplete": {
      "type": "boolean",
      "description": "A report exceeded the comparison's finding cap: new and resolved counts are not reliable."
    },
    "resolutionEvidence": {
      "type": "string",
      "enum": [
        "page_findings",
        "signal",
        "none"
      ]
    },
    "notes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "additionalProperties": true
}