{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/crs-waf-test-file/versions/2.1.0.json",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/coreruleset/ftw-tests-schema/main/spec/v2.1.0/waf-tests-schema-v2.1.0.json",
    "sourceSha256": "2aba54f9630702334f6d0bf813036dcbd3605d679389b455016008e45ff69c92",
    "fileMatch": [
      "*.waft",
      ".waft.yaml",
      ".waft.yml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "$ref": "#/$defs/FTWTest",
  "$defs": {
    "FTWTest": {
      "properties": {
        "meta": {
          "$ref": "#/$defs/FTWTestMeta"
        },
        "rule_id": {
          "type": "integer"
        },
        "tests": {
          "items": {
            "$ref": "#/$defs/Test"
          },
          "type": "array"
        }
      },
      "required": [
        "meta",
        "rule_id",
        "tests"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "FTWTestMeta": {
      "properties": {
        "author": {
          "type": "string"
        },
        "enabled": {
          "type": "boolean"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "tags": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "type": "object",
      "additionalProperties": false
    },
    "Input": {
      "properties": {
        "dest_addr": {
          "type": "string"
        },
        "port": {
          "type": "integer"
        },
        "protocol": {
          "type": "string"
        },
        "uri": {
          "type": "string"
        },
        "follow_redirect": {
          "type": "boolean"
        },
        "version": {
          "type": "string"
        },
        "method": {
          "type": "string"
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "data": {
          "type": "string"
        },
        "encoded_data": {
          "type": "string"
        },
        "save_cookie": {
          "type": "boolean"
        },
        "stop_magic": {
          "type": "boolean"
        },
        "autocomplete_headers": {
          "type": "boolean"
        },
        "encoded_request": {
          "type": "string"
        },
        "raw_request": {
          "type": "string"
        },
        "response": {
          "$ref": "#/$defs/Response"
        }
      },
      "type": "object",
      "additionalProperties": false
    },
    "Log": {
      "properties": {
        "expect_ids": {
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        "no_expect_ids": {
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        "match_regex": {
          "type": "string"
        },
        "no_match_regex": {
          "type": "string"
        }
      },
      "type": "object",
      "additionalProperties": false
    },
    "Output": {
      "properties": {
        "status": {
          "type": "integer"
        },
        "response_contains": {
          "type": "string"
        },
        "log_contains": {
          "type": "string"
        },
        "no_log_contains": {
          "type": "string"
        },
        "log": {
          "$ref": "#/$defs/Log"
        },
        "expect_error": {
          "type": "boolean"
        },
        "retry_once": {
          "type": "boolean"
        },
        "isolated": {
          "type": "boolean"
        }
      },
      "type": "object",
      "additionalProperties": false
    },
    "Response": {
      "properties": {
        "headers": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "status": {
          "type": "integer"
        },
        "body": {
          "type": "string"
        },
        "encoded_body": {
          "type": "string"
        },
        "log_message": {
          "type": "string"
        }
      },
      "type": "object",
      "additionalProperties": false
    },
    "Stage": {
      "properties": {
        "description": {
          "type": "string"
        },
        "input": {
          "$ref": "#/$defs/Input"
        },
        "output": {
          "$ref": "#/$defs/Output"
        }
      },
      "required": [
        "input",
        "output"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "Test": {
      "properties": {
        "test_title": {
          "type": "string"
        },
        "test_id": {
          "type": "integer"
        },
        "desc": {
          "type": "string"
        },
        "stages": {
          "items": {
            "$ref": "#/$defs/Stage"
          },
          "type": "array"
        },
        "tags": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "required": [
        "test_id",
        "stages"
      ],
      "type": "object",
      "additionalProperties": false
    }
  }
}
