pact-jvm icon indicating copy to clipboard operation
pact-jvm copied to clipboard

Java Instant is treated as Decimal during provider verfication

Open danielr1996 opened this issue 1 year ago • 2 comments

I have basically the same problem as #1754 but on the provider side. I have a consumer project that generated the following pact file

...
"response": {
        "body": {
          "id": "421b1b7a-d651-4821-89a6-5dc588cf3cc5",
          "state": "QUEUED",
          "submitted": "2024-03-14T12:11:14Z"
        },
        "headers": {
          "Content-Type": "application/json"
        },
        "status": 201
      }
...

Verifying the provider gives me the following error:

1.1) body: $.submitted Expected 1710418274.000000000 (Decimal) to be equal to '2024-03-14T12:11:14Z' (String)

The expected value is the unix epoch representation of that Instant, but why does pact expect that? I manually called the API and it actually returns the value as string.

danielr1996 avatar Mar 16 '24 23:03 danielr1996

Can you provide the debug logs from your test and the actual request from the provider?

rholshausen avatar Mar 26 '24 04:03 rholshausen

Sorry for the late answer, since I tried using pact at work we implemented the feature without pact and moved on to other things, so it might take a while, but I will try to provide more details after the Easter holiday

danielr1996 avatar Mar 29 '24 00:03 danielr1996