{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openrevive.org/contracts/response.schema.json",
  "title": "OpenRevive canonical response, draft 0.1 (not implemented)",
  "$comment": "MIT. Proposal only; no deployed API or conformance claim.",
  "type": "object", "additionalProperties": false,
  "required": ["contract", "request_id", "outcome"],
  "properties": {
    "contract": {"const": "openrevive.social/0.1"},
    "request_id": {"type": "string", "minLength": 1, "maxLength": 128},
    "outcome": {"enum": ["ok", "error"]},
    "result": {"description": "Typed results are a future per-operation schema."},
    "error": {
      "type": "object", "additionalProperties": false,
      "required": ["code", "message", "retryable"],
      "properties": {
        "code": {"enum": ["unsupported_profile", "unsupported_capability", "unauthenticated", "forbidden", "not_found", "invalid_params", "conflict", "rate_limited", "internal"]},
        "message": {"type": "string"},
        "retryable": {"type": "boolean"}
      }
    }
  },
  "oneOf": [
    {"properties": {"outcome": {"const": "ok"}}, "required": ["result"], "not": {"required": ["error"]}},
    {"properties": {"outcome": {"const": "error"}}, "required": ["error"], "not": {"required": ["result"]}}
  ]
}
