Merge branch '1.1.x'

This commit is contained in:
Marcin Grzejszczak
2017-09-05 14:19:19 +02:00
2 changed files with 8 additions and 8 deletions

View File

@@ -269,7 +269,7 @@ class PactContractConverter implements ContractConverter<Pact> {
protected Map<String, Map<String, Object>> matchingRules(BodyMatchers bodyMatchers) {
return bodyMatchers.jsonPathMatchers().collectEntries {
MatchingType matchingType = it.matchingType()
String key = it.path()
String key = "\$.body${it.path().startsWith('$') ? it.path().substring(1) : it.path()}"
Object value = it.value()
Integer minTypeOccurrence = it.minTypeOccurrence()
Integer maxTypeOccurrence = it.maxTypeOccurrence()

View File

@@ -151,11 +151,11 @@ class PactContractConverterSpec extends Specification {
"something": "foo"
},
"matchingRules": {
"$.id": {
"$.body.id": {
"match": "regex",
"regex": "[0-9]{3}"
},
"$.something": {
"$.body.something": {
"match": "equality"
}
}
@@ -176,22 +176,22 @@ class PactContractConverterSpec extends Specification {
]
],
"matchingRules": {
"$[0][*].email": {
"$.body[0][*].email": {
"match": "type"
},
"$[0][*].id": {
"$.body[0][*].id": {
"match": "regex",
"regex": "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
},
"$[0]": {
"$.body[0]": {
"match": "type",
"min": 1,
"max": 5
},
"$[0][*].userName": {
"$.body[0][*].userName": {
"match": "type"
},
"$[0][*].something": {
"$.body[0][*].something": {
"match": "equality"
}
}