V3 support for GraphQL interactions
closed
Jacek Maciag
I want to use Pact-JS V3 version with GraphQL operations testing. It offers interesting new features, such as multiple provider states, provider state params, etc. The V3 is still in beta so addmitedly not all features are available as of yet. However, I have not found any mention of V3 support for GraphQL operations.
The previous Pact version (V2) had a GraphQLInteraction object which expanded the standard Interaction. That does not seem to work anymore with V3.
So far I searched for an answer or an example here:
Perhaps I missed something. Do you know if this is currently supported? If not, when?
Do you have any example of PactV3 setup with GraphQL?
Yousaf Nabi
closed
Tracking via
https://github.com/pact-foundation/pact-js/issues/1093
tpaktop
Made another example https://gist.github.com/Maxim-Filimonov/2160a24ade1073786540559441fe01e4 takes existing apollo interaction and converts it to to V3
Matt Fellows
Thanks Jacek. I've been thinking about the V3 API and whether or not the GraphQL interface should be separated from Pact JS itself or part of the library. The previous API was just a thin layer over the Interaction class, so there is no good reason it couldn't be external to Pact JS (this also means you could look at and steal the code quite easily should you need it right now).
Alan Boshier
Matt Fellows: I've implemented a thin layer over V3 to support the GraphQL DSL; happy to share code or (given some assistance) create a PR if that helps. It works for me but I'm not sure its of acceptable quality to include in the official codebase.
Matt Fellows
Alan Boshier: Amazing! definitely happy to take a look as a starting point. If it's valuable to you, it'll probably be evaluable to others and we can expand from there.
Alan Boshier
Matt Fellows: No problem - its basically a single (fairly short) file; what's the best way of sharing with you?
Yousaf Nabi
Alan Boshier: Hey dude, you can create a github gist is usually a decent way to share a single file, or a collection of files without sub-directories
You can fork and clone them too, which makes them very good for collaboration
Alan Boshier
Yousaf Nabi: thanks!