{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ufcalendar-com/json-schema/ufcalendar-com-leaderboard-response-schema.json",
  "title": "LeaderboardResponse",
  "description": "Best first (`meta.metric.direction`). `meta.note` explains non-fighter rows.",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ufcalendar-com-openapi.json#/components/schemas/LeaderboardResponse",
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/LeaderboardRow"
      }
    },
    "meta": {
      "type": "object",
      "properties": {
        "org": {
          "type": "string"
        },
        "metric": {
          "$ref": "#/$defs/MetricMeta"
        },
        "division": {
          "type": [
            "string",
            "null"
          ],
          "description": "API division slug as passed."
        },
        "population": {
          "$ref": "#/$defs/Population"
        },
        "country": {
          "type": [
            "string",
            "null"
          ]
        },
        "computed_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "When the rollup was built."
        },
        "note": {
          "type": "string"
        },
        "ignored_params": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Present only when the request carried query parameters this endpoint does not take — they were ignored. Same list as the `X-UFCalendar-Ignored-Params` header. Sorted, unique."
        }
      },
      "required": [
        "org",
        "metric",
        "division",
        "population",
        "country",
        "computed_at"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "data",
    "meta"
  ],
  "additionalProperties": false,
  "$defs": {
    "LeaderboardRow": {
      "type": "object",
      "properties": {
        "rank": {
          "type": "integer",
          "description": "The rollup's own position."
        },
        "value": {
          "type": "number",
          "description": "In `meta.metric.unit`."
        },
        "value_secondary": {
          "type": [
            "number",
            "null"
          ],
          "description": "Denominator or context named by `meta.metric.secondary`."
        },
        "sample_n": {
          "type": "integer",
          "description": "Bouts (or fighters) behind the value."
        },
        "fighter": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "slug": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "nationality": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "slug",
                "name",
                "nationality"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ],
          "description": "Null on `event` and `division` boards."
        },
        "division": {
          "type": [
            "string",
            "null"
          ],
          "description": "Set on `division` boards and on any board narrowed with `division=`."
        },
        "round_number": {
          "type": [
            "integer",
            "null"
          ],
          "description": "`round` boards only."
        },
        "fight": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "event": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "slug": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "title": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "starts_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "id",
                        "slug",
                        "title",
                        "starts_at"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "opponent": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "slug": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "slug",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "event",
                "opponent"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ],
          "description": "`single_fight` / `round` boards: the performance's bout."
        },
        "event": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "slug": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "title": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "starts_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                }
              },
              "required": [
                "id",
                "slug",
                "title",
                "starts_at"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ],
          "description": "`event` boards: the card."
        },
        "display_rank": {
          "type": "integer",
          "description": "First rank of the tie group."
        },
        "tied": {
          "type": "boolean"
        }
      },
      "required": [
        "rank",
        "value",
        "value_secondary",
        "sample_n",
        "fighter",
        "division",
        "round_number",
        "fight",
        "event",
        "display_rank",
        "tied"
      ],
      "additionalProperties": false
    },
    "MetricCategory": {
      "type": "string",
      "enum": [
        "fights",
        "time",
        "striking",
        "grappling",
        "discipline",
        "records"
      ],
      "description": "Record Book category."
    },
    "MetricMeta": {
      "type": "object",
      "properties": {
        "slug": {
          "type": "string",
          "enum": [
            "total_fights",
            "wins",
            "decision_wins",
            "title_fight_wins",
            "bonuses",
            "finishes",
            "win_streak",
            "total_fight_seconds",
            "avg_fight_seconds_short",
            "avg_fight_seconds_long",
            "control_time_sec",
            "control_time_pct",
            "sig_strikes_landed",
            "total_strikes_landed",
            "slpm",
            "sapm",
            "striking_differential",
            "sig_strike_accuracy",
            "sig_strike_defense",
            "knockdowns",
            "knockdowns_per_15",
            "knockouts",
            "takedowns_landed",
            "td_avg",
            "takedown_accuracy",
            "takedown_defense",
            "submission_attempts",
            "sub_avg_per_15",
            "submissions",
            "fastest_finish",
            "fastest_knockout",
            "fastest_submission",
            "longest_fight_seconds",
            "most_sig_strikes_fight",
            "most_takedowns_fight",
            "most_knockdowns_fight",
            "longest_control_fight",
            "most_sig_strikes_round",
            "most_takedowns_round",
            "most_knockdowns_round",
            "fouls_committed",
            "eye_pokes_committed",
            "low_blows_committed",
            "fouls_drawn",
            "fouls_per_15",
            "most_fouls_fight",
            "longest_foul_stoppage_fight",
            "most_fouls_event",
            "most_finishes_event",
            "most_knockouts_event",
            "shortest_card_seconds",
            "finish_rate",
            "ko_rate",
            "sub_rate",
            "decision_rate",
            "avg_fight_seconds",
            "fouls_per_15_division"
          ],
          "description": "Board metric slug."
        },
        "scope": {
          "$ref": "#/$defs/MetricScope"
        },
        "category": {
          "$ref": "#/$defs/MetricCategory"
        },
        "direction": {
          "type": "string",
          "enum": [
            "asc",
            "desc"
          ],
          "description": "Ranking order, not a verdict."
        },
        "unit": {
          "$ref": "#/$defs/MetricUnit"
        },
        "has_secondary": {
          "type": "boolean"
        },
        "secondary": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "unit": {
                  "$ref": "#/$defs/MetricUnit"
                },
                "label": {
                  "type": "string",
                  "description": "snake_case name of what `value_secondary` holds (`attempted`, `round`, `fights`, …)."
                }
              },
              "required": [
                "unit",
                "label"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "slug",
        "scope",
        "category",
        "direction",
        "unit",
        "has_secondary",
        "secondary"
      ],
      "additionalProperties": false
    },
    "MetricScope": {
      "type": "string",
      "enum": [
        "career",
        "single_fight",
        "round",
        "division",
        "event"
      ],
      "description": "What a board row is: `career` = a fighter, `single_fight` / `round` = a performance, `event` = a card, `division` = a weight class."
    },
    "MetricUnit": {
      "type": "string",
      "enum": [
        "count",
        "seconds",
        "minutes",
        "rate",
        "per_minute",
        "per_15_minutes"
      ],
      "description": "`rate` is a 0–1 fraction."
    },
    "Population": {
      "type": "string",
      "enum": [
        "all",
        "active"
      ],
      "description": "`active` = a bout in the last ~18 months."
    }
  }
}