{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/repowise-dev/json-schema/repowise-dev-coverage-response-schema.json",
  "title": "CoverageResponse",
  "description": "``GET /health/coverage``. ``basis`` is absent when the graph was not consulted.\n\n``unavailable`` means the graph walk failed, which is not the same as ``none``\n(no test files to walk from).",
  "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/CoverageResponse",
  "properties": {
    "summary": {
      "$ref": "#/$defs/CoverageSummary"
    },
    "files": {
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "type": "array",
      "title": "Files"
    },
    "modules": {
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "type": "array",
      "title": "Modules"
    },
    "modules_total": {
      "type": "integer",
      "title": "Modules Total"
    },
    "basis": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "measured",
            "inferred",
            "none",
            "unavailable"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Basis"
    },
    "inferred": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Inferred"
    },
    "history": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/CoverageHistoryPoint"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "History"
    }
  },
  "type": "object",
  "required": [
    "summary",
    "files",
    "modules",
    "modules_total"
  ],
  "$defs": {
    "CoverageHistoryPoint": {
      "properties": {
        "ingested_at": {
          "type": "string",
          "title": "Ingested At"
        },
        "ingested_commit_sha": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Ingested Commit Sha"
        },
        "line_coverage_pct": {
          "type": "number",
          "title": "Line Coverage Pct"
        },
        "branch_coverage_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Branch Coverage Pct"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "ingested_at",
        "ingested_commit_sha",
        "line_coverage_pct",
        "branch_coverage_pct"
      ],
      "title": "CoverageHistoryPoint",
      "description": "One ingested report's repo-wide figures, as ``crud.load_coverage_history`` reads them."
    },
    "CoverageReportPaths": {
      "properties": {
        "total": {
          "type": "integer",
          "title": "Total"
        },
        "matched": {
          "type": "integer",
          "title": "Matched"
        },
        "unmatched": {
          "type": "integer",
          "title": "Unmatched"
        },
        "ambiguous": {
          "type": "integer",
          "title": "Ambiguous"
        },
        "unmatched_sample": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Unmatched Sample"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "total",
        "matched",
        "unmatched",
        "ambiguous",
        "unmatched_sample"
      ],
      "title": "CoverageReportPaths",
      "description": "How the report's own file entries mapped to the repository at ingest."
    },
    "CoverageSummary": {
      "properties": {
        "file_count": {
          "type": "integer",
          "title": "File Count"
        },
        "covered_lines": {
          "type": "integer",
          "title": "Covered Lines"
        },
        "total_lines": {
          "type": "integer",
          "title": "Total Lines"
        },
        "line_coverage_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Line Coverage Pct"
        },
        "branch_coverage_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Branch Coverage Pct"
        },
        "source_format": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Source Format"
        },
        "source_formats": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Source Formats"
        },
        "mapping_partial": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Mapping Partial"
        },
        "ingested_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Ingested At"
        },
        "ingested_commit_sha": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Ingested Commit Sha"
        },
        "report_paths": {
          "anyOf": [
            {
              "$ref": "#/$defs/CoverageReportPaths"
            },
            {
              "type": "null"
            }
          ]
        },
        "freshness": {
          "anyOf": [
            {
              "$ref": "#/$defs/CoverageSummaryFreshness"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "file_count",
        "covered_lines",
        "total_lines",
        "line_coverage_pct",
        "branch_coverage_pct",
        "source_format",
        "source_formats",
        "mapping_partial",
        "ingested_at",
        "ingested_commit_sha",
        "report_paths",
        "freshness"
      ],
      "title": "CoverageSummary",
      "description": "The repository's stored coverage, aggregated. Zero counts and nulls when none is stored."
    },
    "CoverageSummaryFreshness": {
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "current",
            "stale",
            "unknown"
          ],
          "title": "Status"
        },
        "indexed_commit": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Indexed Commit"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "status",
        "indexed_commit"
      ],
      "title": "CoverageSummaryFreshness",
      "description": "Whether the coverage was measured at the commit the index describes."
    }
  }
}