pact-js icon indicating copy to clipboard operation
pact-js copied to clipboard

Add GraphQL to V3 and V4 types

Open mefellows opened this issue 1 year ago • 6 comments

See https://pact.canny.io/feature-requests/p/v3-support-for-graphql-interactions, and for some code snippets that could be pulled into the change.

Given how simple the code is (wrapper for the interaction type), I'm currently wary of adding it into the core code base and would like to consider the implications of doing so over a little further.

mefellows avatar May 15 '23 00:05 mefellows

My view is that adding it in is a strict improvement, as it makes the Pact-JS API consistent - where there's no difference between the V2 and V3/4 feature set.

My longer-term view is: for feature-parity with other languages, either neither graphql function should be in pact-js, OR the graphql wrapper should be in all the languages.

TimothyJones avatar May 15 '23 03:05 TimothyJones

Gist of how to do this here: https://gist.github.com/wabrit/2d1e1f9520aa133908f0a3716338e5ff

mefellows avatar Jul 12 '23 00:07 mefellows

Is this still on the roadmap? I'm currently looking into using Pact for my team. We use almost exclusively GraphQL, and at the moment it is a bit messy to get it to work. I would like to use V3, but a lot of the examples (TypeScript example, blog post about GraphQL in Pact) are about Pact (pre-V3). But the rest of the docs are about V3, so it doesn't seem that pre-V3 is generally encouraged/supported...

JJ-Kamminga avatar Nov 27 '23 16:11 JJ-Kamminga

It's just sugar on top of the HTTP API, so you don't need the graphql interface to achieve GraphQL Testing. We would happily accept a PR though.

This being said, it's generally safe to use the pre-V3 interface in this scenario.

mefellows avatar Nov 28 '23 05:11 mefellows

This issue has been linked to a Canny post: V3 support for GraphQL interactions :tada:

canny[bot] avatar Jun 26 '24 13:06 canny[bot]

See https://github.com/pact-foundation/roadmap/issues/94 for a feature request to build a native GraphQL plugin using the pact plugin framework, which would be probably be the preferred approach as it would allow other pact libraries to benefit, rather than the syntactic sugar that the graphql interface pact-js provided

YOU54F avatar Jun 26 '24 13:06 YOU54F