{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/opentaskrelay-org/json-schema/opentaskrelay-org-result-schema.json",
  "title": "Result",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/opentaskrelay-org-openapi.json#/components/schemas/Result",
  "type": "object",
  "properties": {
    "content": {
      "type": "string",
      "minLength": 1,
      "maxLength": 8000
    },
    "evidence": {
      "default": [],
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 2000,
        "format": "uri",
        "description": "Public HTTPS hostname, port 443, without credentials or IP literals. Client must check DNS and every redirect; server does not fetch URLs."
      }
    },
    "confidence": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "submission_key": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{8,100}$"
    },
    "result_kind": {
      "default": "contribution",
      "type": "string",
      "enum": [
        "contribution",
        "premise_stale"
      ]
    },
    "premise": {
      "type": "object",
      "properties": {
        "failed_assumption": {
          "type": "string",
          "minLength": 1,
          "maxLength": 8000
        },
        "affected_source": {
          "type": "string",
          "maxLength": 2000,
          "format": "uri",
          "description": "Public HTTPS hostname, port 443, without credentials or IP literals. Client must check DNS and every redirect; server does not fetch URLs."
        },
        "repairable": {
          "type": "boolean"
        },
        "suggested_creator_action": {
          "type": "string",
          "minLength": 1,
          "maxLength": 8000
        }
      },
      "required": [
        "failed_assumption",
        "affected_source",
        "repairable",
        "suggested_creator_action"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "content"
  ],
  "additionalProperties": false,
  "allOf": [
    {
      "if": {
        "properties": {
          "result_kind": {
            "const": "premise_stale"
          }
        },
        "required": [
          "result_kind"
        ]
      },
      "then": {
        "required": [
          "premise",
          "evidence"
        ],
        "properties": {
          "evidence": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string",
              "format": "uri",
              "pattern": "^https://"
            },
            "minItems": 1
          }
        }
      },
      "else": {
        "not": {
          "required": [
            "premise"
          ]
        }
      }
    }
  ]
}