Hi everyone! I have a antoher question :slightly_...
# pact-js
b
Hi everyone! I have a antoher question 🙂 Is it possible to introduce contract testing for a third-party API when the provider doesn't offer an OpenAPI (OAS) schema that could serve as the contract ? In my case, the third-party API exposes a GraphQL schema: https://prismatic.io/docs/api/#prismatics-graphql-schema Are there any recommended techniques or patterns for applying contract testing in such scenarios—especially when using paid version of Pactflow? Would love to hear how others have approached similar challenges!
b
The docs are pretty conclusive on this: you need an OAS as the provider contract, at least at the moment (no ideas about future plans) - https://docs.pactflow.io/docs/bi-directional-contract-testing/provider
✅ 1
Google served me this, maybe that's useful in your situation? https://github.com/schwer/graphql-to-openapi Note that I've not tested this, and the project doesn't seem to be too active..
interesting 1
b
I was trying to use it some time ago.
Wanted to leave it as last option 😄
b
That is understandable, but AFAIK right now there's no 'Pact-native' support for GraphQL schemas in BDCT
b
OK, thanks for answer, thought that maybe there are some plans 🙂
b
That could be, I haven't heard of any, but I'm not a part of the Pact team.
✅ 1
thank you 1
y
We would like to add gql to BDCT but it is aspirational at the moment https://github.com/pactflow/roadmap/issues/53 users can utilise pact graphql convenience wrappers in some languages (pact-go/pact-js) to generate consumer contracts and validate with regular CDCT (pact provider verification) There is an alternative approach with the pact plugin framework in developing your own gql aware plugin. I responded recently to the state of gql in pact-js recently in this thread https://pact-foundation.slack.com/archives/C0135EDRC4R/p1755697061732339
Thanks for the additional input @Bas Dijkstra. blobwave @boden winkel - It would be great to understand your level of usage of graphql, if you have been able to use any of the alternative approaches, and as we develop graphql capabilities we can keep you in the loop for help provide design input and testing. You are also more than welcome to help aid the journey 🙂
🧡 3
ahh its a third party api, well that muddies the waters for the provider side verification. our new open source tool for the BDCT comparisons is https://github.com/pactflow/openapi-pact-comparator it may serve as inspiration to add a gql aware component to compare your pact -> gql doc. it aided me in building out a poc for asyncapi bdct support https://github.com/YOU54F/pact-asyncapi-comparator