{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openrevive.org/contracts/request.schema.json",
  "title": "OpenRevive canonical request, draft 0.1 (not implemented)",
  "$comment": "MIT. Proposal only. Trust and authentication are defined by the future transport; a supplied principal is not proof of identity.",
  "type": "object",
  "additionalProperties": false,
  "required": ["contract", "operation", "request_id", "client", "principal", "params"],
  "properties": {
    "contract": {"const": "openrevive.social/0.1"},
    "operation": {"type": "string", "pattern": "^[a-z][a-z0-9_]*\\.[a-z][a-z0-9_]*$"},
    "request_id": {"type": "string", "minLength": 1, "maxLength": 128},
    "client": {
      "type": "object", "additionalProperties": false,
      "required": ["profile", "app_version", "api_version", "transport", "response_format", "required_capabilities"],
      "properties": {
        "profile": {"type": "string", "minLength": 1},
        "app_version": {"type": "string", "minLength": 1},
        "api_version": {"type": "string", "minLength": 1},
        "transport": {"enum": ["http", "https"]},
        "response_format": {"enum": ["xml", "json", "binary"]},
        "required_capabilities": {"type": "array", "uniqueItems": true, "items": {"type": "string", "minLength": 1}}
      }
    },
    "principal": {
      "oneOf": [
        {"type": "null"},
        {"type": "object", "additionalProperties": false, "required": ["subject"],
         "properties": {"subject": {"type": "string", "minLength": 1}}}
      ]
    },
    "params": {"type": "object", "description": "Per-operation typed schemas are still to be designed; this envelope alone is not a complete service contract."}
  }
}
