Open SandorArpa opened 2 years ago
I've tested this with the latest version (4.3.12), and it works correctly. I've noticed your Pact file has "pact-jvm": { "version": "3.6.15" }
, is that the version you are using (3.6.15)?
Yes, we are on 3.6.15
Can you upgrade? That version is not supported anymore, and the supported versions do not have this issue.
We have a pact test where one of the variables is a negative number (MessagePactBuilder generated file):
{ "consumer": { "name": "ledger" }, "provider": { "name": "connector" }, "messages": [ { "_id": "c3d524ebb49c46e1e8b100a94d9c880b6a0cc43b", "description": "a dispute lost event", "metaData": { "contentType": "application/json" }, "contents": { "event_type": "DISPUTE_LOST", "service_id": "service-id", "resource_type": "dispute", "event_details": { "amount": 6500, "gateway_account_id": "a-gateway-account-id", "fee": 1500, "net_amount": -8000 }, "live": true, "timestamp": "2022-01-19T07:59:20.000000Z", "resource_external_id": "payment-external-id", "parent_resource_external_id": "external-id" }, "matchingRules": { "body": { ... "$.event_details.net_amount": { "matchers": [ { "match": "integer" } ], "combine": "AND" }, "$.event_details.amount": { "matchers": [ { "match": "integer" } ], "combine": "AND" }, "$.event_details.gateway_account_id": { "matchers": [ { "match": "type" } ], "combine": "AND" }, "$.event_details.fee": { "matchers": [ { "match": "integer" } ], "combine": "AND" } } } } ], "metadata": { "pactSpecification": { "version": "3.0.0" }, "pact-jvm": { "version": "3.6.15" } }
The provider's response:
{ "resource_external_id": "resource-external-id", "event_details": { "gateway_account_id": "a-gateway-account-id", "net_amount": -8000, "amount": 6500, "fee": 1500 } ... }
The error:
BodyComparisonResult(mismatches={$.event_details.net_amount=[BodyMismatch(expected=-8000, actual=-8000, mismatch=Expected -8000 (JsonPrimitive) to be an integer, path=$.event_details.net_amount, diff=null)]}, diff=[{, - "event_type": "DISPUTE_LOST",, - "service_id": "service-id",, - "resource_type": "dispute",, + "resource_external_id": "resource-external-id",, "event_details": {, - "amount": 6500,, "gateway_account_id": "a-gateway-account-id",, - "fee": 1500,, - "net_amount": -8000, + "net_amount": -8000,, + "amount": 6500,, + "fee": 1500, },, - "live": true,, "timestamp": "2022-01-19T07:59:20.000000Z",, - "resource_external_id": "payment-external-id",, - "parent_resource_external_id": "external-id", + "parent_resource_external_id": "external-id",, + "service_id": "service-id",, + "live": true,, + "resource_type": "dispute",, + "event_type": "DISPUTE_LOST", }])
when running in IDE against a local pact file (Running with PactFolder tag on provider, using PactVerifyProvider, not State) :