pact-foundation / pact-jvm

JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://docs.pact.io
Apache License 2.0
1.07k stars 473 forks source link

Java Instant is treated as Decimal during provider verfication #1778

Open danielr1996 opened 3 months ago

danielr1996 commented 3 months ago

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.

rholshausen commented 3 months ago

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

danielr1996 commented 3 months ago

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