Where is the doc for matchers formats located? I t...
# general
t
Where is the doc for matchers formats located? I think I can't find it. I'm looking for something like this: • v2: `"name": { "contents": "rover", "json_class": "Pact::SomethingLike" }, "type": { "data": { "generate": "bulldog", "matcher": { "json_class": "Regexp", "o": 0, "s": "bulldog|sheepdog" } }`https://docs.pact.io/slack/pact-message-ruby.html#1522380995.000036 • v3: `{ value: 123, 'pactmatchertype': 'type'}`https://github.com/pact-foundation/pact-js/blob/master/src/dsl/matchers.ts I think the
matchers
in https://github.com/pact-foundation/pact-specification/tree/version-2 and https://github.com/pact-foundation/pact-specification/tree/version-3 is something else different, not related, right? I can't find it here too https://docs.pact.io/getting_started/matching
u
Are you asking about the general format of matchers, or the specific fields for a given matcher? A lot is documentation at https://github.com/pact-foundation/pact-specification/tree/version-3, but I don't think the V2 format was properly documented
The V2 format you posted above is a Ruby specific encoding of Ruby classes to JSON
The V3 example is the integration JSON used between language implementations using Pact FFI
I don't think we have formally documented that format, but it is the same as what the V3 spec documents with the exception the type of the matcher is encoded in the
pact:matcher:type
attribute.
b
From a more fundamental level, though, unless you're writing an implementation of a Pact lib, it should be fine for the JSON format to be opaque. Is that what you're doing? šŸ¤”
t
Yes, I'm working on updating pact-php. I'm looking for doc that help me update this code https://github.com/pact-foundation/pact-php/blob/master/src/PhpPact/Consumer/Matcher/Matcher.php to this code https://github.com/pact-foundation/pact-js/blob/master/src/dsl/matchers.ts I can blindly follow pact-js. A doc about
pact:matcher:type
would be nice to have for me.
šŸ’Æ 2
b
ah ok, that makes sense, then šŸ˜Ž
u
Yeah, I need to document that format, it came out of the implementation of moving Pact-JS over to the FFI libs. Anyone else using the FFI libs will need to know how to construct those.
t
A doc about pactmatchertype would be nice to have for me.
I would love the documentation for this (and the overall pact file format in general). It would be great for building tooling that compares pact files, for instance
šŸ‘Œ 1
For example, you could determine if your contract is a subset of another consumers contract
šŸ‘Œ 1
provider teams could use this (along with their own pact tests) to provide provider contracts that you could verify consumer side: • Provider writes pact using a mock client, and verifies it • Consumer writes pact using their real client, and compares their outputted pact file to the verified pact. If it is a subset of the verified pact, you're good
chefkiss 1