{
  "$defs": {
    "Guardrail": {
      "additionalProperties": false,
      "description": "A metric that must not get worse than the baseline by more than ``margin``.\n\n``relative`` reads ``margin`` as a share of the baseline value, so 0.2 allows the candidate 20 % worse.",
      "properties": {
        "direction": {
          "anyOf": [
            {
              "$ref": "#/$defs/MetricDirection"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "margin": {
          "minimum": 0,
          "title": "Margin",
          "type": "number"
        },
        "metric": {
          "$ref": "#/$defs/MetricName"
        },
        "relative": {
          "default": false,
          "title": "Relative",
          "type": "boolean"
        }
      },
      "required": [
        "metric",
        "margin"
      ],
      "title": "Guardrail",
      "type": "object"
    },
    "MetricDirection": {
      "enum": [
        "higher_is_better",
        "lower_is_better"
      ],
      "title": "MetricDirection",
      "type": "string"
    },
    "MetricName": {
      "pattern": "^[a-z][a-z0-9_]{0,62}$",
      "type": "string"
    }
  },
  "additionalProperties": false,
  "description": "Is ``candidate`` not worse than ``baseline`` on ``primary`` by more than ``margin``, on the same cases.",
  "properties": {
    "baseline": {
      "title": "Baseline",
      "type": "string"
    },
    "candidate": {
      "title": "Candidate",
      "type": "string"
    },
    "direction": {
      "anyOf": [
        {
          "$ref": "#/$defs/MetricDirection"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "guardrails": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/Guardrail"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Guardrails"
    },
    "kind": {
      "const": "noninferior",
      "title": "Kind",
      "type": "string"
    },
    "margin": {
      "exclusiveMinimum": 0,
      "title": "Margin",
      "type": "number"
    },
    "primary": {
      "$ref": "#/$defs/MetricName"
    }
  },
  "required": [
    "kind",
    "baseline",
    "candidate",
    "primary",
    "margin"
  ],
  "title": "NoninferiorQuestion",
  "type": "object"
}
