{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/overwing-ai/json-schema/overwing-ai-evaluation-schema.json",
  "title": "Evaluation",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/overwing-ai-openapi.json#/components/schemas/Evaluation",
  "type": "object",
  "required": [
    "id",
    "verdict",
    "recommended_action",
    "aggregate_score",
    "confidence",
    "latency_ms",
    "results"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "verdict": {
      "$ref": "#/$defs/Verdict"
    },
    "recommended_action": {
      "type": "string",
      "enum": [
        "block",
        "redact",
        "review",
        "allow"
      ],
      "description": "One word to act on, derived from the failed rules' actions: block if any failed rule says block, else redact, else review (a review verdict or a review-action fail), else allow."
    },
    "aggregate_score": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "description": "Weighted score: pass=1, review=0.5, fail=0 per rule, weighted by rule weight. A ranking signal for sorting or thresholds, not a decision: use verdict and recommended_action to act."
    },
    "confidence": {
      "type": "number",
      "description": "Minimum confidence across rules"
    },
    "latency_ms": {
      "type": "integer"
    },
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/RuleResult"
      }
    }
  },
  "$defs": {
    "QuestionType": {
      "type": "string",
      "enum": [
        "choice",
        "score",
        "noul"
      ]
    },
    "RuleResult": {
      "type": "object",
      "required": [
        "rule",
        "type",
        "answer",
        "probability",
        "confidence",
        "verdict",
        "action"
      ],
      "properties": {
        "rule": {
          "type": "string"
        },
        "action": {
          "type": "string",
          "enum": [
            "block",
            "redact",
            "review"
          ],
          "description": "The rule's declared action: what to do when this rule fails"
        },
        "type": {
          "$ref": "#/$defs/QuestionType"
        },
        "answer": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            }
          ],
          "description": "choice: selected option; score: position on the level scale (may be fractional); noul: boolean"
        },
        "probability": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "confidence": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "verdict": {
          "$ref": "#/$defs/Verdict"
        }
      }
    },
    "Verdict": {
      "type": "string",
      "enum": [
        "pass",
        "fail",
        "review"
      ],
      "description": "fail: a rule's fail condition matched. review: a rule's confidence was below its review threshold and nothing failed. pass: otherwise."
    }
  }
}