{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/auth0/main/json-schema/auth0-rule-schema.json",
  "title": "Auth0 Rule",
  "description": "JSON Schema for Auth0 Rule entity, extracted from the Auth0 Management API OpenAPI v2.0 spec (component: Rule).",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "name": {
      "type": "string",
      "description": "Name of this rule.",
      "default": "rule_1"
    },
    "id": {
      "type": "string",
      "description": "ID of this rule.",
      "default": "con_0000000000000001"
    },
    "enabled": {
      "type": "boolean",
      "description": "Whether the rule is enabled (true), or disabled (false).",
      "default": true
    },
    "script": {
      "type": "string",
      "description": "Code to be executed when this rule runs.",
      "default": "function (user, context, callback) {\n  callback(null, user, context);\n}"
    },
    "order": {
      "type": "number",
      "description": "Order that this rule should execute in relative to other rules. Lower-valued rules execute first.",
      "default": 1
    },
    "stage": {
      "type": "string",
      "description": "Execution stage of this rule. Can be `login_success`, `login_failure`, or `pre_authorize`.",
      "default": "login_success"
    }
  }
}