Mock Service Worker · Schema
Mock Service Worker Handler
Schema describing a Mock Service Worker (MSW) request handler definition. Captures the protocol, matching pattern, and mocked response so handler definitions can be portable across MSW environments.
API MockingGraphQLHTTPMock ServerMockingService WorkerTestingWebSocket
JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/api-evangelist/mock-service-worker/main/json-schema/mock-service-worker-handler-schema.json",
"title": "Mock Service Worker Handler",
"description": "Schema describing a Mock Service Worker (MSW) request handler definition. Captures the protocol, matching pattern, and mocked response so handler definitions can be portable across MSW environments.",
"type": "object",
"required": ["protocol"],
"oneOf": [
{
"title": "REST handler",
"properties": {
"protocol": { "const": "http" },
"method": {
"type": "string",
"enum": ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "ALL"]
},
"path": {
"type": "string",
"description": "URL pattern, supports path parameters via :param syntax."
},
"response": { "$ref": "#/$defs/response" }
},
"required": ["protocol", "method", "path"]
},
{
"title": "GraphQL handler",
"properties": {
"protocol": { "const": "graphql" },
"operationKind": { "type": "string", "enum": ["query", "mutation", "subscription", "operation"] },
"operationName": { "type": "string" },
"endpoint": { "type": "string", "format": "uri" },
"response": { "$ref": "#/$defs/response" }
},
"required": ["protocol", "operationKind"]
},
{
"title": "WebSocket handler",
"properties": {
"protocol": { "const": "ws" },
"url": { "type": "string", "format": "uri" }
},
"required": ["protocol", "url"]
},
{
"title": "Server-Sent Events handler",
"properties": {
"protocol": { "const": "sse" },
"url": { "type": "string", "format": "uri" }
},
"required": ["protocol", "url"]
}
],
"$defs": {
"response": {
"type": "object",
"properties": {
"status": { "type": "integer", "minimum": 100, "maximum": 599 },
"headers": {
"type": "object",
"additionalProperties": { "type": "string" }
},
"body": {},
"delayMs": { "type": "integer", "minimum": 0 }
}
}
}
}
Work with this as data
Every JSON Schema here is available over the APIs.io API and to AI agents over MCP.
MCP server
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
Tools for schemas
4 MCP tools reach this
find_json_schemasBrowse and filter every JSON Schema in the catalog.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.
Call it yourself
curl for this page
This JSON Schema
curl "https://apis.io/api/v1/json-schemas/mock-service-worker-handler"
All schemas
curl "https://apis.io/api/v1/json-schemas?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.