{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/currents-dev/json-schema/currents-dev-metrics-summary-schema.json",
  "title": "MetricsSummary",
  "description": "Duration percentiles and outcome rates for a selection of tests or spec files, plus the duration histogram.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/currents-dev-spec-files-api-openapi.yml#/components/schemas/MetricsSummary",
  "type": "object",
  "required": [
    "current",
    "previous",
    "minMs",
    "maxMs",
    "distribution"
  ],
  "properties": {
    "current": {
      "$ref": "#/$defs/PeriodMetrics"
    },
    "previous": {
      "allOf": [
        {
          "$ref": "#/$defs/PeriodMetrics"
        }
      ],
      "description": "The range of the same length before the one asked for."
    },
    "minMs": {
      "type": [
        "number",
        "null"
      ],
      "description": "Shortest execution in the current range."
    },
    "maxMs": {
      "type": [
        "number",
        "null"
      ],
      "description": "Longest execution in the current range."
    },
    "distribution": {
      "type": "array",
      "description": "Executions per duration bucket, in the current range. Buckets widen with duration; empty buckets between the first and last are included.",
      "items": {
        "type": "object",
        "required": [
          "minMs",
          "maxMs",
          "executions"
        ],
        "properties": {
          "minMs": {
            "type": "number"
          },
          "maxMs": {
            "type": "number"
          },
          "executions": {
            "type": "number"
          }
        }
      }
    }
  },
  "$defs": {
    "PeriodMetrics": {
      "type": "object",
      "required": [
        "executions",
        "overallExecutions",
        "avgMs",
        "p50Ms",
        "p90Ms",
        "p95Ms",
        "passRate",
        "failureRate",
        "flakinessRate",
        "suiteSize",
        "testsPerExecution"
      ],
      "properties": {
        "executions": {
          "type": "number",
          "description": "Executions the duration metrics are calculated over. Narrower than `overallExecutions` when the average-duration metric setting excludes a status."
        },
        "overallExecutions": {
          "type": "number",
          "description": "Executions the rates are calculated over."
        },
        "avgMs": {
          "type": [
            "number",
            "null"
          ]
        },
        "p50Ms": {
          "type": [
            "number",
            "null"
          ]
        },
        "p90Ms": {
          "type": [
            "number",
            "null"
          ]
        },
        "p95Ms": {
          "type": [
            "number",
            "null"
          ]
        },
        "passRate": {
          "type": [
            "number",
            "null"
          ],
          "description": "Rate as a 0-1 float. Tests only."
        },
        "failureRate": {
          "type": [
            "number",
            "null"
          ],
          "description": "Rate as a 0-1 float. Failures are failed and interrupted executions together."
        },
        "flakinessRate": {
          "type": [
            "number",
            "null"
          ]
        },
        "suiteSize": {
          "type": [
            "number",
            "null"
          ],
          "description": "Tests in the most recent execution of a spec file. Null unless the metrics describe a single spec file."
        },
        "testsPerExecution": {
          "type": [
            "number",
            "null"
          ],
          "description": "Average tests per spec execution. Spec files only."
        }
      }
    }
  }
}