{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/repowise-dev/json-schema/repowise-dev-patch-coverage-response-schema.json",
  "title": "PatchCoverageResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/repowise-dev-code-health-api-openapi.yml#/components/schemas/PatchCoverageResponse",
  "properties": {
    "patch_coverage_pct": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Patch Coverage Pct"
    },
    "covered_line_count": {
      "type": "integer",
      "title": "Covered Line Count"
    },
    "coverable_line_count": {
      "type": "integer",
      "title": "Coverable Line Count"
    },
    "threshold": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Threshold"
    },
    "min_coverable_lines": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Min Coverable Lines"
    },
    "gate": {
      "type": "string",
      "enum": [
        "pass",
        "fail",
        "no_data",
        "not_set",
        "too_small"
      ],
      "title": "Gate"
    },
    "file_counts": {
      "$ref": "#/$defs/PatchCoverageFileCounts"
    },
    "files": {
      "items": {
        "$ref": "#/$defs/PatchCoverageFile"
      },
      "type": "array",
      "title": "Files"
    },
    "scope": {
      "$ref": "#/$defs/PatchCoverageScope"
    },
    "path_gates": {
      "items": {
        "$ref": "#/$defs/PatchCoveragePathGate"
      },
      "type": "array",
      "title": "Path Gates"
    },
    "risky": {
      "anyOf": [
        {
          "$ref": "#/$defs/PatchCoverageRisky"
        },
        {
          "type": "null"
        }
      ]
    },
    "project": {
      "anyOf": [
        {
          "$ref": "#/$defs/PatchCoverageProject"
        },
        {
          "type": "null"
        }
      ]
    },
    "branches": {
      "anyOf": [
        {
          "$ref": "#/$defs/PatchCoverageBranches"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "patch_coverage_pct",
    "covered_line_count",
    "coverable_line_count",
    "threshold",
    "min_coverable_lines",
    "gate",
    "file_counts",
    "files",
    "scope",
    "path_gates",
    "risky",
    "project",
    "branches"
  ],
  "$defs": {
    "PatchCoverageBranches": {
      "properties": {
        "branch_taken": {
          "type": "integer",
          "title": "Branch Taken"
        },
        "branch_total": {
          "type": "integer",
          "title": "Branch Total"
        },
        "branch_coverage_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Branch Coverage Pct"
        },
        "partial_line_count": {
          "type": "integer",
          "title": "Partial Line Count"
        },
        "threshold": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Threshold"
        },
        "gate": {
          "type": "string",
          "enum": [
            "pass",
            "fail",
            "no_data",
            "not_set",
            "too_small"
          ],
          "title": "Gate"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "branch_taken",
        "branch_total",
        "branch_coverage_pct",
        "partial_line_count",
        "threshold",
        "gate"
      ],
      "title": "PatchCoverageBranches",
      "description": "Branches on changed lines, reported beside patch coverage, never blended into it."
    },
    "PatchCoverageFile": {
      "properties": {
        "file_path": {
          "type": "string",
          "title": "File Path"
        },
        "status": {
          "type": "string",
          "enum": [
            "measured",
            "not_in_report",
            "no_line_data",
            "no_coverable_changes",
            "stale_file"
          ],
          "title": "Status"
        },
        "changed_line_count": {
          "type": "integer",
          "title": "Changed Line Count"
        },
        "coverable_line_count": {
          "type": "integer",
          "title": "Coverable Line Count"
        },
        "covered_line_count": {
          "type": "integer",
          "title": "Covered Line Count"
        },
        "patch_coverage_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Patch Coverage Pct"
        },
        "uncovered_ranges": {
          "items": {
            "items": {
              "type": "integer"
            },
            "type": "array"
          },
          "type": "array",
          "title": "Uncovered Ranges"
        },
        "branch_taken": {
          "type": "integer",
          "title": "Branch Taken"
        },
        "branch_total": {
          "type": "integer",
          "title": "Branch Total"
        },
        "partial_ranges": {
          "items": {
            "items": {
              "type": "integer"
            },
            "type": "array"
          },
          "type": "array",
          "title": "Partial Ranges"
        },
        "risk": {
          "anyOf": [
            {
              "$ref": "#/$defs/PatchCoverageFileRisk"
            },
            {
              "type": "null"
            }
          ]
        },
        "hints": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/PatchCoverageTestHint"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Hints"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "file_path",
        "status",
        "changed_line_count",
        "coverable_line_count",
        "covered_line_count",
        "patch_coverage_pct",
        "uncovered_ranges",
        "branch_taken",
        "branch_total",
        "partial_ranges",
        "risk",
        "hints"
      ],
      "title": "PatchCoverageFile"
    },
    "PatchCoverageFileCounts": {
      "properties": {
        "measured": {
          "type": "integer",
          "title": "Measured"
        },
        "not_in_report": {
          "type": "integer",
          "title": "Not In Report"
        },
        "no_line_data": {
          "type": "integer",
          "title": "No Line Data"
        },
        "no_coverable_changes": {
          "type": "integer",
          "title": "No Coverable Changes"
        },
        "stale_file": {
          "type": "integer",
          "title": "Stale File"
        },
        "out_of_scope": {
          "type": "integer",
          "title": "Out Of Scope"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "measured",
        "not_in_report",
        "no_line_data",
        "no_coverable_changes",
        "stale_file",
        "out_of_scope"
      ],
      "title": "PatchCoverageFileCounts"
    },
    "PatchCoverageFileRisk": {
      "properties": {
        "fix_pressure": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Fix Pressure"
        },
        "dependents": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Dependents"
        },
        "hotspot": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Hotspot"
        },
        "bug_magnet": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Bug Magnet"
        },
        "basis": {
          "type": "string",
          "enum": [
            "git",
            "index",
            "git_and_index",
            "unavailable"
          ],
          "title": "Basis"
        },
        "risky": {
          "type": "boolean",
          "title": "Risky"
        },
        "reasons": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Reasons"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "fix_pressure",
        "dependents",
        "hotspot",
        "bug_magnet",
        "basis",
        "risky",
        "reasons"
      ],
      "title": "PatchCoverageFileRisk"
    },
    "PatchCoverageOutsideChange": {
      "properties": {
        "file_path": {
          "type": "string",
          "title": "File Path"
        },
        "status": {
          "type": "string",
          "enum": [
            "changed",
            "no_longer_measured"
          ],
          "title": "Status"
        },
        "newly_uncovered_ranges": {
          "items": {
            "items": {
              "type": "integer"
            },
            "type": "array"
          },
          "type": "array",
          "title": "Newly Uncovered Ranges"
        },
        "newly_uncovered_line_count": {
          "type": "integer",
          "title": "Newly Uncovered Line Count"
        },
        "newly_covered_line_count": {
          "type": "integer",
          "title": "Newly Covered Line Count"
        },
        "base_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Base Pct"
        },
        "head_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Head Pct"
        },
        "causes": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/PatchCoverageOutsideChangeCause"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Causes"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "file_path",
        "status",
        "newly_uncovered_ranges",
        "newly_uncovered_line_count",
        "newly_covered_line_count",
        "base_pct",
        "head_pct",
        "causes"
      ],
      "title": "PatchCoverageOutsideChange",
      "description": "A file whose coverage changed on lines the change did not touch."
    },
    "PatchCoverageOutsideChangeCause": {
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "test_deleted",
            "test_modified",
            "dependent_changed"
          ],
          "title": "Kind"
        },
        "path": {
          "type": "string",
          "title": "Path"
        },
        "basis": {
          "type": "string",
          "enum": [
            "per_test",
            "graph",
            "name"
          ],
          "title": "Basis"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "kind",
        "path",
        "basis"
      ],
      "title": "PatchCoverageOutsideChangeCause",
      "description": "A changed file that explains coverage lost outside the change."
    },
    "PatchCoveragePathGate": {
      "properties": {
        "name": {
          "type": "string",
          "title": "Name"
        },
        "paths": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Paths"
        },
        "threshold": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Threshold"
        },
        "informational": {
          "type": "boolean",
          "title": "Informational"
        },
        "measured_file_count": {
          "type": "integer",
          "title": "Measured File Count"
        },
        "unmeasured_file_count": {
          "type": "integer",
          "title": "Unmeasured File Count"
        },
        "covered_line_count": {
          "type": "integer",
          "title": "Covered Line Count"
        },
        "coverable_line_count": {
          "type": "integer",
          "title": "Coverable Line Count"
        },
        "patch_coverage_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Patch Coverage Pct"
        },
        "gate": {
          "type": "string",
          "enum": [
            "pass",
            "fail",
            "no_data",
            "not_set",
            "too_small"
          ],
          "title": "Gate"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "name",
        "paths",
        "threshold",
        "informational",
        "measured_file_count",
        "unmeasured_file_count",
        "covered_line_count",
        "coverable_line_count",
        "patch_coverage_pct",
        "gate"
      ],
      "title": "PatchCoveragePathGate",
      "description": "One path-scoped gate from ``coverage.gates``, judged on the change."
    },
    "PatchCoverageProject": {
      "properties": {
        "basis": {
          "type": "string",
          "enum": [
            "base_report",
            "history"
          ],
          "title": "Basis"
        },
        "base_commit": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Base Commit"
        },
        "head_commit": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Head Commit"
        },
        "base": {
          "anyOf": [
            {
              "$ref": "#/$defs/PatchCoverageProjectTotals"
            },
            {
              "type": "null"
            }
          ]
        },
        "head": {
          "anyOf": [
            {
              "$ref": "#/$defs/PatchCoverageProjectTotals"
            },
            {
              "type": "null"
            }
          ]
        },
        "delta_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Delta Pct"
        },
        "max_drop": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Max Drop"
        },
        "gate": {
          "type": "string",
          "enum": [
            "pass",
            "fail",
            "no_data",
            "not_set",
            "too_small"
          ],
          "title": "Gate"
        },
        "incomparable": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Incomparable"
        },
        "outside_change": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/PatchCoverageOutsideChange"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Outside Change"
        },
        "outside_change_note": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Outside Change Note"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "basis",
        "base_commit",
        "head_commit",
        "base",
        "head",
        "delta_pct",
        "max_drop",
        "gate",
        "incomparable",
        "outside_change",
        "outside_change_note"
      ],
      "title": "PatchCoverageProject",
      "description": "Project coverage at the change's base against its head."
    },
    "PatchCoverageProjectTotals": {
      "properties": {
        "covered_line_count": {
          "type": "integer",
          "title": "Covered Line Count"
        },
        "coverable_line_count": {
          "type": "integer",
          "title": "Coverable Line Count"
        },
        "coverage_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Coverage Pct"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "covered_line_count",
        "coverable_line_count",
        "coverage_pct"
      ],
      "title": "PatchCoverageProjectTotals"
    },
    "PatchCoverageRisky": {
      "properties": {
        "file_count": {
          "type": "integer",
          "title": "File Count"
        },
        "covered_line_count": {
          "type": "integer",
          "title": "Covered Line Count"
        },
        "coverable_line_count": {
          "type": "integer",
          "title": "Coverable Line Count"
        },
        "patch_coverage_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Patch Coverage Pct"
        },
        "threshold": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Threshold"
        },
        "gate": {
          "type": "string",
          "enum": [
            "pass",
            "fail",
            "no_data",
            "not_set",
            "too_small"
          ],
          "title": "Gate"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "file_count",
        "covered_line_count",
        "coverable_line_count",
        "patch_coverage_pct",
        "threshold",
        "gate"
      ],
      "title": "PatchCoverageRisky",
      "description": "Patch coverage over the measured files history marks as risky."
    },
    "PatchCoverageScope": {
      "properties": {
        "label": {
          "type": "string",
          "title": "Label"
        },
        "source_formats": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Source Formats"
        },
        "reports": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Reports"
        },
        "report_path_count": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Report Path Count"
        },
        "unmatched_report_path_count": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Unmatched Report Path Count"
        },
        "mapping_partial": {
          "type": "boolean",
          "title": "Mapping Partial"
        },
        "measured_commit": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Measured Commit"
        },
        "freshness": {
          "type": "string",
          "enum": [
            "current",
            "stale",
            "unknown"
          ],
          "title": "Freshness"
        },
        "ignored_file_count": {
          "type": "integer",
          "title": "Ignored File Count"
        },
        "config_errors": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Config Errors"
        },
        "branch_data": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "per_line",
                "none",
                "stored_before"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Branch Data"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "label",
        "source_formats",
        "reports",
        "report_path_count",
        "unmatched_report_path_count",
        "mapping_partial",
        "measured_commit",
        "freshness",
        "ignored_file_count",
        "config_errors",
        "branch_data"
      ],
      "title": "PatchCoverageScope"
    },
    "PatchCoverageTestHint": {
      "properties": {
        "range": {
          "items": {
            "type": "integer"
          },
          "type": "array",
          "title": "Range"
        },
        "symbol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Symbol"
        },
        "tests": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Tests"
        },
        "basis": {
          "type": "string",
          "enum": [
            "per_test",
            "call_graph",
            "import_graph",
            "none"
          ],
          "title": "Basis"
        },
        "total": {
          "type": "integer",
          "title": "Total"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "range",
        "symbol",
        "tests",
        "basis",
        "total"
      ],
      "title": "PatchCoverageTestHint",
      "description": "Where to extend the tests for one uncovered range."
    }
  }
}