Skip to content

Instantly share code, notes, and snippets.

@francislobo
Created May 10, 2021 01:28
Show Gist options
  • Save francislobo/e85f651bb7dabe759f310c3b387c691b to your computer and use it in GitHub Desktop.
Save francislobo/e85f651bb7dabe759f310c3b387c691b to your computer and use it in GitHub Desktop.
pact from jvm
{
"provider": {
"name": "theProvider"
},
"consumer": {
"name": "theConsumer"
},
"interactions": [
{
"description": "a POST request to copy stuff",
"request": {
"method": "POST",
"path": "/api/client/13***EE/copy",
"matchingRules": {
"path": {
"matchers": [
{
"match": "regex",
"regex": "/api/client/[A-Z0-9]+/copy"
}
],
"combine": "AND"
}
}
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json; charset=UTF-8"
},
"body": {
"data": {
"copiedData": {
"TestKey": {
"name": "string",
"mailingId": "string"
}
}
}
},
"matchingRules": {
"body": {
"$.data.copiedData.*": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.data.copiedData.*.mailingId": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.data.copiedData.*.name": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
}
},
"header": {
"Content-Type": {
"matchers": [
{
"match": "regex",
"regex": "application/json(;\\s?charset=[\\w\\-]+)?"
}
],
"combine": "AND"
}
}
},
"generators": {
"body": {
"$.data.copiedData.*.mailingId": {
"type": "RandomString",
"size": 20
},
"$.data.copiedData.*.name": {
"type": "RandomString",
"size": 20
}
}
}
},
"providerStates": [
{
"name": "logged in"
}
]
}
],
"metadata": {
"pactSpecification": {
"version": "3.0.0"
},
"pact-jvm": {
"version": "4.0.10"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment