Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:23:04 +08:00
commit 28231b02c2
12 changed files with 834 additions and 0 deletions

View File

@@ -0,0 +1,93 @@
{
"_comment": "Pact Consumer Contract Template",
"consumer": {
"name": "MyConsumer"
},
"provider": {
"name": "MyProvider"
},
"interactions": [
{
"_comment": "Example Interaction - GET request",
"description": "a request to get a product",
"request": {
"method": "GET",
"path": "/products/123",
"headers": {
"Accept": "application/json"
},
"_comment": "Optional: Query parameters"
"query": ""
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json; charset=utf-8"
},
"body": {
"id": 123,
"name": "Example Product",
"description": "A sample product for testing purposes",
"price": 25.99,
"inStock": true,
"_comment": "Optional: Matchers for flexible validation"
"_matchers": {
"$.id": {
"match": "type"
},
"$.price": {
"match": "decimal"
}
}
}
},
"providerStates": [
{
"name": "Product 123 exists",
"_comment": "Optional: Define state setup for provider"
"params": {
"productId": 123
}
}
]
},
{
"_comment": "Example Interaction - POST request",
"description": "a request to create a new product",
"request": {
"method": "POST",
"path": "/products",
"headers": {
"Content-Type": "application/json"
},
"body": {
"name": "New Product",
"description": "A new product to be created",
"price": 10.00
}
},
"response": {
"status": 201,
"headers": {
"Content-Type": "application/json; charset=utf-8"
},
"body": {
"id": 456,
"name": "New Product",
"description": "A new product to be created",
"price": 10.00
}
},
"providerStates": [
{
"name": "The system is in a valid state to create products"
}
]
}
],
"metadata": {
"pactSpecification": {
"version": "3.0.0"
}
}
}