{ "$schema": "https://json-structure.org/meta/core/v0/#", "$id": "https://raw.githubusercontent.com/api-evangelist/test-first/refs/heads/main/json-structure/test-first-contract-structure.json", "name": "TestFirstContract", "description": "A consumer-driven API contract expressing what the consumer expects the API to provide, written before the provider implements it.", "properties": { "id": { "description": "Unique identifier for the contract.", "type": "string" }, "consumer": { "description": "Name of the API consumer that authored this contract.", "type": "string" }, "provider": { "description": "Name of the API provider that must satisfy this contract.", "type": "string" }, "version": { "description": "Version of the contract.", "type": "string" }, "interactions": { "items": { "$ref": "#/definitions/Interaction" }, "description": "List of expected request/response interactions.", "type": "array" }, "metadata": { "properties": { "pact_specification": { "description": "Pact specification version used.", "type": "string" }, "created": { "description": "When the contract was created.", "type": "datetime" } }, "type": "object" } }, "required": [ "id", "consumer", "provider", "interactions" ], "definitions": { "Interaction": { "properties": { "description": { "description": "Description of the interaction.", "type": "string" }, "provider_state": { "description": "The state the provider must be in for this interaction.", "type": "string" }, "request": { "$ref": "#/definitions/HttpRequest" }, "response": { "$ref": "#/definitions/HttpResponse" } }, "required": [ "description", "request", "response" ], "type": "object", "name": "Interaction" }, "HttpRequest": { "properties": { "method": { "enum": [ "GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS" ], "description": "HTTP method.", "type": "string" }, "path": { "description": "Request path.", "type": "string" }, "headers": { "additionalProperties": { "type": "string" }, "description": "Request headers.", "type": "object" }, "body": { "description": "Request body." } }, "required": [ "method", "path" ], "type": "object", "name": "HttpRequest" }, "HttpResponse": { "properties": { "status": { "minimum": 100, "maximum": 599, "description": "Expected HTTP status code.", "type": "int32" }, "headers": { "additionalProperties": { "type": "string" }, "description": "Expected response headers.", "type": "object" }, "body": { "description": "Expected response body." } }, "required": [ "status" ], "type": "object", "name": "HttpResponse" } }, "type": "object" }