{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/azure-service-bus/json-schema/azure-service-bus-rule-schema.json",
  "title": "Rule",
  "description": "Description of Rule Resource.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_superseded/azure-service-bus-rules-api-openapi.yml#/components/schemas/Rule",
  "type": "object",
  "properties": {
    "properties": {
      "$ref": "#/$defs/Ruleproperties",
      "description": "Properties of Rule resource",
      "x-ms-client-flatten": true
    },
    "location": {
      "type": "string",
      "description": "The geo-location where the resource lives",
      "readOnly": true
    }
  },
  "allOf": [
    {
      "$ref": "../../../../../../common-types/resource-management/v6/types.json#/definitions/ProxyResource"
    }
  ],
  "$defs": {
    "Action": {
      "type": "object",
      "description": "Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression.",
      "properties": {
        "sqlExpression": {
          "type": "string",
          "description": "SQL expression. e.g. MyProperty='ABC'"
        },
        "compatibilityLevel": {
          "type": "integer",
          "format": "int32",
          "description": "This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20."
        },
        "requiresPreprocessing": {
          "type": "boolean",
          "description": "Value that indicates whether the rule action requires preprocessing.",
          "default": true
        }
      }
    },
    "CorrelationFilter": {
      "type": "object",
      "description": "Represents the correlation filter expression.",
      "properties": {
        "properties": {
          "type": "object",
          "description": "dictionary object for custom filters",
          "additionalProperties": {
            "type": "string"
          }
        },
        "correlationId": {
          "type": "string",
          "description": "Identifier of the correlation."
        },
        "messageId": {
          "type": "string",
          "description": "Identifier of the message."
        },
        "to": {
          "type": "string",
          "description": "Address to send to."
        },
        "replyTo": {
          "type": "string",
          "description": "Address of the queue to reply to."
        },
        "label": {
          "type": "string",
          "description": "Application specific label."
        },
        "sessionId": {
          "type": "string",
          "description": "Session identifier."
        },
        "replyToSessionId": {
          "type": "string",
          "description": "Session identifier to reply to."
        },
        "contentType": {
          "type": "string",
          "description": "Content type of the message."
        },
        "requiresPreprocessing": {
          "type": "boolean",
          "description": "Value that indicates whether the rule action requires preprocessing.",
          "default": true
        }
      }
    },
    "FilterType": {
      "type": "string",
      "description": "Rule filter types",
      "enum": [
        "SqlFilter",
        "CorrelationFilter"
      ],
      "x-ms-enum": {
        "name": "FilterType",
        "modelAsString": false
      }
    },
    "Ruleproperties": {
      "type": "object",
      "description": "Description of Rule Resource.",
      "properties": {
        "action": {
          "$ref": "#/$defs/Action",
          "description": "Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression."
        },
        "filterType": {
          "$ref": "#/$defs/FilterType",
          "description": "Filter type that is evaluated against a BrokeredMessage."
        },
        "sqlFilter": {
          "$ref": "#/$defs/SqlFilter",
          "description": "Properties of sqlFilter"
        },
        "correlationFilter": {
          "$ref": "#/$defs/CorrelationFilter",
          "description": "Properties of correlationFilter"
        }
      }
    },
    "SqlFilter": {
      "type": "object",
      "description": "Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline.",
      "properties": {
        "sqlExpression": {
          "type": "string",
          "description": "The SQL expression. e.g. MyProperty='ABC'"
        },
        "compatibilityLevel": {
          "type": "integer",
          "format": "int32",
          "description": "This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20."
        },
        "requiresPreprocessing": {
          "type": "boolean",
          "description": "Value that indicates whether the rule action requires preprocessing.",
          "default": true
        }
      }
    }
  }
}