{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/devarmor/json-schema/devarmor-rule-schema.json",
  "title": "Rule",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/devarmor-openapi.json#/components/schemas/Rule",
  "properties": {
    "symbolic_name": {
      "type": "string",
      "pattern": "^[0-9a-z-]+$",
      "title": "Symbolic Name"
    },
    "title": {
      "type": "string",
      "title": "Title"
    },
    "rule": {
      "type": "string",
      "title": "Rule"
    },
    "platform": {
      "anyOf": [
        {
          "$ref": "#/$defs/AICodePlatform"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "title": "Updated At"
    },
    "id": {
      "type": "integer",
      "title": "Id"
    },
    "project_id": {
      "type": "integer",
      "title": "Project Id"
    },
    "scope": {
      "anyOf": [
        {
          "$ref": "#/$defs/RuleScope"
        },
        {
          "type": "null"
        }
      ]
    },
    "threat_model_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Threat Model Id"
    },
    "threat_model_version": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^\\d+(\\.\\d+)*$"
        },
        {
          "type": "null"
        }
      ],
      "title": "Threat Model Version"
    },
    "design_review_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Design Review Id"
    },
    "policy_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Policy Id"
    },
    "source_repository_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Source Repository Id"
    },
    "source_path": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Source Path"
    },
    "expresses_control_ids": {
      "items": {
        "type": "integer"
      },
      "type": "array",
      "title": "Expresses Control Ids"
    },
    "expresses_requirement_ids": {
      "items": {
        "type": "integer"
      },
      "type": "array",
      "title": "Expresses Requirement Ids"
    }
  },
  "type": "object",
  "required": [
    "symbolic_name",
    "title",
    "rule",
    "platform",
    "id",
    "project_id",
    "source_repository_id",
    "source_path",
    "expresses_control_ids",
    "expresses_requirement_ids"
  ],
  "$defs": {
    "AICodePlatform": {
      "type": "string",
      "enum": [
        "augment",
        "cursor",
        "github"
      ],
      "title": "AICodePlatform"
    },
    "RuleScope": {
      "type": "string",
      "enum": [
        "threat_model",
        "threat_model_version",
        "design_review"
      ],
      "title": "RuleScope"
    }
  }
}