OKHAM.org Documentation EnglishCastellano

Release candidate 0.2.0-rc.2

OPC · JSON schema

Open original JSON

{
  "$defs": {
    "constrain": {
      "additionalProperties": true,
      "properties": {
        "constraints": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "constraints"
      ],
      "type": "object"
    },
    "outcome": {
      "additionalProperties": true,
      "properties": {
        "code": {
          "type": "string"
        },
        "log_level": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "warn": {
      "additionalProperties": true,
      "properties": {
        "log_level": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "message"
      ],
      "type": "object"
    }
  },
  "$id": "https://okham.org/schemas/opc/0.2.0/schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": true,
  "description": "Unpublished 0.2.0 draft edition derived from the current OKHAM runtime catalogue. See the specification for semantic checks and coverage limits.",
  "properties": {
    "condition": {
      "additionalProperties": true,
      "properties": {
        "expression": {
          "type": "string"
        },
        "inputs": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "language": {
          "type": "string"
        }
      },
      "required": [
        "expression",
        "inputs"
      ],
      "type": "object"
    },
    "decision": {
      "additionalProperties": true,
      "properties": {
        "allow": {
          "$ref": "#/$defs/outcome"
        },
        "constrain": {
          "$ref": "#/$defs/constrain"
        },
        "deny": {
          "$ref": "#/$defs/outcome"
        },
        "warn": {
          "$ref": "#/$defs/warn"
        }
      },
      "type": "object"
    },
    "id": {
      "description": "Policy identifier (unique, namespaced).",
      "pattern": "^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9]*){3,}$",
      "type": "string"
    },
    "metadata": {
      "additionalProperties": true,
      "type": "object"
    },
    "name": {
      "description": "Human-readable policy name.",
      "maxLength": 100,
      "minLength": 2,
      "type": "string"
    },
    "policy": {
      "description": "OPC version (semantic version).",
      "pattern": "^\\d+\\.\\d+\\.\\d+$",
      "type": "string"
    },
    "scope": {
      "description": "Policy scope.",
      "enum": [
        "global",
        "service",
        "capability"
      ],
      "type": "string"
    },
    "status": {
      "description": "Lifecycle status.",
      "enum": [
        "draft",
        "active",
        "deprecated",
        "removed"
      ],
      "type": "string"
    },
    "target": {
      "additionalProperties": true,
      "properties": {
        "capability": {
          "type": "string"
        },
        "event": {
          "type": "string"
        },
        "function": {
          "type": "string"
        },
        "interaction": {
          "type": "string"
        },
        "operations": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "type": "object"
    },
    "version": {
      "description": "Policy version.",
      "pattern": "^\\d+\\.\\d+\\.\\d+$",
      "type": "string"
    }
  },
  "required": [
    "policy",
    "id",
    "name",
    "version",
    "status",
    "scope",
    "condition",
    "decision"
  ],
  "title": "OPC Policy Definition",
  "type": "object",
  "x-okham-identity-edition": "User-authorized local identity amendment: global contract identifiers use authority.domain.kind.name with lowercase alphanumeric dot-separated segments. Existing format and artifact versions and schema URIs are preserved. This annotation identifies a local amendment, not a published standards release."
}