pact-foundation / pact-reference

Reference implementations for the pact specifications
https://pact.io
MIT License
91 stars 46 forks source link

Feature: Rust implementation of DateTime Expressions #180

Closed surpher closed 2 years ago

surpher commented 2 years ago

When writing consumer tests in a Pact implementation that uses rust-core for mock server I want to be able to define date time expressions So that the generators inform the provider verification how/with what to verify a specific DateTime value

This refers to: https://pactflow.io/blog/dealing-with-relative-dates-in-contract-tests/

Given a pact where the response should be:

{
 "id": "321",
 "start": "today +1 day @ 6 o'clock pm"
}

note: I'm not sure about the above though as I just copy pasted from the pact implementation issue board. I would imagine the "start" value would need to be in the provided "format"?

Example Pact output:

"generators": {
 "body": {
  "$.start": {
   "type": "DateTime",
   "format": "yyyy-MM-dd'T'HH:mm:ss'Z'",
   "expression": "today +1 day @ 6 o'clock pm"
  }
 }
}

Related to: https://github.com/DiUS/pact-consumer-swift/issues/128

surpher commented 2 years ago

Pulled the libpact_ffi-v0.2.3 into PactSwift successfully. Closing and considering implemented 👍