pact-foundation / pact-reference

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

How do you pass an Integration JSON object for `eachValue` matcher? #299

Closed mefellows closed 1 year ago

mefellows commented 1 year ago

The docs (in file rust/pact_matching/src/lib.rs) for the EachKey and EachValue matchers mention the following:

//! | EachKey | V4 | { "match": "eachKey", "rules": [{"match": "regex", "regex": "\\$(\\.\\w+)+"}], "value": "$.test.one" } | Allows defining matching rules to apply to the keys in a map | //! | EachValue | V4 | { "match": "eachValue", "rules": [{"match": "regex", "regex": "\\$(\\.\\w+)+"}], "value": "$.test.one" } | Allows defining matching rules to apply to the values in a collection. For maps, delgates to the Values matcher. |

It is unclear as to how an FFI user can pass a matching rule definition across the boundary to matching the values of keys in this object:

{
   "unknown key 1": "string value",
   "unknown key 2": "another string"
}

e.g. this gets the correct structure to come out the other side, but no matching rules get serialised

{
  "pact:matcher:type": "eachValue",
  "value": {
    "key1: "example string",
  },
  "rules": [.../* matching rules */],
}

Related issues

github-actions[bot] commented 1 year ago

👋 Hi! The 'smartbear-supported' label has just been added to this issue, which will create an internal tracking ticket in PactFlow's Jira (PACT-1172). We will use this to prioritise and assign a team member to this task. All activity will be public on this ticket. For now, sit tight and we'll update this ticket once we have more information on the next steps.

See our documentation for more information.

mefellows commented 1 year ago

Fixed in 0.4.7 of the FFI. Closing.