I'm new to Pact and I am trying to verify a pact on provider side using pact-python but some matching rules are getting ignored.
WARN: Ignoring unsupported matching rules {"$.num_issues"=>{"matchers"=>[{"match"=>"integer"}], "combine"=>"AND"}, "$.error"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.response[0].issue_id"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.response[0].msg"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.response[0].similar_fix_found"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.response[1].issue_id"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.response[1].msg"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}, "$.response[1].similar_fix_found"=>{"matchers"=>[{"match"=>"type"}], "combine"=>"AND"}} for path ['body']
Consumer is Java based API and Provider is a Python based API.
"body": {
"$.num_issues": {
"matchers": [
{
"match": "integer"
}
],
"combine": "AND"
},
"$.error": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.response[0].issue_id": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.response[0].msg": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.response[0].similar_fix_found": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.response[1].issue_id": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.response[1].msg": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
},
"$.response[1].similar_fix_found": {
"matchers": [
{
"match": "type"
}
],
"combine": "AND"
}
}
}
}
}
],
"metadata": {
"pact-specification": {
"version": "3.0.0"
}
}
Changing the pact-specification version to 2.0.0 by hand also didn't work as required.
Can anyone suggest something..?
You need to explicitly set the specification version in the Java consumer test.
For example, in a JUnit test you can do it like so:
@PactTestFor(providerName = "pactflow-example-provider-java-kafka", providerType = ProviderType.ASYNCH, pactVersion = PactSpecVersion.V2)
The matchers and structure of the pact file differs based on the version, so just changing the version in the pact after won't help.