{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.7/checks/run.schema.json",
  "$comment": "OpenEik 0.7: folded by tools/fold-schemas-0.7.mjs from the proposal checks, which 0.7 makes a rule (open questions, 169). Written by hand, not generated.",
  "title": "A run's result",
  "description": "What a runner found when it ran a building's suites (Part XXIII, 9): the suites, each check's status, each finding, and the counts.",
  "type": "object",
  "required": [
    "format",
    "at",
    "suites",
    "checks",
    "findings",
    "summary"
  ],
  "additionalProperties": false,
  "properties": {
    "format": {
      "const": "openeik-run/0.1"
    },
    "at": {
      "description": "The day the run judged waivers by, YYYY-MM-DD.",
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
    },
    "suites": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "name",
          "version",
          "layer",
          "required"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "version": {
            "type": "string",
            "minLength": 1
          },
          "layer": {
            "enum": [
              "base",
              "jurisdiction",
              "organisation",
              "project"
            ]
          },
          "required": {
            "description": "Whether its failures at the severity error block a merge (Part XXIII, 3, rule 6).",
            "type": "boolean"
          },
          "from": {
            "description": "Where the runner read it: the building's checks/ folder, the runner's own suites, or its caller.",
            "enum": [
              "building",
              "runner",
              "caller"
            ]
          },
          "picked": {
            "description": "True for a jurisdiction's pack the runner picked by the building's site's country, which no suite of the run extends (Part XXIII, 3, rule 2).",
            "const": true
          }
        }
      }
    },
    "notes": {
      "description": "What the runner says of the run as a whole, each an info that blocks nothing: that the site gives no country, so that no jurisdiction's pack is picked by it (Part XXIII, 3, rule 2).",
      "type": "array",
      "maxItems": 20,
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 1000
      }
    },
    "checks": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "check",
          "suite",
          "id",
          "version",
          "says",
          "severity",
          "status",
          "counts"
        ],
        "additionalProperties": false,
        "properties": {
          "check": {
            "description": "Its qualified id, <suite>/<id>.",
            "type": "string",
            "minLength": 3
          },
          "suite": {
            "type": "string",
            "minLength": 1
          },
          "id": {
            "type": "string",
            "minLength": 1
          },
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "says": {
            "type": "string"
          },
          "severity": {
            "enum": [
              "error",
              "warning",
              "info"
            ]
          },
          "source": {
            "type": "object"
          },
          "status": {
            "$ref": "#/$defs/status"
          },
          "message": {
            "description": "Why the check as a whole was skipped, where it was.",
            "type": "string"
          },
          "params": {
            "description": "The values it ran with, by name.",
            "type": "object"
          },
          "counts": {
            "type": "object",
            "required": [
              "pass",
              "fail",
              "waived",
              "skipped",
              "stale"
            ],
            "additionalProperties": false,
            "properties": {
              "pass": {
                "type": "integer",
                "minimum": 0
              },
              "fail": {
                "type": "integer",
                "minimum": 0
              },
              "waived": {
                "type": "integer",
                "minimum": 0
              },
              "skipped": {
                "type": "integer",
                "minimum": 0
              },
              "stale": {
                "type": "integer",
                "minimum": 0
              }
            }
          }
        }
      }
    },
    "findings": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "check",
          "suite",
          "version",
          "status",
          "message"
        ],
        "additionalProperties": false,
        "properties": {
          "check": {
            "type": "string",
            "minLength": 3
          },
          "suite": {
            "type": "string",
            "minLength": 1
          },
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "$ref": "#/$defs/status"
          },
          "severity": {
            "description": "A failure's and a waived finding's, the check's; a skipped finding's info; a stale one's warning. A pass has none.",
            "enum": [
              "error",
              "warning",
              "info"
            ]
          },
          "element": {
            "description": "The element's id.",
            "type": "string",
            "minLength": 1
          },
          "path": {
            "description": "The element's record's path without .json (Part VI, 8.3, rule 1), or the file the finding is of: a result manifest's.",
            "type": "string",
            "minLength": 1
          },
          "measured": {
            "description": "What the runner found."
          },
          "required": {
            "description": "What the check requires: {atLeast?, atMost?, equals?, in?, notIn?, present?}.",
            "type": "object"
          },
          "unit": {
            "type": "string"
          },
          "message": {
            "type": "string",
            "minLength": 1
          },
          "fix": {
            "type": "string"
          },
          "waiver": {
            "description": "The waiver that matched it: applied, or expired, or of another version of the check.",
            "type": "object",
            "required": [
              "reason",
              "owner",
              "until"
            ],
            "properties": {
              "reason": {
                "type": "string"
              },
              "owner": {
                "type": "string"
              },
              "until": {
                "type": "string"
              },
              "version": {
                "type": "integer"
              },
              "expired": {
                "const": true
              },
              "otherVersion": {
                "const": true
              }
            }
          }
        }
      }
    },
    "summary": {
      "type": "object",
      "required": [
        "checks",
        "passed",
        "failed",
        "waived",
        "skipped",
        "stale",
        "errors",
        "warnings",
        "infos",
        "blocking"
      ],
      "additionalProperties": false,
      "properties": {
        "checks": {
          "type": "integer",
          "minimum": 0
        },
        "passed": {
          "type": "integer",
          "minimum": 0
        },
        "failed": {
          "type": "integer",
          "minimum": 0
        },
        "waived": {
          "type": "integer",
          "minimum": 0
        },
        "skipped": {
          "type": "integer",
          "minimum": 0
        },
        "stale": {
          "type": "integer",
          "minimum": 0
        },
        "errors": {
          "description": "Findings that fail at the severity error.",
          "type": "integer",
          "minimum": 0
        },
        "warnings": {
          "description": "Findings that fail at the severity warning, and stale findings.",
          "type": "integer",
          "minimum": 0
        },
        "infos": {
          "description": "Findings that fail at the severity info, and skipped findings.",
          "type": "integer",
          "minimum": 0
        },
        "blocking": {
          "description": "Whether a failure at the severity error of a required suite blocks a merge (Part XXIII, 3, rule 6).",
          "type": "boolean"
        }
      }
    }
  },
  "$defs": {
    "status": {
      "enum": [
        "pass",
        "fail",
        "waived",
        "skipped",
        "stale"
      ]
    }
  }
}
