{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/vulnify-io/json-schema/vulnify-io-policy-test-case-schema.json",
  "title": "PolicyTestCase",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/vulnify-io-openapi.json#/components/schemas/PolicyTestCase",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "name",
    "input"
  ],
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "input": {
      "$ref": "#/$defs/PolicyTestInput"
    },
    "expect": {
      "$ref": "#/$defs/PolicyTestExpect"
    }
  },
  "$defs": {
    "PolicyTestExpect": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "decision"
      ],
      "properties": {
        "decision": {
          "type": "string",
          "enum": [
            "ALLOW",
            "REVIEW",
            "BLOCK"
          ]
        },
        "policy": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120,
          "description": "Expected matched policy name."
        }
      }
    },
    "PolicyTestInput": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "agent",
        "action",
        "resource"
      ],
      "description": "action is an event action. resource is the resource name registered in the organization, not the policy resource classification. metadata is accepted and not used.",
      "properties": {
        "agent": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100,
          "description": "Agent name."
        },
        "action": {
          "type": "string",
          "enum": [
            "READ_DATA",
            "WRITE_DATA",
            "DELETE_DATA",
            "EXPORT_DATA",
            "SEND_EMAIL"
          ]
        },
        "resource": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100,
          "description": "Resource name."
        },
        "destination": {
          "type": "string",
          "enum": [
            "INTERNAL",
            "EXTERNAL_EMAIL",
            "EXTERNAL_API"
          ]
        },
        "recordsAffected": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100000000
        },
        "containsSensitiveData": {
          "type": "boolean"
        },
        "metadata": {
          "type": "object",
          "additionalProperties": true,
          "description": "Accepted and not used by the policy engine."
        }
      }
    }
  }
}