ismailkombe
2025-05-19 09:35
hey guys, we as company are trying to implement BDCT and now are building the first prototype.
This prototype will be used in demo and I wanna cover all first day scenarios such as happy path, broken contract etc.
here I have question :
consumer contract:
```"header": {
"Content-Type": {
"matchers": [
{
"match": "regex",
"regex": "application/json(;\\s?charset=.*)?"
}
],
"combine": "AND"
}
},
"body": {
"$.items": {
"matchers": [
{
"match": "type",
"min": 1
}
]
},
"$.items[*].id": {
"matchers": [
{
"match": "type"
},
{
"match": "notEmpty"
},
{
"match": "regex",
"regex": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
}
]
},
"$.items[*].name": {
"matchers": [
{
"match": "type"
},
{
"match": "notEmpty"
}
]
},
"$.items[*].isActive": {
"matchers": [
{
"match": "type"
}
]
},
"$.totalCount": {
"0": {
"match": "notEmpty"
},
"matchers": [
{
"match": "type"
}
]
}
}
}```
relevant part of provider oas :
```"paths": {
"/api/internal/services": {
"get": {
"tags": ["Service"],
"summary": "Returns list of the services",
"consumes": [],
"produces": [],
"schemes": [],
"deprecated": false,
"description": "Returns list of the services; ",
"security": [{ "Bearer": [] }],
"responses": {
"200": {
"schema": {
"$ref": "#/definitions/ExtraServiceList",
"required": [],
"type": "string"
},
"description": "OK"
},
"400": { "description": "Bad request" },
"default": {
"schema": { "required": [], "type": "object" },
"description": ""
}
}
},
"parameters": []
},
"ExtraServiceList": {
"required": [],
"type": "object",
"properties": {
"items": {
"required": [],
"type": "array",
"items": {
"$ref": "#/definitions/ExtraServiceItem",
"required": [],
"type": "string"
}
},
"fake": { "required": [], "example": 1, "type": "integer" }
}
},
"ExtraServiceItem": {
"required": [],
"type": "object",
"properties": {
"id": {
"format": "uuid",
"required": [],
"example": "67e024e7-a261-445e-a362-71442731bfa4",
"type": "string",
"description": "Service id"
},
"name": {
"required": [],
"example": "Curb",
"type": "string",
"description": "Service name"
},
"isActive": { "required": [], "example": true, "type": "boolean" }
}
},```
now I wanna simulate the case where provider removes some details and it causes incompatibility with consumer pact and I remove items object entirely. but the Pact UI says it is compatible and I can deploy this version.
can anyone help me please. I'm ready for providing more details even in huddle. Thanks in advance