Hi, everyone. We use Bi-Directional Contract Test...
# general
o
Hi, everyone. We use Bi-Directional Contract Testing based on OAS documents. Some of our new API endpoints are implemented in GraphQL. Could you please suggest a way to integrate tests for such endpoints in our BDCT workflow? It seems most of the available documentation do not take BDCT (based on OAS) into account.
m
BDCT is a Pactflow only feature, so this is why you wouldn't have seen it anywhere in the Pact docs. Graphql is not supported in BDCT as it cannot be expressed fully as an OpenAPI document. You could use regular Pact for this though
o
Thanks for your response, @Matt (pactflow.io / pact-js / pact-go). My initial thought was to find a way to represent the GraphQL endpoint(s) in OAS/Swagger form, expecting to be able to keep writing our consumer tests in the same way as the other (non-GraphQL) ones. But I have *not* found a way to do this. So, are you suggesting that we use a hybrid flow? By hybrid, I mean BDCT for other endpoints, but consumer-driven for the GraphQL endpoint(s).
Note: We really like the BDCT approach that fits our usage model.
m
Yes, a hybrid setup is what I’m suggesting I suppose. Use BDCT where you can for providers that can be documented via an OAS. Use Pact where you can’t
GraphQL bodies can’t be expressed in an OpenAPI as far as I know. I believe it can/will be able to in an AsyncAPI document eventually