Gueorgui
08/09/2022, 10:48 AMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
extractPayload
in the matchers package lets you do this (it removes any matching rules and gives you the raw JSON.Gueorgui
08/09/2022, 12:44 PMextractPayload
. Thanks Matt!Matt (pactflow.io / pact-js / pact-go)
Gueorgui
08/11/2022, 11:12 AMextractPayload
has made my life much easier overall. We were going to upgrade to 10.x but if not having extractPayload
available seems like a solid reason to hold back. Is there any alternatives in 10.x?Matt (pactflow.io / pact-js / pact-go)
Gueorgui
08/11/2022, 11:49 AMMatt (pactflow.io / pact-js / pact-go)
extractPayload
function: https://github.com/pact-foundation/pact-js/blob/c0f3d37b3a1f1843d4e92182b388bfe23d95e5c8/src/dsl/matchers.ts#L290-L309
It just needs one here (10.x.x): https://github.com/pact-foundation/pact-js/blob/master/src/v3/matchers.ts
If you’re up for writing that, it would be ace.
Please also call the new function reify
and type alias it as extractPayload
(or maybe we don’t bother keeping both, and add it to the upgrade guide?)
Reify is the term used in other parts of the project and it has been pointed out we should make that consistentGueorgui
08/11/2022, 1:09 PMGueorgui
08/11/2022, 1:09 PMexport function isMatcher(x: AnyTemplate): x is Matcher<AnyTemplate> {
return x != null && (x as Matcher<AnyTemplate>).getValue !== undefined;
}
what is this x is Matcher<AnyTemplate>
?Gueorgui
08/11/2022, 1:16 PM