-
-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected "timestamp" matchingRule in json file instead of "date" #1617
Comments
Are you able to provide an example Pact file that has this problem? |
Tested with au.com.dius.pact.core:model:4.3.16, using a V4 Pact I think the bug occurs during serialization. According to the spec the DateMatcher should be serialized as:
But actualy it serializes to:
See here: pact-jvm/core/model/src/main/kotlin/au/com/dius/pact/core/model/matchingrules/MatchingRules.kt Line 238 in 000976e
When the Pact file gets deserialized (e.g., to merge the existing interactions with a new interaction) and the machting rules get parsed, it expects the 'format' field to be present: pact-jvm/core/model/src/main/kotlin/au/com/dius/pact/core/model/matchingrules/MatchingRules.kt Line 122 in 000976e
Because of the serialization error it gets deserialized as TimestampMatcher. |
@bit-jkraushaar Exactly thats what I observed. |
Damn, I thought this had been fixed. |
/jira create |
👋 Thanks, Jira [PACT-446] ticket created. |
… formatted date/time matchers #1617
… formatted date/time matchers #1617
MatchingRules.kt parses the json content unexpectedly from date to timestamp.
Since commit: 0596ce7
This process happens only if you have more than one pact on consumer side. All pacts but the last one are incorrect (The last one wont be deserialized)
For some reason there is this new "format" value that is missing on pact serialization but is required for deserialization to get the correct class type.
Same seems to be true for TimeMatcher.
It is broken between line 111 to 122
https://github.com/pact-foundation/pact-jvm/blame/0596ce7bdbf0f1984e99920514c58953565295bd/core/model/src/main/kotlin/au/com/dius/pact/core/model/matchingrules/MatchingRules.kt#L111
Expected behaviour: Time and Date types are correctly handled and deserialized, as well as serialized
The text was updated successfully, but these errors were encountered: