Skip to content

Instantly share code, notes, and snippets.

@dallagi
Created September 7, 2020 10:28
Show Gist options
  • Save dallagi/fb5bb1a9c01d14a468e9d180d99bcf14 to your computer and use it in GitHub Desktop.
Save dallagi/fb5bb1a9c01d14a468e9d180d99bcf14 to your computer and use it in GitHub Desktop.
Example of pact-message file
{
"consumer": {
"name": "billing-service"
},
"provider": {
"name": "checkout-service"
},
"messages": [
{
"description": "an order to export",
"metaData": {
"contentType": "application/json"
},
"contents": {
"emittedAt": "2000-01-31T14:00:00.000+01:00",
"customerId": "230542",
"items": [
{
"price": 512
},
{
"price": 512
}
]
},
"matchingRules": {
"body": {
"$.customerId": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.emittedAt": {
"matchers": [
{
"match": "timestamp",
"timestamp": "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"
}
],
"combine": "AND"
},
"$.items": {
"matchers": [
{
"match": "type",
"min": 0
}
],
"combine": "AND"
},
"$.items[*].price": {
"matchers": [
{
"match": "number"
}
],
"combine": "AND"
}
}
}
},
{
"description": "another order to export",
"metaData": {
"contentType": "application/json"
},
"contents": {
"customerId": "230567",
"items": [
{
"price": 512
},
{
"price": 512
}
]
},
"matchingRules": {
"body": {
"$.customerId": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.items": {
"matchers": [
{
"match": "type",
"min": 0
}
],
"combine": "AND"
},
"$.items[*].price": {
"matchers": [
{
"match": "number"
}
],
"combine": "AND"
}
}
}
}
],
"metadata": {
"pactSpecification": {
"version": "3.0.0"
},
"pact-jvm": {
"version": "4.1.7"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment