85 lines
2.0 KiB
JSON
85 lines
2.0 KiB
JSON
{
|
|
"_comment": "Pact contract template. Customize this to match your API's structure.",
|
|
"provider": {
|
|
"name": "YourProviderAPI"
|
|
},
|
|
"consumer": {
|
|
"name": "YourConsumer"
|
|
},
|
|
"interactions": [
|
|
{
|
|
"_comment": "Example interaction. Modify as needed.",
|
|
"description": "A request for a user",
|
|
"request": {
|
|
"method": "GET",
|
|
"path": "/users/123",
|
|
"headers": {
|
|
"Accept": "application/json"
|
|
}
|
|
},
|
|
"response": {
|
|
"status": 200,
|
|
"headers": {
|
|
"Content-Type": "application/json; charset=utf-8"
|
|
},
|
|
"body": {
|
|
"id": 123,
|
|
"name": "John Doe",
|
|
"email": "john.doe@example.com",
|
|
"address": {
|
|
"street": "123 Main St",
|
|
"city": "Anytown",
|
|
"zip": "12345"
|
|
},
|
|
"_comment": "You can use Pact matchers here, e.g., using a regex to validate email format.",
|
|
"email_verification_status": "verified"
|
|
}
|
|
},
|
|
"providerStates": [
|
|
{
|
|
"name": "User 123 exists",
|
|
"params": {
|
|
"user_id": 123
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"_comment": "Another example interaction - creating a new user.",
|
|
"description": "Creating a new user",
|
|
"request": {
|
|
"method": "POST",
|
|
"path": "/users",
|
|
"headers": {
|
|
"Content-Type": "application/json"
|
|
},
|
|
"body": {
|
|
"name": "Jane Smith",
|
|
"email": "jane.smith@example.com"
|
|
}
|
|
},
|
|
"response": {
|
|
"status": 201,
|
|
"headers": {
|
|
"Content-Type": "application/json; charset=utf-8",
|
|
"Location": "/users/456"
|
|
},
|
|
"body": {
|
|
"id": 456,
|
|
"name": "Jane Smith",
|
|
"email": "jane.smith@example.com"
|
|
}
|
|
},
|
|
"providerStates": [
|
|
{
|
|
"name": "The user service is available"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"pactSpecification": {
|
|
"version": "3.0.0"
|
|
}
|
|
}
|
|
} |