Skip to content

Instantly share code, notes, and snippets.

@MasonM
Created February 26, 2018 05:50
Show Gist options
  • Save MasonM/f70fc9feaf0c3cc4b49d337673c3b3f7 to your computer and use it in GitHub Desktop.
Save MasonM/f70fc9feaf0c3cc4b49d337673c3b3f7 to your computer and use it in GitHub Desktop.
Wiremock API spec in OpenAPI 3.0 format
{
"info": {
"title": "WireMock",
"version": "2.15.0"
},
"paths": {
"/__admin/mappings": {
"delete": {
"responses": {
"200": {
"description": "Successfully deleted"
}
},
"description": "Delete all stub mappings"
},
"get": {
"parameters": [
{
"description": "The maximum number of results to return",
"in": "query",
"name": "limit",
"required": false,
"schema": {
"type": "number"
}
},
{
"description": "The start index of the results to return",
"in": "query",
"name": "offset",
"required": false,
"schema": {
"type": "number"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/stubMappings"
}
}
},
"description": "All stub mappings"
}
},
"description": "Get all stub mappings"
},
"post": {
"responses": {
"201": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/stubMapping"
}
}
},
"description": "Successfully created"
}
},
"description": "Create a new stub mapping",
"requestBody": {
"$ref": "#/components/requestBodies/stubMapping"
}
}
},
"/__admin/mappings/reset": {
"post": {
"responses": {
"200": {
"description": "Successfully reset"
}
},
"description": "Reset stub mappings (restore to defaults defined back the backing store)"
}
},
"/__admin/mappings/save": {
"post": {
"responses": {
"200": {
"description": "Successfully removed"
}
},
"description": "Save all persistent stub mappings to the backing store"
}
},
"/__admin/mappings/{stubMappingId}": {
"delete": {
"parameters": [
{
"description": "The UUID of stub mapping",
"in": "path",
"name": "stubMappingId",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK"
}
},
"description": "Delete a stub mapping"
},
"get": {
"parameters": [
{
"description": "The UUID of stub mapping",
"in": "path",
"name": "stubMappingId",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/stubMapping"
}
}
},
"description": "OK"
}
},
"description": "Get a single stub mapping"
},
"put": {
"parameters": [
{
"description": "The UUID of stub mapping",
"in": "path",
"name": "stubMappingId",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/stubMapping"
}
}
},
"description": "OK"
}
},
"description": "Update an existing stub mapping",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/stubMapping"
}
}
},
"required": true
}
}
},
"/__admin/near-misses/request": {
"post": {
"responses": {
"200": {
"description": "Near misses matching criteria"
}
},
"description": "Find at most 3 near misses for closest stub mappings to the specified request",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/loggedRequest"
}
}
},
"required": true
}
}
},
"/__admin/near-misses/request-pattern": {
"post": {
"responses": {
"200": {
"description": "Near misses matching criteria"
}
},
"description": "Find at most 3 near misses for closest logged requests to the specified request pattern",
"requestBody": {
"$ref": "#/components/requestBodies/requestPattern"
}
}
},
"/__admin/recordings/snapshot": {
"post": {
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/stubMappings"
}
}
},
"description": "Successfully took a snapshot recording"
}
},
"description": "Take a snapshot recording",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/snapshot"
}
}
},
"required": true
}
}
},
"/__admin/recordings/start": {
"post": {
"responses": {
"200": {
"description": "Successfully started recording"
}
},
"description": "Start recording stub mappings",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/startRecording"
}
}
},
"required": true
}
}
},
"/__admin/recordings/status": {
"get": {
"responses": {
"200": {
"description": "Successfully got the record status"
}
},
"description": "Get the recording status (started or stopped)"
}
},
"/__admin/recordings/stop": {
"post": {
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/stubMappings"
}
}
},
"description": "Successfully started recording"
}
},
"description": "Stop recording stub mappings"
}
},
"/__admin/requests": {
"delete": {
"responses": {
"200": {
"description": "Successfully deleted"
}
},
"description": "Delete all received requests"
},
"get": {
"parameters": [
{
"description": "The maximum number of results to return",
"in": "query",
"name": "limit",
"schema": {
"type": "string"
}
},
{
"description": "Only return logged requests after this date",
"in": "query",
"name": "since",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK"
}
},
"description": "Get received requests"
}
},
"/__admin/requests/count": {
"post": {
"responses": {
"200": {
"description": "Number of matching requests"
}
},
"description": "Count requests logged in the journal matching the specified criteria",
"requestBody": {
"$ref": "#/components/requestBodies/requestPattern"
}
}
},
"/__admin/requests/find": {
"post": {
"responses": {
"200": {
"description": "Matching request details"
}
},
"description": "Retrieve details of requests logged in the journal matching the specified criteria",
"requestBody": {
"$ref": "#/components/requestBodies/requestPattern"
}
}
},
"/__admin/requests/reset": {
"post": {
"responses": {
"200": {
"description": "Successfully reset"
}
},
"description": "Empty the request journal"
}
},
"/__admin/requests/unmatched": {
"get": {
"responses": {
"200": {
"description": "Unmatched request details"
}
},
"description": "Get details of logged requests that weren't matched by any stub mapping"
}
},
"/__admin/requests/unmatched/near-misses": {
"get": {
"responses": {
"200": {
"description": "Top 3 (at most) near misses for each unmatched request"
}
},
"description": "Retrieve near-misses for all unmatched requests"
}
},
"/__admin/requests/{requestId}": {
"get": {
"parameters": [
{
"description": "The UUID of the logged request",
"in": "path",
"name": "requestId",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/__admin/scenarios": {
"get": {
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/scenarios"
}
}
},
"description": "All scenarios"
}
},
"description": "Get all scenarios"
}
},
"/__admin/scenarios/reset": {
"post": {
"responses": {
"200": {
"description": "Successfully reset"
}
},
"description": "Reset the state of all scenarios"
}
},
"/__admin/settings": {
"post": {
"responses": {
"200": {
"description": "Settings successfully updated"
}
},
"description": "Update global settings",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/globalSettings"
}
}
},
"required": true
}
}
},
"/__admin/shutdown": {
"post": {
"responses": {
"200": {
"description": "Server will be shut down"
}
},
"description": "Shutdown the WireMock server"
}
}
},
"components": {
"requestBodies": {
"requestPattern": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/requestPattern"
}
}
},
"required": true
},
"stubMapping": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/stubMapping"
}
}
},
"required": true
}
},
"schemas": {
"globalSettings": {
"properties": {
"delayDistribution": {
"oneOf": [
{
"description": "Log normal randomly distributed response delay.",
"properties": {
"median": {
"type": "integer"
},
"sigma": {
"type": "number"
},
"type": {
"enum": [
"lognormal"
],
"type": "string"
}
},
"required": [
"type",
"median",
"sigma"
],
"type": "object"
},
{
"description": "Uniformly distributed random response delay.",
"properties": {
"lower": {
"type": "integer"
},
"type": {
"enum": [
"uniform"
],
"type": "string"
},
"upper": {
"type": "integer"
}
},
"required": [
"type",
"upper",
"lower"
],
"type": "object"
}
],
"type": "object"
},
"fixedDelay": {
"type": "number"
}
},
"type": "object"
},
"loggedRequest": {
"example": {
"absoluteUrl": "http://localhost:56738/received-request/2",
"body": "Hello world",
"cookies": {},
"headers": {
"Connection": "keep-alive",
"Host": "localhost:56738",
"User-Agent": "Apache-HttpClient/4.5.1 (Java/1.7.0_51)"
},
"method": "GET",
"url": "/received-request/2"
},
"properties": {
"absoluteUrl": {
"description": "The full URL to match against",
"type": "string"
},
"body": {
"description": "Body string to match against",
"type": "string"
},
"cookies": {
"description": "Cookie patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"headers": {
"description": "Header patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"method": {
"description": "The HTTP request method e.g. GET",
"type": "string"
},
"url": {
"description": "The path and query to match exactly against",
"type": "string"
}
},
"type": "object"
},
"requestPattern": {
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": "application/json"
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"basicAuthCredentials": {
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
],
"type": "object"
},
"bodyPatterns": {
"description": "Request body patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"items": {
"type": "object"
},
"type": "array"
},
"cookies": {
"description": "Cookie patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"headers": {
"description": "Header patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"method": {
"description": "The HTTP request method e.g. GET",
"type": "string"
},
"queryParameters": {
"description": "Query parameter patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"url": {
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPath": {
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPathPattern": {
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPattern": {
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
}
},
"type": "object"
},
"scenarios": {
"properties": {
"scenarios": {
"items": {
"properties": {
"id": {
"description": "The scenario ID",
"example": [
"c8d249ec-d86d-48b1-88a8-a660e6848042"
],
"type": "string"
},
"name": {
"description": "The scenario name",
"example": [
"my_scenario"
],
"type": "string"
},
"possibleStates": {
"items": {
"default": "Started",
"description": "All the states this scenario can be in",
"example": [
"Started",
"Step two",
"step_3"
],
"type": "string"
},
"type": "array"
},
"state": {
"default": "Started",
"description": "The current state of this scenario",
"example": [
"Started",
"Step two",
"step_3"
],
"type": "string"
}
},
"type": "object"
},
"type": "array"
}
},
"type": "object"
},
"snapshot": {
"allOf": [
{
"properties": {
"captureHeaders": {
"additionalProperties": {
"additionalProperties": false,
"properties": {
"caseInsensitive": {
"type": "boolean"
}
},
"type": "object"
},
"description": "Headers from the request to include in the generated stub mappings, mapped to parameter objects. The only parameter available is \"caseInsensitive\", which defaults to false",
"example": [
{
"Accept": {}
},
{
"Accept": {},
"Content-Type": {
"caseInsensitive": true
}
}
],
"type": "object"
},
"extractBodyCriteria": {
"description": "Criteria for extracting response bodies to a separate file instead of including it in the stub mapping",
"example": [
{
"binarySizeThreshold": "1 Mb",
"textSizeThreshold": "2 kb"
}
],
"properties": {
"binarySizeThreshold": {
"default": "0",
"description": "Size threshold for extracting binary response bodies. Default unit is bytes",
"example": [
"56 kb",
"10 Mb",
"18.2 GB",
"255"
],
"type": "string"
},
"textSizeThreshold": {
"default": "0",
"description": "Size threshold for extracting text response bodies. Default unit is bytes",
"example": [
"56 kb",
"10 Mb",
"18.2 GB",
"255"
],
"type": "string"
}
},
"type": "object"
},
"persist": {
"default": true,
"description": "Whether to save stub mappings to the file system or just return them",
"type": "boolean"
},
"repeatsAsScenarios": {
"default": true,
"description": "When true, duplicate requests will be added to a Scenario. When false, duplicates are discarded",
"type": "boolean"
},
"requestBodyPattern": {
"description": "Control the request body matcher used in generated stub mappings",
"oneOf": [
{
"description": "Automatically determine matcher based on content type (the default)",
"properties": {
"caseInsensitive": {
"default": false,
"description": "If equalTo is used, match body use case-insensitive string comparison",
"type": "boolean"
},
"ignoreArrayOrder": {
"default": true,
"description": "If equalToJson is used, ignore order of array elements",
"type": "boolean"
},
"ignoreExtraElements": {
"default": true,
"description": "If equalToJson is used, matcher ignores extra elements in objects",
"type": "boolean"
},
"matcher": {
"enum": [
"auto"
],
"type": "string"
}
},
"type": "object"
},
{
"description": "Always match request bodies using equalTo",
"properties": {
"caseInsensitive": {
"default": false,
"description": "Match body using case-insensitive string comparison",
"type": "boolean"
},
"matcher": {
"enum": [
"equalTo"
],
"type": "string"
}
},
"type": "object"
},
{
"description": "Always match request bodies using equalToJson",
"properties": {
"ignoreArrayOrder": {
"default": true,
"description": "Ignore order of array elements",
"type": "boolean"
},
"ignoreExtraElements": {
"default": true,
"description": "Ignore extra elements in objects",
"type": "boolean"
},
"matcher": {
"enum": [
"equalToJson"
],
"type": "string"
}
},
"type": "object"
},
{
"description": "Always match request bodies using equalToXml",
"properties": {
"matcher": {
"enum": [
"equalToXml"
],
"type": "string"
}
},
"type": "object"
}
],
"type": "object"
},
"transformerParameters": {
"description": "List of names of stub mappings transformers to apply to generated stubs",
"type": "object"
},
"transformers": {
"description": "Parameters to pass to stub mapping transformers",
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
},
{
"properties": {
"filters": {
"allOf": [
{
"properties": {
"ids": {
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
},
{
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": "application/json"
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"basicAuthCredentials": {
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
],
"type": "object"
},
"bodyPatterns": {
"description": "Request body patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"items": {
"type": "object"
},
"type": "array"
},
"cookies": {
"description": "Cookie patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"headers": {
"description": "Header patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"method": {
"description": "The HTTP request method e.g. GET",
"type": "string"
},
"queryParameters": {
"description": "Query parameter patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"url": {
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPath": {
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPathPattern": {
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPattern": {
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
}
},
"type": "object"
}
],
"description": "Filter requests for which to create stub mapping",
"type": "object"
}
},
"type": "object"
}
],
"type": "object"
},
"startRecording": {
"allOf": [
{
"properties": {
"captureHeaders": {
"additionalProperties": {
"additionalProperties": false,
"properties": {
"caseInsensitive": {
"type": "boolean"
}
},
"type": "object"
},
"description": "Headers from the request to include in the generated stub mappings, mapped to parameter objects. The only parameter available is \"caseInsensitive\", which defaults to false",
"example": [
{
"Accept": {}
},
{
"Accept": {},
"Content-Type": {
"caseInsensitive": true
}
}
],
"type": "object"
},
"extractBodyCriteria": {
"description": "Criteria for extracting response bodies to a separate file instead of including it in the stub mapping",
"example": [
{
"binarySizeThreshold": "1 Mb",
"textSizeThreshold": "2 kb"
}
],
"properties": {
"binarySizeThreshold": {
"default": "0",
"description": "Size threshold for extracting binary response bodies. Default unit is bytes",
"example": [
"56 kb",
"10 Mb",
"18.2 GB",
"255"
],
"type": "string"
},
"textSizeThreshold": {
"default": "0",
"description": "Size threshold for extracting text response bodies. Default unit is bytes",
"example": [
"56 kb",
"10 Mb",
"18.2 GB",
"255"
],
"type": "string"
}
},
"type": "object"
},
"persist": {
"default": true,
"description": "Whether to save stub mappings to the file system or just return them",
"type": "boolean"
},
"repeatsAsScenarios": {
"default": true,
"description": "When true, duplicate requests will be added to a Scenario. When false, duplicates are discarded",
"type": "boolean"
},
"requestBodyPattern": {
"description": "Control the request body matcher used in generated stub mappings",
"oneOf": [
{
"description": "Automatically determine matcher based on content type (the default)",
"properties": {
"caseInsensitive": {
"default": false,
"description": "If equalTo is used, match body use case-insensitive string comparison",
"type": "boolean"
},
"ignoreArrayOrder": {
"default": true,
"description": "If equalToJson is used, ignore order of array elements",
"type": "boolean"
},
"ignoreExtraElements": {
"default": true,
"description": "If equalToJson is used, matcher ignores extra elements in objects",
"type": "boolean"
},
"matcher": {
"enum": [
"auto"
],
"type": "string"
}
},
"type": "object"
},
{
"description": "Always match request bodies using equalTo",
"properties": {
"caseInsensitive": {
"default": false,
"description": "Match body using case-insensitive string comparison",
"type": "boolean"
},
"matcher": {
"enum": [
"equalTo"
],
"type": "string"
}
},
"type": "object"
},
{
"description": "Always match request bodies using equalToJson",
"properties": {
"ignoreArrayOrder": {
"default": true,
"description": "Ignore order of array elements",
"type": "boolean"
},
"ignoreExtraElements": {
"default": true,
"description": "Ignore extra elements in objects",
"type": "boolean"
},
"matcher": {
"enum": [
"equalToJson"
],
"type": "string"
}
},
"type": "object"
},
{
"description": "Always match request bodies using equalToXml",
"properties": {
"matcher": {
"enum": [
"equalToXml"
],
"type": "string"
}
},
"type": "object"
}
],
"type": "object"
},
"transformerParameters": {
"description": "List of names of stub mappings transformers to apply to generated stubs",
"type": "object"
},
"transformers": {
"description": "Parameters to pass to stub mapping transformers",
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
},
{
"properties": {
"filters": {
"description": "Filter requests for which to create stub mapping",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": "application/json"
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"basicAuthCredentials": {
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
],
"type": "object"
},
"bodyPatterns": {
"description": "Request body patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"items": {
"type": "object"
},
"type": "array"
},
"cookies": {
"description": "Cookie patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"headers": {
"description": "Header patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"method": {
"description": "The HTTP request method e.g. GET",
"type": "string"
},
"queryParameters": {
"description": "Query parameter patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"url": {
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPath": {
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPathPattern": {
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPattern": {
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
}
},
"type": "object"
},
"targetBaseUrl": {
"description": "Target URL when using the record and playback API",
"example": [
"http://example.mocklab.io"
],
"type": "string"
}
},
"type": "object"
}
],
"type": "object"
},
"stubMapping": {
"example": {
"id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
"priority": 3,
"request": {
"headers": {
"Accept": "text/plain"
},
"method": "GET",
"url": "/some/thing"
},
"response": {
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
},
"status": 200
}
},
"properties": {
"id": {
"description": "This stub mapping's unique identifier",
"type": "string"
},
"newScenarioState": {
"description": "The new state for the scenario to be updated to after this stub is served.",
"type": "string"
},
"persistent": {
"description": "Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default.",
"type": "boolean"
},
"postServeActions": {
"description": "A map of the names of post serve action extensions to trigger and their parameters.",
"type": "object"
},
"priority": {
"description": "This stub mapping's priority relative to others. 1 is highest.",
"minimum": 1,
"type": "integer"
},
"request": {
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": "application/json"
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"basicAuthCredentials": {
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
],
"type": "object"
},
"bodyPatterns": {
"description": "Request body patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"items": {
"type": "object"
},
"type": "array"
},
"cookies": {
"description": "Cookie patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"headers": {
"description": "Header patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"method": {
"description": "The HTTP request method e.g. GET",
"type": "string"
},
"queryParameters": {
"description": "Query parameter patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"url": {
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPath": {
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPathPattern": {
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPattern": {
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
}
},
"type": "object"
},
"requiredScenarioState": {
"description": "The required state of the scenario in order for this stub to be matched.",
"type": "string"
},
"response": {
"properties": {
"additionalProxyRequestHeaders": {
"description": "Extra request headers to send when proxying to another host.",
"type": "object"
},
"base64Body": {
"description": "The response body as a base64 encoded string (useful for binary content). Only one of body, base64Body, jsonBody or bodyFileName may be specified.",
"type": "string"
},
"body": {
"description": "The response body as a string. Only one of body, base64Body, jsonBody or bodyFileName may be specified.",
"type": "string"
},
"bodyFileName": {
"description": "The path to the file containing the response body, relative to the configured file root. Only one of body, base64Body, jsonBody or bodyFileName may be specified.",
"type": "string"
},
"delayDistribution": {
"description": "Random delay settings.",
"oneOf": [
{
"description": "Log normal randomly distributed response delay.",
"properties": {
"median": {
"type": "integer"
},
"sigma": {
"type": "number"
},
"type": {
"enum": [
"lognormal"
],
"type": "string"
}
},
"required": [
"type",
"median",
"sigma"
],
"type": "object"
},
{
"description": "Uniformly distributed random response delay.",
"properties": {
"lower": {
"type": "integer"
},
"type": {
"enum": [
"uniform"
],
"type": "string"
},
"upper": {
"type": "integer"
}
},
"required": [
"type",
"upper",
"lower"
],
"type": "object"
}
],
"type": "object"
},
"fault": {
"description": "The fault to apply (instead of a full, valid response).",
"enum": [
"CONNECTION_RESET_BY_PEER",
"EMPTY_RESPONSE",
"MALFORMED_RESPONSE_CHUNK",
"RANDOM_DATA_THEN_CLOSE"
],
"type": "string"
},
"fixedDelayMilliseconds": {
"description": "Number of milliseconds to delay be before sending the response.",
"type": "integer"
},
"fromConfiguredStub": {
"description": "Read-only flag indicating false if this was the default, unmatched response. Not present otherwise.",
"type": "boolean"
},
"headers": {
"description": "Map of response headers to send",
"type": "object"
},
"jsonBody": {
"description": "The response body as a JSON object. Only one of body, base64Body, jsonBody or bodyFileName may be specified.",
"type": "object"
},
"proxyBaseUrl": {
"description": "The base URL of the target to proxy matching requests to.",
"type": "string"
},
"status": {
"description": "The HTTP status code to be returned",
"type": "integer"
},
"statusMessage": {
"description": "The HTTP status message to be returned",
"type": "string"
},
"transformerParameters": {
"description": "Parameters to apply to response transformers.",
"type": "object"
},
"transformers": {
"description": "List of names of transformers to apply to this response.",
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
},
"scenarioName": {
"description": "The name of the scenario that this stub mapping is part of",
"type": "string"
}
},
"type": "object"
},
"stubMappings": {
"properties": {
"mappings": {
"example": {
"id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
"priority": 3,
"request": {
"headers": {
"Accept": "text/plain"
},
"method": "GET",
"url": "/some/thing"
},
"response": {
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
},
"status": 200
}
},
"properties": {
"id": {
"description": "This stub mapping's unique identifier",
"type": "string"
},
"newScenarioState": {
"description": "The new state for the scenario to be updated to after this stub is served.",
"type": "string"
},
"persistent": {
"description": "Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default.",
"type": "boolean"
},
"postServeActions": {
"description": "A map of the names of post serve action extensions to trigger and their parameters.",
"type": "object"
},
"priority": {
"description": "This stub mapping's priority relative to others. 1 is highest.",
"minimum": 1,
"type": "integer"
},
"request": {
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": "application/json"
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"basicAuthCredentials": {
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
],
"type": "object"
},
"bodyPatterns": {
"description": "Request body patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"items": {
"type": "object"
},
"type": "array"
},
"cookies": {
"description": "Cookie patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"headers": {
"description": "Header patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"method": {
"description": "The HTTP request method e.g. GET",
"type": "string"
},
"queryParameters": {
"description": "Query parameter patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"url": {
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPath": {
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPathPattern": {
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPattern": {
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
}
},
"type": "object"
},
"requiredScenarioState": {
"description": "The required state of the scenario in order for this stub to be matched.",
"type": "string"
},
"response": {
"properties": {
"additionalProxyRequestHeaders": {
"description": "Extra request headers to send when proxying to another host.",
"type": "object"
},
"base64Body": {
"description": "The response body as a base64 encoded string (useful for binary content). Only one of body, base64Body, jsonBody or bodyFileName may be specified.",
"type": "string"
},
"body": {
"description": "The response body as a string. Only one of body, base64Body, jsonBody or bodyFileName may be specified.",
"type": "string"
},
"bodyFileName": {
"description": "The path to the file containing the response body, relative to the configured file root. Only one of body, base64Body, jsonBody or bodyFileName may be specified.",
"type": "string"
},
"delayDistribution": {
"description": "Random delay settings.",
"oneOf": [
{
"description": "Log normal randomly distributed response delay.",
"properties": {
"median": {
"type": "integer"
},
"sigma": {
"type": "number"
},
"type": {
"enum": [
"lognormal"
],
"type": "string"
}
},
"required": [
"type",
"median",
"sigma"
],
"type": "object"
},
{
"description": "Uniformly distributed random response delay.",
"properties": {
"lower": {
"type": "integer"
},
"type": {
"enum": [
"uniform"
],
"type": "string"
},
"upper": {
"type": "integer"
}
},
"required": [
"type",
"upper",
"lower"
],
"type": "object"
}
],
"type": "object"
},
"fault": {
"description": "The fault to apply (instead of a full, valid response).",
"enum": [
"CONNECTION_RESET_BY_PEER",
"EMPTY_RESPONSE",
"MALFORMED_RESPONSE_CHUNK",
"RANDOM_DATA_THEN_CLOSE"
],
"type": "string"
},
"fixedDelayMilliseconds": {
"description": "Number of milliseconds to delay be before sending the response.",
"type": "integer"
},
"fromConfiguredStub": {
"description": "Read-only flag indicating false if this was the default, unmatched response. Not present otherwise.",
"type": "boolean"
},
"headers": {
"description": "Map of response headers to send",
"type": "object"
},
"jsonBody": {
"description": "The response body as a JSON object. Only one of body, base64Body, jsonBody or bodyFileName may be specified.",
"type": "object"
},
"proxyBaseUrl": {
"description": "The base URL of the target to proxy matching requests to.",
"type": "string"
},
"status": {
"description": "The HTTP status code to be returned",
"type": "integer"
},
"statusMessage": {
"description": "The HTTP status message to be returned",
"type": "string"
},
"transformerParameters": {
"description": "Parameters to apply to response transformers.",
"type": "object"
},
"transformers": {
"description": "List of names of transformers to apply to this response.",
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
},
"scenarioName": {
"description": "The name of the scenario that this stub mapping is part of",
"type": "string"
}
},
"type": "object"
},
"meta": {
"properties": {
"total": {
"type": "integer"
}
},
"required": [
"total"
],
"type": "object"
}
},
"type": "object"
}
}
},
"openapi": "3.0.0",
"servers": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment