{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://quadrastack.com/schemas/v1/playbook.json",
  "version": "1.0.0",
  "title": "Quadrastack Playbook Schema",
  "description": "Complete JSON Schema for quadrastack CLI playbook YAML files including requests, workflows, scenarios, httpClients, vars, and mocks",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "requests": {
      "type": "object",
      "description": "HTTP request definitions with validation and templating support",
      "additionalProperties": {
        "$ref": "#/definitions/Request"
      }
    },
    "workflows": {
      "type": "object",
      "description": "Multi-step request sequences with session variable capture",
      "additionalProperties": {
        "$ref": "#/definitions/Workflow"
      }
    },
    "scenarios": {
      "type": "object",
      "description": "Test suites with label selectors and load testing profiles",
      "additionalProperties": {
        "$ref": "#/definitions/Scenario"
      }
    },
    "httpClients": {
      "type": "object",
      "description": "HTTP client configurations with retry logic, timeouts, and TLS settings",
      "additionalProperties": {
        "$ref": "#/definitions/HTTPClient"
      }
    },
    "vars": {
      "type": "object",
      "description": "Variable profiles for different environments (dev, staging, prod, etc.)",
      "additionalProperties": {
        "$ref": "#/definitions/VarsProfile"
      }
    },
    "mockServer": {
      "type": "object",
      "description": "Mock HTTP server configurations",
      "additionalProperties": {
        "$ref": "#/definitions/MockServer"
      }
    },
    "mocks": {
      "type": "object",
      "description": "Mock route definitions with request matching and response sequences",
      "additionalProperties": {
        "$ref": "#/definitions/MockRoute"
      }
    }
  },
  "definitions": {
    "Request": {
      "type": "object",
      "description": "Defines an HTTP request with method, URL, headers, body, and response validation",
      "required": [
        "method",
        "url"
      ],
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": "string",
          "description": "Human-readable description of what this request does",
          "examples": [
            "Fetch all users from the API",
            "Create a new user account"
          ]
        },
        "method": {
          "type": "string",
          "enum": [
            "GET",
            "POST",
            "PUT",
            "PATCH",
            "DELETE",
            "HEAD",
            "OPTIONS"
          ],
          "description": "HTTP method for the request",
          "examples": [
            "GET",
            "POST",
            "PUT"
          ]
        },
        "url": {
          "type": "string",
          "description": "Full URL or path (if baseUrl is set in httpClient). Supports template variables using {{.vars.varName}} syntax.",
          "examples": [
            "https://api.example.com/users",
            "/users/{{.vars.userId}}",
            "{{.vars.baseUrl}}/api/v1/posts"
          ]
        },
        "headers": {
          "type": "object",
          "description": "HTTP headers to include in the request. Supports template variables.",
          "additionalProperties": {
            "type": "string"
          },
          "examples": [
            {
              "Authorization": "Bearer {{.vars.token}}",
              "Content-Type": "application/json"
            }
          ]
        },
        "body": {
          "description": "Request body. Can be a string (JSON/XML/raw) or a YAML object (converted to JSON). Use 'file path/to/file' prefix for multipart file uploads.",
          "oneOf": [
            {
              "type": "string",
              "description": "Raw string body (JSON, XML, form data, etc.)",
              "examples": [
                "{\"name\": \"John\", \"email\": \"john@example.com\"}",
                "<user><name>John</name></user>"
              ]
            },
            {
              "type": "object",
              "description": "YAML object that will be converted to JSON. Use 'file path' for multipart uploads.",
              "examples": [
                {
                  "name": "John",
                  "email": "john@example.com"
                },
                {
                  "avatar": "file ./avatar.png",
                  "name": "John",
                  "documents": [
                    "file ./doc1.pdf",
                    "file ./doc2.pdf"
                  ]
                }
              ]
            }
          ]
        },
        "labels": {
          "description": "Labels for categorizing and filtering requests in scenarios",
          "oneOf": [
            {
              "type": "string",
              "description": "Single label",
              "examples": [
                "smoke",
                "critical"
              ]
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Multiple labels",
              "examples": [
                [
                  "smoke",
                  "critical",
                  "api"
                ]
              ]
            }
          ]
        },
        "dependsOn": {
          "description": "Request dependencies that must run before this request. Ensures execution order.",
          "oneOf": [
            {
              "type": "string",
              "description": "Single dependency",
              "examples": [
                "login-request"
              ]
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Multiple dependencies",
              "examples": [
                [
                  "login-request",
                  "get-user-profile"
                ]
              ]
            }
          ]
        },
        "cache": {
          "type": "string",
          "pattern": "^[0-9]+(ns|us|µs|ms|s|m|h)$",
          "description": "Cache TTL duration for response caching. Format: number + unit (ns, us, µs, ms, s, m, h)",
          "examples": [
            "5m",
            "1h",
            "30s",
            "500ms"
          ]
        },
        "client": {
          "type": "string",
          "description": "Named HTTP client to use for this request (references httpClients). Defaults to 'default'.",
          "default": "default",
          "examples": [
            "default",
            "api-client",
            "auth-client"
          ]
        },
        "expect": {
          "$ref": "#/definitions/ExpectSpec",
          "description": "Response validation using Compact DSL assertions"
        }
      },
      "examples": [
        {
          "description": "Get all users",
          "method": "GET",
          "url": "/api/users",
          "headers": {
            "Authorization": "Bearer {{.vars.token}}"
          },
          "expect": {
            "status": 200,
            "headers": {
              "Content-Type": "contains application/json"
            },
            "body": {
              "$.users": "type array",
              "$.users.length": "> 0"
            }
          }
        },
        {
          "description": "Create a new user",
          "method": "POST",
          "url": "/api/users",
          "labels": [
            "smoke",
            "critical"
          ],
          "headers": {
            "Content-Type": "application/json"
          },
          "body": {
            "name": "{{.vars.userName}}",
            "email": "{{.vars.userEmail}}"
          },
          "expect": {
            "status": 201,
            "body": {
              "$.id": "exists",
              "$.name": "{{.vars.userName}}"
            },
            "responseTime": "< 500ms"
          }
        }
      ]
    },
    "ExpectSpec": {
      "type": "object",
      "description": "Response validation spec using Compact DSL operators for assertions",
      "additionalProperties": false,
      "properties": {
        "status": {
          "description": "Expected HTTP status code(s) or assertion expression",
          "oneOf": [
            {
              "type": "integer",
              "description": "Exact status code",
              "examples": [
                200,
                201,
                404
              ]
            },
            {
              "type": "array",
              "items": {
                "type": "integer"
              },
              "description": "List of acceptable status codes",
              "examples": [
                [
                  200,
                  201
                ],
                [
                  400,
                  404
                ]
              ]
            },
            {
              "type": "string",
              "description": "Assertion expression using Compact DSL operators",
              "examples": [
                ">= 200",
                "< 400",
                "in [200, 201, 204]"
              ]
            }
          ]
        },
        "headers": {
          "type": "object",
          "description": "Header name to assertion mapping using Compact DSL operators",
          "additionalProperties": {
            "$ref": "#/definitions/AssertionValue"
          },
          "examples": [
            {
              "Content-Type": "contains application/json",
              "X-Rate-Limit": "exists",
              "Authorization": "!exists"
            }
          ]
        },
        "body": {
          "type": "object",
          "description": "JSONPath to assertion mapping for response body validation using Compact DSL operators",
          "additionalProperties": {
            "$ref": "#/definitions/AssertionValue"
          },
          "examples": [
            {
              "$.status": "success",
              "$.data": "type object",
              "$.data.id": "exists",
              "$.data.name": "!empty",
              "$.items": "type array",
              "$.items.length": "> 0",
              "$.total": ">= 1"
            }
          ]
        },
        "responseTime": {
          "type": "string",
          "description": "Response time assertion using duration comparison operators (< <= > >= ==). Format: operator + duration",
          "pattern": "^(<=?|>=?|==)?\\s*[0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h)$",
          "examples": [
            "< 200ms",
            "<= 1s",
            "> 100ms",
            "< 500ms"
          ]
        }
      },
      "examples": [
        {
          "status": 200,
          "headers": {
            "Content-Type": "contains application/json"
          },
          "body": {
            "$.success": true,
            "$.data": "type object",
            "$.data.id": "exists"
          },
          "responseTime": "< 500ms"
        }
      ]
    },
    "AssertionValue": {
      "description": "Compact DSL assertion value supporting various operators and comparisons",
      "oneOf": [
        {
          "type": "string",
          "description": "String assertion with Compact DSL operators: exists, !exists, !empty, contains 'text', !contains 'text', matches 'regex', in [val1,val2], > N, >= N, < N, <= N, type <type>, length N, length > N, or exact value",
          "examples": [
            "exists",
            "!exists",
            "!empty",
            "contains success",
            "!contains error",
            "matches ^[0-9]+$",
            "in [active, pending]",
            "> 100",
            ">= 0",
            "< 1000",
            "type string",
            "type number",
            "type array",
            "type object",
            "length 10",
            "length > 5",
            "exact-value"
          ]
        },
        {
          "type": "number",
          "description": "Exact numeric value comparison",
          "examples": [
            200,
            0,
            42
          ]
        },
        {
          "type": "boolean",
          "description": "Exact boolean value comparison",
          "examples": [
            true,
            false
          ]
        },
        {
          "type": "array",
          "description": "Value must match one of the items in the array",
          "examples": [
            [
              "active",
              "pending",
              "completed"
            ],
            [
              200,
              201,
              204
            ]
          ]
        },
        {
          "type": "null",
          "description": "Value must be null"
        }
      ]
    },
    "Workflow": {
      "type": "object",
      "description": "Multi-step request sequence executed in order with session variable capture",
      "required": [
        "steps"
      ],
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": "string",
          "description": "Human-readable description of this workflow",
          "examples": [
            "Complete user registration flow",
            "E2E checkout process"
          ]
        },
        "labels": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Labels for categorizing and filtering workflows",
          "examples": [
            [
              "e2e",
              "critical"
            ]
          ]
        },
        "steps": {
          "type": "array",
          "description": "Ordered list of requests to execute. Each step runs sequentially.",
          "minItems": 1,
          "items": {
            "$ref": "#/definitions/WorkflowStep"
          }
        }
      },
      "examples": [
        {
          "description": "User registration and login flow",
          "labels": [
            "e2e",
            "smoke"
          ],
          "steps": [
            {
              "request": "create-user",
              "out": "newUser"
            },
            {
              "request": "login",
              "out": "session"
            },
            {
              "request": "get-profile"
            }
          ]
        }
      ]
    },
    "WorkflowStep": {
      "type": "object",
      "description": "Single step in a workflow that executes a request",
      "required": [
        "request"
      ],
      "additionalProperties": false,
      "properties": {
        "request": {
          "type": "string",
          "description": "Name of the request to execute (must be defined in requests section)",
          "examples": [
            "login-request",
            "create-user",
            "get-data"
          ]
        },
        "out": {
          "type": "string",
          "description": "Variable name to capture response in session. Accessible via {{.session.varName.status}}, {{.session.varName.headers.HeaderName}}, {{.session.varName.body.jsonPath}}, {{.session.varName.bodyRaw}}",
          "examples": [
            "loginResponse",
            "userData",
            "apiResult"
          ]
        }
      },
      "examples": [
        {
          "request": "login",
          "out": "auth"
        },
        {
          "request": "get-users"
        }
      ]
    },
    "Scenario": {
      "type": "object",
      "description": "Test suite that selects requests by label expressions with optional load testing configuration",
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": "string",
          "description": "Human-readable description of this test scenario",
          "examples": [
            "Smoke tests for critical API endpoints",
            "Load test for user creation"
          ]
        },
        "labelSelector": {
          "type": "string",
          "description": "Boolean expression for selecting requests by labels. Optional - if omitted or empty, matches all requests. Supports: && (AND), || (OR), ! (NOT). Examples: 'smoke', 'smoke && critical', 'smoke || integration', '!flaky', 'smoke && !flaky'",
          "examples": [
            "",
            "smoke",
            "smoke && critical",
            "smoke || integration",
            "!flaky",
            "smoke && !flaky",
            "(smoke || critical) && !wip"
          ]
        },
        "concurrency": {
          "type": "integer",
          "description": "Number of concurrent executions for non-load-test scenarios",
          "minimum": 1,
          "default": 1,
          "examples": [
            1,
            5,
            10
          ]
        },
        "loadProfile": {
          "$ref": "#/definitions/LoadProfile",
          "description": "Load testing configuration with rate limiting and duration"
        }
      },
      "examples": [
        {
          "description": "Run all requests in the playbook",
          "labelSelector": ""
        },
        {
          "description": "Smoke tests only",
          "labelSelector": "smoke",
          "concurrency": 1
        },
        {
          "description": "Load test for API",
          "labelSelector": "api && !flaky",
          "loadProfile": {
            "concurrency": 10,
            "rate": 100,
            "duration": "5m"
          }
        },
        {
          "description": "Run all requests with load testing (labelSelector omitted)",
          "loadProfile": {
            "concurrency": 5,
            "rate": 50,
            "duration": "2m"
          }
        }
      ]
    },
    "LoadProfile": {
      "type": "object",
      "description": "Load testing configuration for scenarios",
      "additionalProperties": false,
      "properties": {
        "concurrency": {
          "type": "integer",
          "description": "Number of concurrent virtual users/workers",
          "minimum": 1,
          "default": 1,
          "examples": [
            1,
            10,
            50,
            100
          ]
        },
        "rate": {
          "type": "number",
          "description": "Requests per second rate limit",
          "minimum": 0,
          "default": 1,
          "examples": [
            1,
            10,
            100,
            1000
          ]
        },
        "duration": {
          "description": "How long to run the load test. Can be a duration string or number of seconds.",
          "oneOf": [
            {
              "type": "string",
              "pattern": "^[0-9]+(ns|us|µs|ms|s|m|h)$",
              "description": "Duration string with unit",
              "examples": [
                "30s",
                "5m",
                "1h"
              ]
            },
            {
              "type": "number",
              "description": "Duration in seconds",
              "examples": [
                30,
                300,
                3600
              ]
            }
          ]
        }
      },
      "examples": [
        {
          "concurrency": 10,
          "rate": 100,
          "duration": "5m"
        },
        {
          "concurrency": 50,
          "rate": 500,
          "duration": 300
        }
      ]
    },
    "HTTPClient": {
      "type": "object",
      "description": "HTTP client configuration with base URL, headers, timeout, proxy, TLS, and retry logic. A 'default' client can be defined that all other clients inherit from.",
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": "string",
          "description": "Human-readable description of this HTTP client configuration",
          "examples": [
            "Production API client",
            "Mock server client"
          ]
        },
        "baseUrl": {
          "type": "string",
          "format": "uri",
          "description": "Base URL prepended to all request URLs using this client. Supports template variables.",
          "examples": [
            "https://api.example.com",
            "{{.vars.apiBaseUrl}}",
            "http://localhost:8080"
          ]
        },
        "headers": {
          "type": "object",
          "description": "Default headers sent with all requests using this client. Supports template variables.",
          "additionalProperties": {
            "type": "string"
          },
          "examples": [
            {
              "Authorization": "Bearer {{.vars.apiToken}}",
              "User-Agent": "quadrastack-cli/1.0",
              "Accept": "application/json"
            }
          ]
        },
        "timeout": {
          "type": "string",
          "pattern": "^[0-9]+(ns|us|µs|ms|s|m|h)$",
          "description": "Request timeout duration. Format: number + unit (ns, us, µs, ms, s, m, h)",
          "examples": [
            "30s",
            "5m",
            "10s"
          ]
        },
        "proxy": {
          "type": "string",
          "format": "uri",
          "description": "HTTP/HTTPS proxy URL",
          "examples": [
            "http://proxy.example.com:8080",
            "socks5://localhost:1080"
          ]
        },
        "caCertFile": {
          "type": "string",
          "description": "Path to CA certificate file for TLS verification (absolute or relative to playbook file)",
          "examples": [
            "./certs/ca.crt",
            "/etc/ssl/certs/ca-bundle.crt"
          ]
        },
        "skipVerify": {
          "type": "boolean",
          "description": "Skip TLS certificate verification (insecure, use only for testing)",
          "default": false,
          "examples": [
            false,
            true
          ]
        },
        "retry": {
          "$ref": "#/definitions/RetryConfig",
          "description": "Retry configuration for failed requests"
        }
      },
      "examples": [
        {
          "description": "Default API client",
          "baseUrl": "https://api.example.com",
          "headers": {
            "Authorization": "Bearer {{.vars.token}}"
          },
          "timeout": "30s",
          "retry": {
            "maxAttempts": 3,
            "retryOn": [
              500,
              502,
              503,
              504
            ],
            "backoff": "exponential",
            "initialDelay": 1000,
            "maxDelay": 10000
          }
        }
      ]
    },
    "RetryConfig": {
      "type": "object",
      "description": "Retry configuration for HTTP requests with backoff strategies",
      "additionalProperties": false,
      "properties": {
        "maxAttempts": {
          "type": "integer",
          "description": "Maximum number of attempts (1 = no retry, 2+ = retry)",
          "minimum": 1,
          "default": 1,
          "examples": [
            1,
            3,
            5
          ]
        },
        "retryOn": {
          "type": "array",
          "items": {
            "type": "integer",
            "description": "HTTP status codes to retry on"
          },
          "description": "List of HTTP status codes that trigger a retry",
          "default": [],
          "examples": [
            [
              500,
              502,
              503,
              504
            ],
            [
              429,
              500,
              503
            ]
          ]
        },
        "backoff": {
          "type": "string",
          "enum": [
            "fixed",
            "linear",
            "exponential"
          ],
          "description": "Backoff strategy for retry delays: 'fixed' (constant delay), 'linear' (delay increases linearly), 'exponential' (delay doubles each time)",
          "default": "fixed",
          "examples": [
            "fixed",
            "linear",
            "exponential"
          ]
        },
        "initialDelay": {
          "type": "integer",
          "description": "Initial delay in milliseconds before first retry",
          "minimum": 0,
          "default": 1000,
          "examples": [
            1000,
            500,
            2000
          ]
        },
        "maxDelay": {
          "type": "integer",
          "description": "Maximum delay in milliseconds for exponential backoff",
          "minimum": 0,
          "default": 30000,
          "examples": [
            30000,
            10000,
            60000
          ]
        }
      },
      "examples": [
        {
          "maxAttempts": 3,
          "retryOn": [
            500,
            502,
            503
          ],
          "backoff": "exponential",
          "initialDelay": 1000,
          "maxDelay": 10000
        }
      ]
    },
    "VarsProfile": {
      "type": "object",
      "description": "Named set of variables for environment-specific configuration (dev, staging, prod, etc.). Variables can be any type: strings, numbers, booleans, objects, arrays. Accessible in templates via {{.vars.varName}}. Environment variables can override using dot notation (e.g., BASEURL=https://prod.com overrides vars.default.baseurl).",
      "additionalProperties": true,
      "examples": [
        {
          "baseUrl": "https://api.dev.example.com",
          "token": "dev-token-123",
          "debug": true,
          "timeout": 5000,
          "features": {
            "newUI": true,
            "betaFeatures": false
          },
          "endpoints": [
            "/api/v1",
            "/api/v2"
          ]
        },
        {
          "baseUrl": "https://api.prod.example.com",
          "token": "prod-token-456",
          "debug": false,
          "timeout": 30000
        }
      ]
    },
    "MockServer": {
      "type": "object",
      "description": "Mock HTTP server configuration for testing without real backends",
      "required": [
        "listen"
      ],
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": "string",
          "description": "Human-readable description of this mock server",
          "examples": [
            "User API mock",
            "Payment service mock"
          ]
        },
        "listen": {
          "type": "string",
          "description": "Listen address and port for the mock server",
          "examples": [
            ":8080",
            "localhost:9000",
            "0.0.0.0:3000"
          ]
        },
        "basePath": {
          "type": "string",
          "description": "Base path prefix for all routes on this server",
          "examples": [
            "/api",
            "/v1",
            "/mock"
          ]
        },
        "tls": {
          "$ref": "#/definitions/TLSConfig",
          "description": "TLS/HTTPS configuration for the mock server"
        },
        "defaults": {
          "$ref": "#/definitions/MockResponseDefaults",
          "description": "Default response values applied to all routes unless overridden"
        }
      },
      "examples": [
        {
          "description": "API mock server",
          "listen": ":8080",
          "basePath": "/api",
          "defaults": {
            "status": 200,
            "headers": {
              "Content-Type": "application/json"
            }
          }
        }
      ]
    },
    "TLSConfig": {
      "type": "object",
      "description": "TLS/HTTPS configuration for mock servers",
      "required": [
        "enabled"
      ],
      "additionalProperties": false,
      "properties": {
        "enabled": {
          "type": "boolean",
          "description": "Enable TLS/HTTPS for this mock server",
          "examples": [
            true,
            false
          ]
        },
        "certFile": {
          "type": "string",
          "description": "Path to TLS certificate file (absolute or relative to playbook file)",
          "examples": [
            "./certs/server.crt",
            "/etc/ssl/server.crt"
          ]
        },
        "keyFile": {
          "type": "string",
          "description": "Path to TLS private key file (absolute or relative to playbook file)",
          "examples": [
            "./certs/server.key",
            "/etc/ssl/server.key"
          ]
        }
      },
      "examples": [
        {
          "enabled": true,
          "certFile": "./certs/localhost.crt",
          "keyFile": "./certs/localhost.key"
        }
      ]
    },
    "MockResponseDefaults": {
      "type": "object",
      "description": "Default response values for all mock routes on a server",
      "additionalProperties": false,
      "properties": {
        "status": {
          "type": "integer",
          "description": "Default HTTP status code",
          "examples": [
            200,
            201,
            404
          ]
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Default response headers",
          "examples": [
            {
              "Content-Type": "application/json",
              "X-Mock-Server": "quadrastack"
            }
          ]
        },
        "body": {
          "type": "string",
          "description": "Default response body",
          "examples": [
            "{\"status\": \"ok\"}",
            ""
          ]
        }
      }
    },
    "MockRoute": {
      "type": "object",
      "description": "Mock route definition with request matching and response sequences",
      "required": [
        "server",
        "match"
      ],
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": "string",
          "description": "Human-readable description of this mock route",
          "examples": [
            "Get user by ID",
            "Create new order"
          ]
        },
        "server": {
          "type": "string",
          "description": "Name of the mock server this route belongs to (references mockServer)",
          "examples": [
            "api-mock",
            "auth-mock"
          ]
        },
        "match": {
          "$ref": "#/definitions/MockRouteMatch",
          "description": "Request matching rules using Compact DSL operators"
        },
        "respond": {
          "type": "array",
          "description": "Response sequence (same as 'sequence', use either one)",
          "items": {
            "$ref": "#/definitions/MockResponse"
          }
        },
        "sequence": {
          "type": "array",
          "description": "Response sequence (same as 'respond', use either one). Responses are returned in order based on 'count'.",
          "items": {
            "$ref": "#/definitions/MockResponse"
          }
        }
      },
      "examples": [
        {
          "description": "Get user by ID",
          "server": "api-mock",
          "match": {
            "method": "GET",
            "path": "/users/{id}",
            "headers": {
              "Authorization": "exists"
            }
          },
          "respond": [
            {
              "status": 200,
              "body": "{\"id\": \"123\", \"name\": \"John Doe\"}"
            }
          ]
        },
        {
          "description": "Flaky endpoint simulation",
          "server": "api-mock",
          "match": {
            "method": "POST",
            "path": "/orders"
          },
          "sequence": [
            {
              "count": 2,
              "status": 500,
              "body": "{\"error\": \"Internal server error\"}"
            },
            {
              "status": 201,
              "body": "{\"id\": \"order-123\", \"status\": \"created\"}"
            }
          ]
        }
      ]
    },
    "MockRouteMatch": {
      "type": "object",
      "description": "Request matching rules for mock routes using Compact DSL operators",
      "required": [
        "method",
        "path"
      ],
      "additionalProperties": false,
      "properties": {
        "method": {
          "description": "HTTP method(s) to match",
          "oneOf": [
            {
              "type": "string",
              "enum": [
                "GET",
                "POST",
                "PUT",
                "PATCH",
                "DELETE",
                "HEAD",
                "OPTIONS"
              ],
              "description": "Single HTTP method"
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "GET",
                  "POST",
                  "PUT",
                  "PATCH",
                  "DELETE",
                  "HEAD",
                  "OPTIONS"
                ]
              },
              "description": "Multiple HTTP methods"
            }
          ],
          "examples": [
            "GET",
            [
              "GET",
              "POST"
            ]
          ]
        },
        "path": {
          "type": "string",
          "description": "Path pattern to match. Use {paramName} for path parameters (e.g., /users/{id})",
          "examples": [
            "/users",
            "/users/{id}",
            "/api/v1/posts/{postId}/comments"
          ]
        },
        "query": {
          "type": "object",
          "description": "Query parameter assertions using Compact DSL operators",
          "additionalProperties": {
            "$ref": "#/definitions/AssertionValue"
          },
          "examples": [
            {
              "page": "exists",
              "limit": "> 0",
              "filter": "contains active"
            }
          ]
        },
        "headers": {
          "type": "object",
          "description": "Header assertions using Compact DSL operators",
          "additionalProperties": {
            "$ref": "#/definitions/AssertionValue"
          },
          "examples": [
            {
              "Authorization": "exists",
              "Content-Type": "contains application/json"
            }
          ]
        },
        "body": {
          "type": "object",
          "description": "JSONPath body assertions using Compact DSL operators",
          "additionalProperties": {
            "$ref": "#/definitions/AssertionValue"
          },
          "examples": [
            {
              "$.name": "!empty",
              "$.email": "matches ^[\\w.]+@[\\w.]+$",
              "$.age": ">= 18"
            }
          ]
        },
        "form": {
          "type": "object",
          "description": "Form field assertions using Compact DSL operators",
          "additionalProperties": {
            "$ref": "#/definitions/AssertionValue"
          },
          "examples": [
            {
              "username": "!empty",
              "password": "length >= 8"
            }
          ]
        },
        "files": {
          "type": "object",
          "description": "File field assertions using Compact DSL operators",
          "additionalProperties": {
            "$ref": "#/definitions/AssertionValue"
          },
          "examples": [
            {
              "avatar": "exists",
              "document": "!empty"
            }
          ]
        }
      },
      "examples": [
        {
          "method": "GET",
          "path": "/users/{id}"
        },
        {
          "method": [
            "POST",
            "PUT"
          ],
          "path": "/users",
          "headers": {
            "Content-Type": "contains application/json"
          },
          "body": {
            "$.email": "exists"
          }
        }
      ]
    },
    "MockResponse": {
      "type": "object",
      "description": "Mock response definition in a sequence. Responses are returned in order based on 'count'.",
      "additionalProperties": false,
      "properties": {
        "count": {
          "type": "integer",
          "description": "Number of times to return this response before moving to the next in sequence. Omit or 0 for infinite.",
          "minimum": 0,
          "examples": [
            1,
            2,
            5,
            0
          ]
        },
        "status": {
          "type": "integer",
          "description": "HTTP status code for this response",
          "examples": [
            200,
            201,
            404,
            500
          ]
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Response headers",
          "examples": [
            {
              "Content-Type": "application/json",
              "X-Request-ID": "123"
            }
          ]
        },
        "delay": {
          "type": "string",
          "pattern": "^[0-9]+(ns|us|µs|ms|s|m|h)$",
          "description": "Artificial delay before sending response. Format: number + unit",
          "examples": [
            "100ms",
            "1s",
            "500ms"
          ]
        },
        "body": {
          "type": "string",
          "description": "Response body (JSON, XML, plain text, etc.)",
          "examples": [
            "{\"status\": \"success\"}",
            "<response>OK</response>",
            "Plain text response"
          ]
        }
      },
      "examples": [
        {
          "status": 200,
          "headers": {
            "Content-Type": "application/json"
          },
          "body": "{\"id\": \"123\", \"name\": \"Test User\"}"
        },
        {
          "count": 2,
          "status": 503,
          "delay": "100ms",
          "body": "{\"error\": \"Service temporarily unavailable\"}"
        }
      ]
    }
  }
}