{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "urn:trafficparrot:mapping-schema:grpc",
  "version": "1",
  "title": "Traffic Parrot gRPC mapping",
  "description": "One Traffic Parrot gRPC mapping, written like an HTTP mapping, as a JSON file in the grpc-mappings directory (grpc-mappings/*.json). A check against this schema is stricter than loading the mapping: it rejects a misspelt key, which Traffic Parrot would ignore.",
  "$comment": "This file is http-mapping.schema.json with gRPC's conventions at a fixed list of pointers, and everything else must equal it (GrpcMappingSchemaIsTheHttpSchemaWithTheGrpcConventionsTest). It is a copy rather than a $ref because the schemas' $ids are URNs, which no reference can be resolved against.",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string",
      "description": "Reference to this schema for IDE support. Traffic Parrot ignores it.",
      "examples": [
        "http://localhost:8080/schemas/http-mapping.schema.json"
      ]
    },
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Unique identifier for the mapping. Traffic Parrot-written files carry both id and uuid with the same value.",
      "examples": [
        "0b1d4c39-6c2f-4e0e-9a51-8f2a3c5d7e90"
      ]
    },
    "uuid": {
      "type": "string",
      "format": "uuid",
      "description": "Alternative property name for the unique identifier.",
      "examples": [
        "0b1d4c39-6c2f-4e0e-9a51-8f2a3c5d7e90"
      ]
    },
    "name": {
      "type": "string",
      "description": "Human-readable name for the mapping.",
      "examples": [
        "get-open-orders"
      ]
    },
    "persistent": {
      "type": "boolean",
      "description": "Whether this mapping should be persisted to disk.",
      "examples": [
        true
      ]
    },
    "priority": {
      "type": "integer",
      "minimum": 1,
      "description": "Priority of this mapping (default 5, lower number = higher priority).",
      "examples": [
        1
      ]
    },
    "scenarioName": {
      "type": "string",
      "description": "Name of the state-machine scenario this mapping belongs to (not a Traffic Parrot scenario directory).",
      "examples": [
        "order-lifecycle"
      ]
    },
    "requiredScenarioState": {
      "type": "string",
      "description": "Required scenario state for this mapping to match.",
      "examples": [
        "Started"
      ]
    },
    "newScenarioState": {
      "type": "string",
      "description": "New scenario state to set after this mapping is matched.",
      "examples": [
        "order-placed"
      ]
    },
    "insertionIndex": {
      "type": "integer",
      "description": "Internal ordering index. Accepted on input but not normally present in mapping files.",
      "examples": [
        0
      ]
    },
    "postServeActions": {
      "type": [
        "array",
        "object"
      ],
      "description": "After the response: webhook sends an HTTP callback, send-jms-message a JMS message. A list of {name, parameters}, or the older object keyed by name. An HTTP editor save turns each action into a webhook with only method, url, headers, a text, JSON or file body, fixed delay and enabled.",
      "$comment": "items applies only to the list form and additionalProperties only to the object form, so this accepts what a oneOf of the two forms did, while the explorer opens the list form's items.",
      "items": {
        "$ref": "#/definitions/postServeAction"
      },
      "additionalProperties": {
        "type": "object"
      },
      "examples": [
        [
          {
            "name": "webhook",
            "parameters": {
              "method": "POST",
              "url": "http://localhost:9090/orders/{{jsonPath originalRequest.body '$.id'}}/status",
              "headers": {
                "Content-Type": "application/json",
                "X-Hub-Signature-256": "sha256={{hmac webhookBody key='my-webhook-secret'}}"
              },
              "body": "{\"id\": \"{{jsonPath originalRequest.body '$.id'}}\", \"status\": \"shipped\"}",
              "delay": {
                "type": "fixed",
                "milliseconds": 500
              }
            }
          }
        ],
        [
          {
            "name": "webhook",
            "parameters": {
              "method": "POST",
              "url": "http://localhost:9090/notifications",
              "jsonBody": {
                "orderId": "{{jsonPath originalRequest.body '$.id'}}",
                "event": "order.created"
              },
              "enabled": "{{jsonPath originalRequest.body '$.notify'}}"
            }
          }
        ],
        [
          {
            "name": "send-jms-message",
            "parameters": {
              "jmsConnectionId": "3",
              "destination": {
                "name": "orders.events",
                "type": "QUEUE"
              },
              "variables": {
                "id": "{{randomValue length=24 type='ALPHANUMERIC'}}"
              },
              "properties": {
                "eventId": "{{variables.id}}"
              },
              "jsonBody": {
                "id": "{{variables.id}}",
                "orderId": "{{originalRequest.jsonBody.id}}",
                "status": "accepted"
              },
              "delayDistribution": {
                "type": "fixed",
                "milliseconds": 200
              }
            }
          }
        ]
      ]
    },
    "serveEventListeners": {
      "type": "array",
      "description": "The newer WireMock form of postServeActions: listeners called as a request is served. In an HTTP mapping a webhook listener sends the same callback, but the HTTP editor shows only postServeActions and drops this key when it saves the mapping, so write postServeActions.",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "examples": [
              "webhook"
            ],
            "description": "Name of the serve event listener extension to notify, for example webhook."
          },
          "requestPhases": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "BEFORE_MATCH",
                "AFTER_MATCH",
                "BEFORE_RESPONSE_SENT",
                "AFTER_COMPLETE"
              ]
            },
            "examples": [
              [
                "AFTER_COMPLETE"
              ]
            ],
            "description": "Request phases at which the listener is called."
          },
          "parameters": {
            "type": "object",
            "examples": [
              {
                "method": "POST",
                "url": "http://localhost:9090/orders/{{jsonPath originalRequest.body '$.id'}}/status",
                "headers": {
                  "Content-Type": "application/json"
                },
                "body": "{\"id\": \"{{jsonPath originalRequest.body '$.id'}}\", \"status\": \"shipped\"}",
                "delay": {
                  "type": "fixed",
                  "milliseconds": 500
                }
              }
            ],
            "description": "Parameters passed to the listener. Their keys depend on the listener: a webhook listener's are those of postServeActions[].parameters."
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false
      },
      "examples": [
        [
          {
            "name": "webhook",
            "requestPhases": [
              "AFTER_COMPLETE"
            ],
            "parameters": {
              "method": "POST",
              "url": "http://localhost:9090/orders/{{jsonPath originalRequest.body '$.id'}}/status",
              "headers": {
                "Content-Type": "application/json"
              },
              "body": "{\"id\": \"{{jsonPath originalRequest.body '$.id'}}\", \"status\": \"shipped\"}",
              "delay": {
                "type": "fixed",
                "milliseconds": 500
              }
            }
          }
        ]
      ]
    },
    "metadata": {
      "type": "object",
      "description": "Custom metadata associated with this mapping. Any key is accepted here.",
      "additionalProperties": true,
      "examples": [
        {
          "team": "payments",
          "ticket": "PAY-123"
        }
      ]
    },
    "request": {
      "$ref": "#/definitions/request",
      "examples": [
        {
          "urlPath": "com.example.Shipping/CreateShippingDetails",
          "method": "ANY",
          "headers": {
            "Protocol": {
              "equalTo": "GRPC"
            }
          },
          "bodyPatterns": [
            {
              "matchesJsonPath": "$[?(@.last_name == 'Smith')]"
            }
          ]
        }
      ]
    },
    "response": {
      "$ref": "#/definitions/response",
      "examples": [
        {
          "status": 0,
          "jsonBody": {
            "id": "42"
          }
        },
        {
          "status": 13,
          "body": "Last name is required"
        }
      ]
    }
  },
  "required": [
    "request",
    "response"
  ],
  "additionalProperties": false,
  "definitions": {
    "request": {
      "type": "object",
      "description": "Request matching criteria. Use at most one of url / urlPattern / urlPath / urlPathPattern / urlPathTemplate. A misspelt key here is ignored when the mapping loads, which leaves a mapping that matches more requests than intended; a check against this schema rejects it.",
      "properties": {
        "url": {
          "type": "string",
          "description": "Exact URL including query string.",
          "examples": [
            "/orders?status=open"
          ]
        },
        "urlPattern": {
          "type": "string",
          "description": "Regex on the full URL including query string.",
          "examples": [
            "/orders/[0-9]+.*"
          ]
        },
        "urlPath": {
          "type": "string",
          "pattern": "^\\w+(\\.\\w+)+/\\w+$",
          "description": "The gRPC method, as package.Service/Method with no leading slash. Replay matches a call on this path, so a leading slash or any other form never answers. Traffic Parrot writes urlPath, and reads it to name mapping files and to check mappings against the proto files.",
          "examples": [
            "com.example.Shipping/CreateShippingDetails"
          ]
        },
        "urlPathPattern": {
          "type": "string",
          "description": "Regex on the URL path (query string ignored).",
          "examples": [
            "/orders/[0-9]+"
          ]
        },
        "urlPathTemplate": {
          "type": "string",
          "description": "RFC 6570 path template, e.g. /users/{id}. Enables pathParameters matching.",
          "examples": [
            "/orders/{orderId}"
          ]
        },
        "method": {
          "type": "string",
          "enum": [
            "ANY"
          ],
          "description": "ANY, or leave it out. Replay matches every gRPC call as method ANY, so any other method never answers.",
          "examples": [
            "ANY"
          ]
        },
        "scheme": {
          "type": "string",
          "enum": [
            "http",
            "https"
          ],
          "description": "URL scheme to match.",
          "examples": [
            "https"
          ]
        },
        "host": {
          "$ref": "#/definitions/stringValueMatcherNoBodyFile",
          "description": "Matcher on the request host.",
          "examples": [
            {
              "equalTo": "api.example.com"
            }
          ]
        },
        "port": {
          "type": "integer",
          "minimum": 1,
          "maximum": 65535,
          "description": "Port number to match.",
          "examples": [
            8443
          ]
        },
        "clientIp": {
          "$ref": "#/definitions/stringValueMatcherNoBodyFile",
          "description": "Matcher on the client IP address.",
          "examples": [
            {
              "matches": "10\\.0\\..*"
            }
          ]
        },
        "headers": {
          "type": "object",
          "description": "The call's metadata to match: name to matcher (or hasExactly / includes multi-value form). Traffic Parrot also writes the matcher \"Protocol\": {\"equalTo\": \"GRPC\"}: every replayed call carries that header, so it may be left out, and a matcher for any other value never answers.",
          "additionalProperties": {
            "$ref": "#/definitions/multiValuePattern"
          },
          "examples": [
            {
              "Accept": {
                "contains": "json"
              }
            }
          ]
        },
        "queryParameters": {
          "type": "object",
          "description": "Query parameters to match.",
          "additionalProperties": {
            "$ref": "#/definitions/multiValuePattern"
          },
          "examples": [
            {
              "status": {
                "equalTo": "open"
              }
            }
          ]
        },
        "formParameters": {
          "type": "object",
          "description": "Form (application/x-www-form-urlencoded) parameters to match.",
          "additionalProperties": {
            "$ref": "#/definitions/multiValuePattern"
          },
          "examples": [
            {
              "grant_type": {
                "equalTo": "client_credentials"
              }
            }
          ]
        },
        "pathParameters": {
          "type": "object",
          "description": "Path parameters to match. Only meaningful together with urlPathTemplate.",
          "additionalProperties": {
            "$ref": "#/definitions/stringValueMatcherNoBodyFile"
          },
          "examples": [
            {
              "orderId": {
                "matches": "[0-9]+"
              }
            }
          ]
        },
        "cookies": {
          "type": "object",
          "description": "Cookies to match.",
          "additionalProperties": {
            "$ref": "#/definitions/stringValueMatcherNoBodyFile"
          },
          "examples": [
            {
              "session": {
                "matches": ".+"
              }
            }
          ]
        },
        "basicAuth": {
          "$ref": "#/definitions/basicCredentials",
          "description": "Basic authentication credentials to match.",
          "examples": [
            {
              "username": "api-user",
              "password": "secret"
            }
          ]
        },
        "basicAuthCredentials": {
          "$ref": "#/definitions/basicCredentials",
          "description": "Basic authentication credentials to match, under the key Traffic Parrot writes when it saves a mapping: the same as basicAuth. When a mapping gives both, basicAuthCredentials is the one matched.",
          "examples": [
            {
              "username": "api-user",
              "password": "secret"
            }
          ]
        },
        "bodyPatterns": {
          "type": "array",
          "description": "Matching patterns for the request message, which is matched as JSON. All patterns must match.",
          "items": {
            "$ref": "#/definitions/stringValueMatcher"
          },
          "examples": [
            [
              {
                "matchesJsonPath": "$.items[?(@.quantity > 0)]"
              }
            ]
          ]
        },
        "multipartPatterns": {
          "type": "array",
          "description": "Multipart request body matching patterns.",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "examples": [
                  "file"
                ],
                "description": "Name of the part, from its Content-Disposition header."
              },
              "fileName": {
                "type": "string",
                "examples": [
                  "invoice.pdf"
                ],
                "description": "File name of the part, from its Content-Disposition header."
              },
              "matchingType": {
                "type": "string",
                "enum": [
                  "ALL",
                  "ANY"
                ],
                "examples": [
                  "ANY"
                ],
                "description": "ALL: every part must match this pattern. ANY: at least one part must."
              },
              "headers": {
                "type": "object",
                "additionalProperties": {
                  "$ref": "#/definitions/multiValuePattern"
                },
                "examples": [
                  {
                    "Content-Type": {
                      "equalTo": "application/pdf"
                    }
                  }
                ],
                "description": "Matchers the part's headers must satisfy, by header name."
              },
              "bodyPatterns": {
                "type": "array",
                "items": {
                  "$ref": "#/definitions/stringValueMatcherNoBodyFile"
                },
                "examples": [
                  [
                    {
                      "contains": "invoice"
                    }
                  ]
                ],
                "description": "Matchers the part's body must satisfy."
              }
            },
            "additionalProperties": false
          },
          "examples": [
            [
              {
                "name": "file",
                "matchingType": "ANY",
                "bodyPatterns": [
                  {
                    "contains": "invoice"
                  }
                ]
              }
            ]
          ]
        },
        "customMatcher": {
          "type": "object",
          "description": "Custom request matcher, e.g. name \"requestMatchers\" with a parameters.matchesScript Handlebars script, or parameters.matchesValidBearerToken {\"oauth2Mock\": \"<name>\"} to require a valid bearer token from a scaffolded OAuth2 mock. Several keys must all match.",
          "properties": {
            "name": {
              "type": "string",
              "examples": [
                "my-matcher"
              ],
              "description": "Name the custom request matcher extension registers itself under."
            },
            "parameters": {
              "type": "object",
              "examples": [
                {
                  "threshold": 5
                }
              ],
              "description": "Parameters passed to the custom matcher. Their keys depend on the matcher."
            }
          },
          "required": [
            "name"
          ],
          "additionalProperties": false,
          "examples": [
            {
              "name": "my-matcher",
              "parameters": {
                "threshold": 5
              }
            }
          ]
        }
      },
      "additionalProperties": false,
      "allOf": [
        {
          "not": {
            "required": [
              "url",
              "urlPattern"
            ]
          }
        },
        {
          "not": {
            "required": [
              "url",
              "urlPath"
            ]
          }
        },
        {
          "not": {
            "required": [
              "url",
              "urlPathPattern"
            ]
          }
        },
        {
          "not": {
            "required": [
              "url",
              "urlPathTemplate"
            ]
          }
        },
        {
          "not": {
            "required": [
              "urlPattern",
              "urlPath"
            ]
          }
        },
        {
          "not": {
            "required": [
              "urlPattern",
              "urlPathPattern"
            ]
          }
        },
        {
          "not": {
            "required": [
              "urlPattern",
              "urlPathTemplate"
            ]
          }
        },
        {
          "not": {
            "required": [
              "urlPath",
              "urlPathPattern"
            ]
          }
        },
        {
          "not": {
            "required": [
              "urlPath",
              "urlPathTemplate"
            ]
          }
        },
        {
          "not": {
            "required": [
              "urlPathPattern",
              "urlPathTemplate"
            ]
          }
        }
      ]
    },
    "response": {
      "type": "object",
      "description": "Response definition. Use at most one of body / jsonBody / base64Body / bodyFileName.",
      "properties": {
        "status": {
          "type": "integer",
          "enum": [
            0,
            1,
            2,
            3,
            4,
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            200
          ],
          "description": "The gRPC status code: 0 OK, or one of these, and the call fails with the response body as its description:\n- 1 CANCELLED\n- 2 UNKNOWN\n- 3 INVALID_ARGUMENT\n- 4 DEADLINE_EXCEEDED\n- 5 NOT_FOUND\n- 6 ALREADY_EXISTS\n- 7 PERMISSION_DENIED\n- 8 RESOURCE_EXHAUSTED\n- 9 FAILED_PRECONDITION\n- 10 ABORTED\n- 11 OUT_OF_RANGE\n- 12 UNIMPLEMENTED\n- 13 INTERNAL\n- 14 UNAVAILABLE\n- 15 DATA_LOSS\n- 16 UNAUTHENTICATED\n\n200, the default, is the deprecated form of OK; any other number would reach the client as UNKNOWN.",
          "examples": [
            0,
            13
          ]
        },
        "statusMessage": {
          "type": "string",
          "description": "HTTP status message.",
          "examples": [
            "OK"
          ]
        },
        "body": {
          "type": "string",
          "description": "The response message as JSON text, or the error description when status is an error code (anything but 0 or 200). May contain Handlebars templates when the response transformer is enabled.",
          "examples": [
            "{\"orderId\": 42, \"status\": \"open\"}"
          ]
        },
        "jsonBody": {
          "description": "The response message as inline JSON, or the error description when status is an error code (anything but 0 or 200).",
          "examples": [
            {
              "orderId": 42,
              "status": "open"
            }
          ]
        },
        "base64Body": {
          "type": "string",
          "description": "Response body as a Base64-encoded string (for binary content).",
          "examples": [
            "SGVsbG8gd29ybGQ="
          ]
        },
        "bodyFileName": {
          "type": "string",
          "description": "Path to the file containing the response body, relative to the __files directory.",
          "examples": [
            "orders/open-orders.json"
          ]
        },
        "headers": {
          "$ref": "#/definitions/responseHeaders",
          "description": "Response headers: name to string value or array of string values.",
          "examples": [
            {
              "Content-Type": "application/json"
            }
          ]
        },
        "additionalProxyRequestHeaders": {
          "$ref": "#/definitions/responseHeaders",
          "description": "Extra headers added to the request when proxying.",
          "examples": [
            {
              "X-Forwarded-By": "traffic-parrot"
            }
          ]
        },
        "removeProxyRequestHeaders": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Header names removed from the request when proxying.",
          "examples": [
            [
              "Authorization"
            ]
          ]
        },
        "fixedDelayMilliseconds": {
          "type": "integer",
          "minimum": 0,
          "description": "Fixed delay in milliseconds before returning the response.",
          "examples": [
            250
          ]
        },
        "delayDistribution": {
          "$ref": "#/definitions/delayDistribution",
          "examples": [
            {
              "type": "lognormal",
              "median": 80,
              "sigma": 0.4
            }
          ]
        },
        "chunkedDribbleDelay": {
          "type": "object",
          "description": "Dribble the response body to the client in chunks over totalDuration milliseconds.",
          "properties": {
            "numberOfChunks": {
              "type": "integer",
              "minimum": 1,
              "examples": [
                5
              ],
              "description": "Number of chunks the response body is split into."
            },
            "totalDuration": {
              "type": "integer",
              "minimum": 1,
              "examples": [
                1000
              ],
              "description": "Time in milliseconds over which the chunks are sent."
            }
          },
          "required": [
            "numberOfChunks",
            "totalDuration"
          ],
          "additionalProperties": false,
          "examples": [
            {
              "numberOfChunks": 5,
              "totalDuration": 1000
            }
          ]
        },
        "fault": {
          "type": "string",
          "enum": [
            "CONNECTION_RESET_BY_PEER",
            "EMPTY_RESPONSE",
            "MALFORMED_RESPONSE_CHUNK",
            "RANDOM_DATA_THEN_CLOSE",
            "DRIP_BYTE_EVERY_100ms",
            "DRIP_BYTE_EVERY_1s",
            "DRIP_BYTE_EVERY_10s",
            "INCORRECT_SMALL_CONTENT_LENGTH",
            "CLOSE_CONNECTION_AFTER_HALF_RESPONSE"
          ],
          "description": "Fault to inject instead of a well-formed response. Values are case-sensitive, including the lowercase ms/s suffixes.",
          "examples": [
            "CONNECTION_RESET_BY_PEER"
          ]
        },
        "proxyBaseUrl": {
          "type": "string",
          "description": "Base URL to proxy matched requests to instead of serving a stubbed response.",
          "examples": [
            "https://api.example.com"
          ]
        },
        "proxyUrlPrefixToRemove": {
          "type": "string",
          "description": "URL prefix removed from the request path before proxying.",
          "examples": [
            "/proxy"
          ]
        },
        "transformers": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Response transformer extension names to apply.",
          "examples": [
            [
              "response-template"
            ]
          ]
        },
        "transformerParameters": {
          "type": "object",
          "description": "Parameters passed to the response transformers. Any key is accepted here.",
          "additionalProperties": true,
          "examples": [
            {
              "discount": 10
            }
          ]
        },
        "fromConfiguredStub": {
          "type": "boolean",
          "description": "Whether this response came from a configured stub. Traffic Parrot writes this flag; it is not needed when writing a mapping.",
          "examples": [
            true
          ]
        }
      },
      "additionalProperties": false,
      "allOf": [
        {
          "not": {
            "required": [
              "body",
              "jsonBody"
            ]
          }
        },
        {
          "not": {
            "required": [
              "body",
              "base64Body"
            ]
          }
        },
        {
          "not": {
            "required": [
              "body",
              "bodyFileName"
            ]
          }
        },
        {
          "not": {
            "required": [
              "jsonBody",
              "base64Body"
            ]
          }
        },
        {
          "not": {
            "required": [
              "jsonBody",
              "bodyFileName"
            ]
          }
        },
        {
          "not": {
            "required": [
              "base64Body",
              "bodyFileName"
            ]
          }
        }
      ]
    },
    "postServeAction": {
      "type": "object",
      "description": "One action Traffic Parrot runs after it sends the response.",
      "properties": {
        "name": {
          "type": "string",
          "description": "Which action: webhook sends an HTTP request (a callback), send-jms-message a JMS message; each reads the parameters whose description names it. An extension can add its own.",
          "examples": [
            "webhook",
            "send-jms-message"
          ]
        },
        "parameters": {
          "type": "object",
          "description": "The action's settings. Listed here are a webhook's and send-jms-message's, each saying which; an extension's action reads its own. A webhook's templates read any other key as parameters.<name>. A check accepts any parameters, so a wrong one shows up only when the action runs.",
          "$comment": "The last branch accepts any object, so the typed branches document the parameters and narrow nothing: a mapping whose parameters have the wrong types loads, and fails or is ignored only when the action runs, so a check never rejects parameters it accepted before they were typed.",
          "anyOf": [
            {
              "$ref": "#/definitions/webhookParameters"
            },
            {
              "$ref": "#/definitions/sendJmsMessageParameters"
            },
            {
              "type": "object"
            }
          ],
          "examples": [
            {
              "method": "POST",
              "url": "http://localhost:9090/orders/{{jsonPath originalRequest.body '$.id'}}/status",
              "headers": {
                "Content-Type": "application/json"
              },
              "body": "{\"id\": \"{{jsonPath originalRequest.body '$.id'}}\", \"status\": \"shipped\"}"
            }
          ]
        }
      },
      "required": [
        "name"
      ],
      "additionalProperties": false
    },
    "webhookParameters": {
      "type": "object",
      "description": "A webhook's parameters: the HTTP request Traffic Parrot sends after the response.",
      "properties": {
        "method": {
          "type": "string",
          "description": "A webhook's HTTP method as a string, GET when left out; a value that is not a string is ignored and sends GET. A Handlebars template.",
          "examples": [
            "POST"
          ]
        },
        "url": {
          "type": "string",
          "description": "The address a webhook sends its callback to. A Handlebars template, so it can carry values from the request (originalRequest) and the response (originalResponse).",
          "examples": [
            "http://localhost:9090/orders/{{jsonPath originalRequest.body '$.id'}}/status"
          ]
        },
        "headers": {
          "$ref": "#/definitions/responseHeaders",
          "description": "A webhook's headers, an object of name to a value or a list of values, each a Handlebars template; anything else stops the callback. To sign it, compute the signature over webhookBody, the rendered body: {{hmac webhookBody key='secret'}}.",
          "examples": [
            {
              "Content-Type": "application/json",
              "X-Hub-Signature-256": "sha256={{hmac webhookBody key='my-webhook-secret'}}"
            }
          ]
        },
        "body": {
          "type": "string",
          "description": "A webhook's body as text, a Handlebars template. Of body, jsonBody, base64Body and bodyFileName, a webhook sends the first that is set.",
          "examples": [
            "{\"id\": \"{{jsonPath originalRequest.body '$.id'}}\", \"status\": \"shipped\"}"
          ]
        },
        "jsonBody": {
          "description": "The body as JSON rather than text: a webhook's callback body, or the message body of send-jms-message, where it is an object. Handlebars templates in its strings are rendered; in send-jms-message a value written \">>{{...}}<<\" is sent as a number or boolean.",
          "examples": [
            {
              "orderId": "{{jsonPath originalRequest.body '$.id'}}",
              "event": "order.created"
            }
          ]
        },
        "base64Body": {
          "type": "string",
          "description": "A webhook's binary body, Base64-encoded: the callback carries the bytes it decodes to, untemplated.",
          "examples": [
            "eyJzdGF0dXMiOiAic2hpcHBlZCJ9"
          ]
        },
        "bodyFileName": {
          "type": "string",
          "description": "A webhook's body from a file under __files, used when it has no body, jsonBody or base64Body. The name and the file's content are Handlebars templates; disableBodyFileTemplating sends the content as it is.",
          "examples": [
            "callbacks/order-shipped.json"
          ]
        },
        "disableBodyFileTemplating": {
          "type": "boolean",
          "description": "true sends a webhook's bodyFileName content as it is, untemplated, as a binary file needs.",
          "examples": [
            true
          ]
        },
        "delay": {
          "$ref": "#/definitions/delayDistribution",
          "description": "How long after the response a webhook waits before it sends the callback: an object such as {\"type\": \"fixed\", \"milliseconds\": 500}. A bare number stops the callback.",
          "examples": [
            {
              "type": "fixed",
              "milliseconds": 500
            }
          ]
        },
        "enabled": {
          "type": "string",
          "description": "A Handlebars condition as a string: a webhook sends its callback only when this renders true, so the request decides. A JSON true, not a string, stops the callback. Leave it out to always send.",
          "examples": [
            "{{jsonPath originalRequest.body '$.notify'}}"
          ]
        }
      },
      "required": [
        "url"
      ],
      "additionalProperties": true
    },
    "sendJmsMessageParameters": {
      "type": "object",
      "description": "send-jms-message's parameters: the JMS message Traffic Parrot sends after the response.",
      "properties": {
        "jmsConnectionId": {
          "type": "string",
          "description": "send-jms-message: the id of the JMS connection in jms-connections.json the message is sent through.",
          "examples": [
            "3"
          ]
        },
        "destination": {
          "type": "object",
          "description": "send-jms-message: the queue or topic the message is sent to.",
          "properties": {
            "name": {
              "type": "string",
              "description": "The queue or topic name.",
              "examples": [
                "orders.events"
              ]
            },
            "type": {
              "type": "string",
              "enum": [
                "QUEUE",
                "TOPIC"
              ],
              "description": "Whether name is a QUEUE or a TOPIC.",
              "examples": [
                "QUEUE"
              ]
            },
            "skipDeclare": {
              "type": "boolean",
              "description": "For an AMQP broker such as RabbitMQ, true sends to a destination that already exists without declaring it.",
              "examples": [
                true
              ]
            },
            "declareArguments": {
              "type": "object",
              "description": "For an AMQP broker, the arguments the destination is declared with.",
              "examples": [
                {
                  "x-message-ttl": 60000
                }
              ]
            }
          },
          "required": [
            "name",
            "type"
          ],
          "examples": [
            {
              "name": "orders.events",
              "type": "QUEUE"
            }
          ]
        },
        "variables": {
          "type": "object",
          "description": "send-jms-message: values worked out once per message, each a Handlebars template, that properties and jsonBody read as variables.<name>, so both can carry one generated id.",
          "examples": [
            {
              "id": "{{randomValue length=24 type='ALPHANUMERIC'}}"
            }
          ]
        },
        "properties": {
          "type": "object",
          "description": "send-jms-message: the JMS message properties, name to value, each a Handlebars template. A value written \">>{{...}}<<\" is sent as a number or boolean rather than a string.",
          "examples": [
            {
              "eventId": "{{variables.id}}",
              "sentAt": ">>{{now format='unix'}}<<"
            }
          ]
        },
        "jsonBody": {
          "type": "object",
          "description": "The body as JSON rather than text: a webhook's callback body, or the message body of send-jms-message, where it is an object. Handlebars templates in its strings are rendered; in send-jms-message a value written \">>{{...}}<<\" is sent as a number or boolean.",
          "examples": [
            {
              "id": "{{variables.id}}",
              "orderId": "{{originalRequest.jsonBody.id}}",
              "status": "accepted"
            }
          ]
        },
        "bodyType": {
          "type": "string",
          "description": "send-jms-message: how the body is sent. TEXT, the default, sends a text message; proto/<message type> sends the JSON body encoded as that Protocol Buffers message, and protoBase64Bytes/<message type> its Base64.",
          "examples": [
            "TEXT",
            "proto/com.example.OrderEvent"
          ]
        },
        "delayDistribution": {
          "$ref": "#/definitions/delayDistribution",
          "description": "send-jms-message: how long after the response it waits before it sends the message.",
          "examples": [
            {
              "type": "fixed",
              "milliseconds": 200
            }
          ]
        }
      },
      "required": [
        "jmsConnectionId",
        "destination"
      ],
      "additionalProperties": true
    },
    "responseHeaders": {
      "type": "object",
      "additionalProperties": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        ]
      }
    },
    "delayDistribution": {
      "description": "Random delay distribution, discriminated by type.",
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "type": {
              "const": "lognormal",
              "examples": [
                "lognormal"
              ],
              "description": "lognormal: a random delay drawn from a log-normal distribution."
            },
            "median": {
              "type": "number",
              "minimum": 0,
              "examples": [
                80
              ],
              "description": "Median delay in milliseconds."
            },
            "sigma": {
              "type": "number",
              "minimum": 0,
              "examples": [
                0.4
              ],
              "description": "Standard deviation of the underlying normal distribution. A larger value gives a longer tail of slow responses."
            },
            "maxValue": {
              "type": "number",
              "minimum": 0,
              "examples": [
                2000
              ],
              "description": "Longest delay in milliseconds. A longer sampled delay is cut to this."
            }
          },
          "required": [
            "type",
            "median",
            "sigma"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "const": "uniform",
              "examples": [
                "uniform"
              ],
              "description": "uniform: a random delay between lower and upper."
            },
            "lower": {
              "type": "integer",
              "minimum": 0,
              "examples": [
                50
              ],
              "description": "Shortest delay in milliseconds."
            },
            "upper": {
              "type": "integer",
              "minimum": 0,
              "examples": [
                150
              ],
              "description": "Longest delay in milliseconds."
            }
          },
          "required": [
            "type",
            "lower",
            "upper"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "const": "fixed",
              "examples": [
                "fixed"
              ],
              "description": "fixed: the same delay every time."
            },
            "milliseconds": {
              "type": "integer",
              "minimum": 0,
              "examples": [
                250
              ],
              "description": "Delay in milliseconds."
            }
          },
          "required": [
            "type",
            "milliseconds"
          ],
          "additionalProperties": false
        }
      ]
    },
    "basicCredentials": {
      "type": "object",
      "description": "The user name and password a request's Basic Authorization header must carry.",
      "properties": {
        "username": {
          "type": "string",
          "examples": [
            "api-user"
          ],
          "description": "User name the request's Basic Authorization header must carry."
        },
        "password": {
          "type": "string",
          "examples": [
            "secret"
          ],
          "description": "Password the request's Basic Authorization header must carry."
        }
      },
      "required": [
        "username",
        "password"
      ],
      "additionalProperties": false
    },
    "bodyFileRef": {
      "type": "object",
      "description": "Externalised matcher value: the expected value lives in a file under the __files directory.\n\nAccepted ONLY on a top-level request.bodyPatterns entry. In any other position Traffic Parrot rejects a bodyFileName reference with HTTP 422 at stub registration:\n- nested inside and/or/not;\n- on a host, clientIp, header, query, form, path, cookie or multipart matcher.",
      "properties": {
        "bodyFileName": {
          "type": "string",
          "examples": [
            "requests/expected-order.json"
          ],
          "description": "Name of a file under __files whose content is the matcher's value, in place of an inline value."
        }
      },
      "required": [
        "bodyFileName"
      ],
      "additionalProperties": false,
      "examples": [
        {
          "bodyFileName": "requests/expected-order.json"
        }
      ]
    },
    "noExternalisedMatcherValue": {
      "description": "Guard: forbids the externalised {\"bodyFileName\": \"<file>\"} form. Applied at every matcher position EXCEPT a top-level request.bodyPatterns entry, because those are the positions Traffic Parrot rejects with HTTP 422 at stub registration.",
      "$comment": "Guard: forbids the externalised {\"bodyFileName\": \"<file>\"} form. Applied at every matcher position EXCEPT a top-level request.bodyPatterns entry, because those are the positions the engine rejects with HTTP 422 at stub registration. This is the structural half of the restriction that bodyFileRef.description states in prose - prose alone cannot stop a generator or a validator.",
      "not": {
        "anyOf": [
          {
            "properties": {
              "equalTo": {
                "$ref": "#/definitions/bodyFileRef"
              }
            },
            "required": [
              "equalTo"
            ]
          },
          {
            "properties": {
              "equalToJson": {
                "$ref": "#/definitions/bodyFileRef"
              }
            },
            "required": [
              "equalToJson"
            ]
          },
          {
            "properties": {
              "equalToXml": {
                "$ref": "#/definitions/bodyFileRef"
              }
            },
            "required": [
              "equalToXml"
            ]
          },
          {
            "properties": {
              "matchesJsonSchema": {
                "$ref": "#/definitions/bodyFileRef"
              }
            },
            "required": [
              "matchesJsonSchema"
            ]
          },
          {
            "properties": {
              "matchesJsonPath": {
                "$ref": "#/definitions/bodyFileRef"
              }
            },
            "required": [
              "matchesJsonPath"
            ]
          },
          {
            "properties": {
              "matchesXPath": {
                "$ref": "#/definitions/bodyFileRef"
              }
            },
            "required": [
              "matchesXPath"
            ]
          },
          {
            "properties": {
              "contains": {
                "$ref": "#/definitions/bodyFileRef"
              }
            },
            "required": [
              "contains"
            ]
          },
          {
            "properties": {
              "doesNotContain": {
                "$ref": "#/definitions/bodyFileRef"
              }
            },
            "required": [
              "doesNotContain"
            ]
          },
          {
            "properties": {
              "matches": {
                "$ref": "#/definitions/bodyFileRef"
              }
            },
            "required": [
              "matches"
            ]
          },
          {
            "properties": {
              "doesNotMatch": {
                "$ref": "#/definitions/bodyFileRef"
              }
            },
            "required": [
              "doesNotMatch"
            ]
          },
          {
            "properties": {
              "binaryEqualTo": {
                "$ref": "#/definitions/bodyFileRef"
              }
            },
            "required": [
              "binaryEqualTo"
            ]
          },
          {
            "properties": {
              "matchesXml": {
                "$ref": "#/definitions/bodyFileRef"
              }
            },
            "required": [
              "matchesXml"
            ]
          },
          {
            "properties": {
              "matchesJson": {
                "$ref": "#/definitions/bodyFileRef"
              }
            },
            "required": [
              "matchesJson"
            ]
          },
          {
            "properties": {
              "matchesGraphQL": {
                "$ref": "#/definitions/bodyFileRef"
              }
            },
            "required": [
              "matchesGraphQL"
            ]
          },
          {
            "properties": {
              "matchesSwiftField": {
                "$ref": "#/definitions/bodyFileRef"
              }
            },
            "required": [
              "matchesSwiftField"
            ]
          },
          {
            "properties": {
              "matchesFixField": {
                "$ref": "#/definitions/bodyFileRef"
              }
            },
            "required": [
              "matchesFixField"
            ]
          },
          {
            "properties": {
              "matchesCicsField": {
                "$ref": "#/definitions/bodyFileRef"
              }
            },
            "required": [
              "matchesCicsField"
            ]
          }
        ]
      }
    },
    "stringValueMatcherNoBodyFile": {
      "description": "A single value matcher in a position where Traffic Parrot will NOT resolve an externalised value. Identical to stringValueMatcher except that the {\"bodyFileName\": \"<file>\"} form is refused.\n\nUsed where Traffic Parrot rejects a bodyFileName reference:\n- host, clientIp, header, query, form, path, cookie and multipart matchers;\n- any matcher nested inside and/or/not.",
      "allOf": [
        {
          "$ref": "#/definitions/stringValueMatcher"
        },
        {
          "$ref": "#/definitions/noExternalisedMatcherValue"
        }
      ]
    },
    "multiValuePattern": {
      "description": "Matcher for a multi-valued element (header, query or form parameter): a plain matcher on the single value, or hasExactly / includes over all values.",
      "oneOf": [
        {
          "$ref": "#/definitions/stringValueMatcherNoBodyFile"
        },
        {
          "type": "object",
          "properties": {
            "hasExactly": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/stringValueMatcherNoBodyFile"
              },
              "examples": [
                [
                  {
                    "equalTo": "red"
                  },
                  {
                    "equalTo": "blue"
                  }
                ]
              ],
              "description": "The header or parameter has exactly these values, one matching each matcher, in any order."
            }
          },
          "required": [
            "hasExactly"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "includes": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/stringValueMatcherNoBodyFile"
              },
              "examples": [
                [
                  {
                    "equalTo": "red"
                  }
                ]
              ],
              "description": "The header or parameter has, among its values, one matching each matcher."
            }
          },
          "required": [
            "includes"
          ],
          "additionalProperties": false
        }
      ]
    },
    "stringValueMatcher": {
      "type": "object",
      "description": "A single value matcher: exactly one primary matcher key plus that matcher's option keys.\n\nThe expected value may be externalised as {\"bodyFileName\": \"<file>\"} for these matchers:\n- equalTo, equalToJson, equalToXml, matchesJsonSchema, matchesJsonPath and matchesXPath;\n- contains, doesNotContain, matches, doesNotMatch and binaryEqualTo;\n- the six Traffic Parrot matchers: matchesXml, matchesJson, matchesGraphQL, matchesSwiftField, matchesFixField and matchesCicsField.\n\nThe bodyFileName form is accepted ONLY when the matcher is a top-level request.bodyPatterns entry. In every other position Traffic Parrot rejects the stub with HTTP 422 at registration:\n- nested inside and/or/not;\n- on a host, clientIp, header, query, form, path, cookie or multipart matcher.",
      "properties": {
        "equalTo": {
          "description": "Exact string equality.",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "#/definitions/bodyFileRef"
            }
          ],
          "examples": [
            "application/json"
          ]
        },
        "caseInsensitive": {
          "type": "boolean",
          "description": "Option for equalTo.",
          "examples": [
            true
          ]
        },
        "equalToJson": {
          "description": "Semantic JSON equality. Inline JSON value, a string containing JSON, or a bodyFileName reference object.",
          "type": [
            "string",
            "object",
            "array"
          ],
          "examples": [
            {
              "orderId": 42
            }
          ]
        },
        "ignoreArrayOrder": {
          "type": "boolean",
          "description": "Option for equalToJson / matchesJson.",
          "examples": [
            true
          ]
        },
        "ignoreExtraElements": {
          "type": "boolean",
          "description": "Option for equalToJson / matchesJson.",
          "examples": [
            true
          ]
        },
        "treatNullAsAbsent": {
          "type": "boolean",
          "description": "Option for equalToJson.",
          "examples": [
            true
          ]
        },
        "matchesJsonSchema": {
          "description": "Value must validate against the given JSON Schema (inline object, string, or bodyFileName reference object).",
          "type": [
            "string",
            "object"
          ],
          "examples": [
            {
              "type": "object",
              "required": [
                "orderId"
              ]
            }
          ]
        },
        "schemaVersion": {
          "type": "string",
          "enum": [
            "V4",
            "V6",
            "V7",
            "V201909",
            "V202012"
          ],
          "description": "Option for matchesJsonSchema (default V202012).",
          "examples": [
            "V202012"
          ]
        },
        "equalToXml": {
          "description": "Semantic XML equality.",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "#/definitions/bodyFileRef"
            }
          ],
          "examples": [
            "<order><id>42</id></order>"
          ]
        },
        "enablePlaceholders": {
          "type": "boolean",
          "description": "Option for equalToXml.",
          "examples": [
            true
          ]
        },
        "placeholderOpeningDelimiterRegex": {
          "type": "string",
          "description": "Option for equalToXml.",
          "examples": [
            "\\[\\["
          ]
        },
        "placeholderClosingDelimiterRegex": {
          "type": "string",
          "description": "Option for equalToXml.",
          "examples": [
            "\\]\\]"
          ]
        },
        "exemptedComparisons": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Option for equalToXml: XMLUnit ComparisonType names to exempt, in upper case as listed. Checked only beside equalToXml, the matcher that reads it.",
          "examples": [
            [
              "NAMESPACE_URI",
              "SCHEMA_LOCATION"
            ]
          ]
        },
        "ignoreOrderOfSameNode": {
          "type": "boolean",
          "description": "Option for equalToXml.",
          "examples": [
            true
          ]
        },
        "namespaceAwareness": {
          "type": "string",
          "enum": [
            "STRICT",
            "LEGACY",
            "NONE"
          ],
          "description": "Option for equalToXml.",
          "examples": [
            "NONE"
          ]
        },
        "matchesJsonPath": {
          "description": "JSONPath expression match: a string expression, an advanced {\"expression\": ..., <sub-matcher>} object, or a bodyFileName reference object.",
          "type": [
            "string",
            "object"
          ],
          "examples": [
            "$.orderId",
            {
              "expression": "$.status",
              "equalTo": "accepted"
            }
          ]
        },
        "matchesXPath": {
          "description": "XPath expression match: a string expression, an advanced {\"expression\": ..., <sub-matcher>} object, or a bodyFileName reference object.",
          "type": [
            "string",
            "object"
          ],
          "examples": [
            "/order/id",
            {
              "expression": "/order/status/text()",
              "equalTo": "accepted"
            }
          ]
        },
        "xPathNamespaces": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Option for matchesXPath: prefix to namespace URI.",
          "examples": [
            {
              "ord": "http://example.com/orders"
            }
          ]
        },
        "contains": {
          "description": "Substring match.",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "#/definitions/bodyFileRef"
            }
          ],
          "examples": [
            "orderId"
          ]
        },
        "doesNotContain": {
          "description": "Negative substring match.",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "#/definitions/bodyFileRef"
            }
          ],
          "examples": [
            "error"
          ]
        },
        "matches": {
          "description": "Regex match.",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "#/definitions/bodyFileRef"
            }
          ],
          "examples": [
            "ORD-[0-9]+"
          ]
        },
        "doesNotMatch": {
          "description": "Negative regex match.",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "#/definitions/bodyFileRef"
            }
          ],
          "examples": [
            ".*test.*"
          ]
        },
        "before": {
          "type": "string",
          "description": "Date-time before the given ISO-8601 instant or now-offset expression.",
          "examples": [
            "now +1 days"
          ]
        },
        "after": {
          "type": "string",
          "description": "Date-time after the given ISO-8601 instant or now-offset expression.",
          "examples": [
            "2026-01-01T00:00:00Z"
          ]
        },
        "equalToDateTime": {
          "type": "string",
          "description": "Date-time equality with the given ISO-8601 instant or now-offset expression.",
          "examples": [
            "now"
          ]
        },
        "actualFormat": {
          "type": "string",
          "description": "Option for before / after / equalToDateTime: format of the actual value.",
          "examples": [
            "dd/MM/yyyy"
          ]
        },
        "truncateExpected": {
          "type": "string",
          "description": "Option for before / after / equalToDateTime: truncate the expected date-time to this point before comparing. One of the examples, in any case, with a space or an underscore between words. Checked only beside before, after or equalToDateTime, the matchers that read it.",
          "examples": [
            "first second of minute",
            "first minute of hour",
            "first hour of day",
            "first day of month",
            "first day of next month",
            "last day of month",
            "first day of year",
            "first day of next year",
            "last day of year"
          ]
        },
        "truncateActual": {
          "type": "string",
          "description": "Option for before / after / equalToDateTime: truncate the actual date-time to this point before comparing. One of the examples, in any case, with a space or an underscore between words. Checked only beside before, after or equalToDateTime, the matchers that read it.",
          "examples": [
            "first second of minute",
            "first minute of hour",
            "first hour of day",
            "first day of month",
            "first day of next month",
            "last day of month",
            "first day of year",
            "first day of next year",
            "last day of year"
          ]
        },
        "applyTruncationLast": {
          "type": "boolean",
          "description": "Option for before / after / equalToDateTime.",
          "examples": [
            true
          ]
        },
        "expectedOffset": {
          "type": "integer",
          "description": "Option for before / after / equalToDateTime.",
          "examples": [
            1
          ]
        },
        "expectedOffsetUnit": {
          "type": "string",
          "description": "Option for before / after / equalToDateTime: the unit of expectedOffset. One of the examples, in any case.",
          "examples": [
            "SECONDS",
            "MINUTES",
            "HOURS",
            "DAYS",
            "MONTHS",
            "YEARS"
          ],
          "pattern": "^(?:[Ss][Ee][Cc][Oo][Nn][Dd][Ss]|[Mm][Ii][Nn][Uu][Tt][Ee][Ss]|[Hh][Oo][Uu][Rr][Ss]|[Dd][Aa][Yy][Ss]|[Mm][Oo][Nn][Tt][Hh][Ss]|[Yy][Ee][Aa][Rr][Ss])$"
        },
        "anything": {
          "type": "string",
          "description": "Matches any value. The operand string is ignored.",
          "examples": [
            "anything"
          ]
        },
        "absent": {
          "description": "The element must be absent. Canonically written as true; the operand value is ignored.",
          "examples": [
            true
          ]
        },
        "and": {
          "type": "array",
          "minItems": 2,
          "items": {
            "$ref": "#/definitions/stringValueMatcherNoBodyFile"
          },
          "description": "All nested matchers must match.",
          "examples": [
            [
              {
                "contains": "order"
              },
              {
                "doesNotContain": "test"
              }
            ]
          ]
        },
        "or": {
          "type": "array",
          "minItems": 2,
          "items": {
            "$ref": "#/definitions/stringValueMatcherNoBodyFile"
          },
          "description": "At least one nested matcher must match.",
          "examples": [
            [
              {
                "equalTo": "GB"
              },
              {
                "equalTo": "IE"
              }
            ]
          ]
        },
        "not": {
          "$ref": "#/definitions/stringValueMatcherNoBodyFile",
          "description": "The nested matcher must not match.",
          "examples": [
            {
              "contains": "test"
            }
          ]
        },
        "matchesPathTemplate": {
          "type": "string",
          "description": "RFC 6570 path template match (string-value sub-matcher form; the request URL role serialises as urlPathTemplate instead).",
          "examples": [
            "/orders/{orderId}"
          ]
        },
        "binaryEqualTo": {
          "description": "Byte-for-byte equality with the Base64-decoded operand. Valid only as a direct entry of request.bodyPatterns or of a multipart part's bodyPatterns, not inside an \"and\", \"or\" or \"not\" matcher, although this schema accepts it wherever a matcher is.",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "#/definitions/bodyFileRef"
            }
          ],
          "examples": [
            "SGVsbG8="
          ]
        },
        "matchesXml": {
          "description": "Traffic Parrot: XML match where element/attribute values may be regular expressions.",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "#/definitions/bodyFileRef"
            }
          ],
          "examples": [
            "<order><id>42</id></order>"
          ]
        },
        "matchesJson": {
          "description": "Traffic Parrot: JSON match where values may be regular expressions. Inline JSON value, a string containing JSON, or a bodyFileName reference object.",
          "type": [
            "string",
            "object",
            "array"
          ],
          "examples": [
            {
              "orderId": 42
            }
          ]
        },
        "matchesGraphQL": {
          "description": "Traffic Parrot: GraphQL query match. A query string, an {\"operationName\": ..., \"variables\": ...} object, or a bodyFileName reference object.",
          "type": [
            "string",
            "object"
          ],
          "examples": [
            "{ order(id: 42) { status } }",
            {
              "operationName": "GetOrder",
              "variables": {
                "id": 42
              }
            }
          ]
        },
        "matchesSwiftField": {
          "description": "Traffic Parrot: match one field of a SWIFT MT message.",
          "type": "object",
          "properties": {
            "field": {
              "type": "string",
              "examples": [
                "20"
              ],
              "description": "SWIFT MT field tag to read, for example 20 (transaction reference)."
            },
            "matches": {
              "type": "string",
              "examples": [
                "REF[0-9]+"
              ],
              "description": "Regular expression the field's value must match."
            },
            "bodyFileName": {
              "type": "string",
              "examples": [
                "requests/mt103-match.json"
              ],
              "description": "Name of a file under __files that holds this matcher's value, in place of an inline one. Use it alone."
            }
          },
          "oneOf": [
            {
              "required": [
                "field",
                "matches"
              ],
              "not": {
                "required": [
                  "bodyFileName"
                ]
              }
            },
            {
              "required": [
                "bodyFileName"
              ],
              "maxProperties": 1
            }
          ],
          "additionalProperties": false,
          "examples": [
            {
              "field": "20",
              "matches": "REF[0-9]+"
            }
          ]
        },
        "matchesFixField": {
          "description": "Traffic Parrot: match one field of a FIX message.",
          "type": "object",
          "properties": {
            "field": {
              "type": "string",
              "examples": [
                "35"
              ],
              "description": "FIX tag number to read, for example 35 (MsgType)."
            },
            "matches": {
              "type": "string",
              "examples": [
                "D"
              ],
              "description": "Regular expression the tag's value must match."
            },
            "bodyFileName": {
              "type": "string",
              "examples": [
                "requests/fix-order-match.json"
              ],
              "description": "Name of a file under __files that holds this matcher's value, in place of an inline one. Use it alone."
            }
          },
          "oneOf": [
            {
              "required": [
                "field",
                "matches"
              ],
              "not": {
                "required": [
                  "bodyFileName"
                ]
              }
            },
            {
              "required": [
                "bodyFileName"
              ],
              "maxProperties": 1
            }
          ],
          "additionalProperties": false,
          "examples": [
            {
              "field": "35",
              "matches": "D"
            }
          ]
        },
        "matchesCicsField": {
          "description": "Traffic Parrot: match one field of a CICS bridge request (IBM MQ, MQFMT_CICS) by its path in the request's JSON view (MQCIH.TransactionId, ProgramName, COMMAREA.ACCOUNT-NO, COMMAREA.TXN-ENTRY[0].TXN-AMOUNT with 0-based indices), with exactly one of equalTo, matches (a whole-value regular expression), greaterThan, greaterThanOrEqualTo, lessThan or lessThanOrEqualTo. Numbers compare as numbers.",
          "type": "object",
          "properties": {
            "field": {
              "type": "string",
              "examples": [
                "COMMAREA.ACCOUNT-NO"
              ],
              "description": "Path from the root of the request view, names exactly as written: ProgramName, COMMAREA.<copybook field>, MQCIH.<header field> or MQMD.UserIdentifier. A [n] after a name is a 0-based table index, as in COMMAREA.TXN-ENTRY[1].TXN-AMOUNT."
            },
            "equalTo": {
              "type": [
                "string",
                "number"
              ],
              "examples": [
                "1234567890"
              ],
              "description": "The field's value equals this."
            },
            "matches": {
              "type": "string",
              "examples": [
                "[0-9]{10}"
              ],
              "description": "Regular expression the field's value must match."
            },
            "greaterThan": {
              "type": [
                "string",
                "number"
              ],
              "examples": [
                100
              ],
              "description": "The field's numeric value is greater than this."
            },
            "greaterThanOrEqualTo": {
              "type": [
                "string",
                "number"
              ],
              "examples": [
                100
              ],
              "description": "The field's numeric value is greater than or equal to this."
            },
            "lessThan": {
              "type": [
                "string",
                "number"
              ],
              "examples": [
                1000
              ],
              "description": "The field's numeric value is less than this."
            },
            "lessThanOrEqualTo": {
              "type": [
                "string",
                "number"
              ],
              "examples": [
                1000
              ],
              "description": "The field's numeric value is less than or equal to this."
            },
            "bodyFileName": {
              "type": "string",
              "examples": [
                "requests/cics-account-match.json"
              ],
              "description": "Name of a file under __files that holds this matcher's value, in place of an inline one. Use it alone."
            }
          },
          "oneOf": [
            {
              "required": [
                "field"
              ],
              "oneOf": [
                {
                  "required": [
                    "equalTo"
                  ]
                },
                {
                  "required": [
                    "matches"
                  ]
                },
                {
                  "required": [
                    "greaterThan"
                  ]
                },
                {
                  "required": [
                    "greaterThanOrEqualTo"
                  ]
                },
                {
                  "required": [
                    "lessThan"
                  ]
                },
                {
                  "required": [
                    "lessThanOrEqualTo"
                  ]
                }
              ],
              "not": {
                "required": [
                  "bodyFileName"
                ]
              }
            },
            {
              "required": [
                "bodyFileName"
              ],
              "maxProperties": 1
            }
          ],
          "additionalProperties": false,
          "examples": [
            {
              "field": "COMMAREA.ACCOUNT-NO",
              "equalTo": "1234567890"
            }
          ]
        }
      },
      "additionalProperties": false,
      "anyOf": [
        {
          "required": [
            "equalTo"
          ]
        },
        {
          "required": [
            "equalToJson"
          ]
        },
        {
          "required": [
            "matchesJsonSchema"
          ]
        },
        {
          "required": [
            "equalToXml"
          ]
        },
        {
          "required": [
            "matchesJsonPath"
          ]
        },
        {
          "required": [
            "matchesXPath"
          ]
        },
        {
          "required": [
            "contains"
          ]
        },
        {
          "required": [
            "doesNotContain"
          ]
        },
        {
          "required": [
            "matches"
          ]
        },
        {
          "required": [
            "doesNotMatch"
          ]
        },
        {
          "required": [
            "before"
          ]
        },
        {
          "required": [
            "after"
          ]
        },
        {
          "required": [
            "equalToDateTime"
          ]
        },
        {
          "required": [
            "anything"
          ]
        },
        {
          "required": [
            "absent"
          ]
        },
        {
          "required": [
            "and"
          ]
        },
        {
          "required": [
            "or"
          ]
        },
        {
          "required": [
            "not"
          ]
        },
        {
          "required": [
            "matchesPathTemplate"
          ]
        },
        {
          "required": [
            "binaryEqualTo"
          ]
        },
        {
          "required": [
            "matchesXml"
          ]
        },
        {
          "required": [
            "matchesJson"
          ]
        },
        {
          "required": [
            "matchesGraphQL"
          ]
        },
        {
          "required": [
            "matchesSwiftField"
          ]
        },
        {
          "required": [
            "matchesFixField"
          ]
        },
        {
          "required": [
            "matchesCicsField"
          ]
        }
      ],
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "before"
                ]
              },
              {
                "required": [
                  "after"
                ]
              },
              {
                "required": [
                  "equalToDateTime"
                ]
              }
            ]
          },
          "then": {
            "properties": {
              "truncateExpected": {
                "pattern": "^(?:[Ff][Ii][Rr][Ss][Tt][ _][Ss][Ee][Cc][Oo][Nn][Dd][ _][Oo][Ff][ _][Mm][Ii][Nn][Uu][Tt][Ee]|[Ff][Ii][Rr][Ss][Tt][ _][Mm][Ii][Nn][Uu][Tt][Ee][ _][Oo][Ff][ _][Hh][Oo][Uu][Rr]|[Ff][Ii][Rr][Ss][Tt][ _][Hh][Oo][Uu][Rr][ _][Oo][Ff][ _][Dd][Aa][Yy]|[Ff][Ii][Rr][Ss][Tt][ _][Dd][Aa][Yy][ _][Oo][Ff][ _][Mm][Oo][Nn][Tt][Hh]|[Ff][Ii][Rr][Ss][Tt][ _][Dd][Aa][Yy][ _][Oo][Ff][ _][Nn][Ee][Xx][Tt][ _][Mm][Oo][Nn][Tt][Hh]|[Ll][Aa][Ss][Tt][ _][Dd][Aa][Yy][ _][Oo][Ff][ _][Mm][Oo][Nn][Tt][Hh]|[Ff][Ii][Rr][Ss][Tt][ _][Dd][Aa][Yy][ _][Oo][Ff][ _][Yy][Ee][Aa][Rr]|[Ff][Ii][Rr][Ss][Tt][ _][Dd][Aa][Yy][ _][Oo][Ff][ _][Nn][Ee][Xx][Tt][ _][Yy][Ee][Aa][Rr]|[Ll][Aa][Ss][Tt][ _][Dd][Aa][Yy][ _][Oo][Ff][ _][Yy][Ee][Aa][Rr])$"
              },
              "truncateActual": {
                "pattern": "^(?:[Ff][Ii][Rr][Ss][Tt][ _][Ss][Ee][Cc][Oo][Nn][Dd][ _][Oo][Ff][ _][Mm][Ii][Nn][Uu][Tt][Ee]|[Ff][Ii][Rr][Ss][Tt][ _][Mm][Ii][Nn][Uu][Tt][Ee][ _][Oo][Ff][ _][Hh][Oo][Uu][Rr]|[Ff][Ii][Rr][Ss][Tt][ _][Hh][Oo][Uu][Rr][ _][Oo][Ff][ _][Dd][Aa][Yy]|[Ff][Ii][Rr][Ss][Tt][ _][Dd][Aa][Yy][ _][Oo][Ff][ _][Mm][Oo][Nn][Tt][Hh]|[Ff][Ii][Rr][Ss][Tt][ _][Dd][Aa][Yy][ _][Oo][Ff][ _][Nn][Ee][Xx][Tt][ _][Mm][Oo][Nn][Tt][Hh]|[Ll][Aa][Ss][Tt][ _][Dd][Aa][Yy][ _][Oo][Ff][ _][Mm][Oo][Nn][Tt][Hh]|[Ff][Ii][Rr][Ss][Tt][ _][Dd][Aa][Yy][ _][Oo][Ff][ _][Yy][Ee][Aa][Rr]|[Ff][Ii][Rr][Ss][Tt][ _][Dd][Aa][Yy][ _][Oo][Ff][ _][Nn][Ee][Xx][Tt][ _][Yy][Ee][Aa][Rr]|[Ll][Aa][Ss][Tt][ _][Dd][Aa][Yy][ _][Oo][Ff][ _][Yy][Ee][Aa][Rr])$"
              }
            }
          }
        },
        {
          "if": {
            "required": [
              "equalToXml"
            ]
          },
          "then": {
            "properties": {
              "exemptedComparisons": {
                "items": {
                  "enum": [
                    "XML_VERSION",
                    "XML_STANDALONE",
                    "XML_ENCODING",
                    "HAS_DOCTYPE_DECLARATION",
                    "DOCTYPE_NAME",
                    "DOCTYPE_PUBLIC_ID",
                    "DOCTYPE_SYSTEM_ID",
                    "SCHEMA_LOCATION",
                    "NO_NAMESPACE_SCHEMA_LOCATION",
                    "NODE_TYPE",
                    "NAMESPACE_PREFIX",
                    "NAMESPACE_URI",
                    "TEXT_VALUE",
                    "PROCESSING_INSTRUCTION_TARGET",
                    "PROCESSING_INSTRUCTION_DATA",
                    "ELEMENT_TAG_NAME",
                    "ATTR_VALUE_EXPLICITLY_SPECIFIED",
                    "ELEMENT_NUM_ATTRIBUTES",
                    "ATTR_VALUE",
                    "CHILD_NODELIST_LENGTH",
                    "CHILD_NODELIST_SEQUENCE",
                    "CHILD_LOOKUP",
                    "ATTR_NAME_LOOKUP"
                  ]
                }
              }
            }
          }
        }
      ]
    }
  }
}
