Hi everyone, just a question is this possible to g...
# general
a
Hi everyone, just a question is this possible to generate open api based on pact contract? If so, could someone share me a link to find how does it work?
m
Hi Allen, I believe there might be converters somewhere
what are you trying to do?
a
Yep. I try to use pact to generate open api and then generate types for client side such as TS? Does this make sense? Please let me know if this is too crazy idea
m
No this doesn’t make sense at all to me, sorry 🙂
The workflow would be: 1. Client generates pact file (which requires a working API client) 2. Convert Pact to an OAS 3. Generate API Client from OAS you can see how this is nonsensical
a
cos i know 3 is absolutely doable
but I try to avoid to manually create both OAS and pact testing file. I feel like somehow they’re kind of duplication. My understanding is that OAS is abstract and pact testing file is more like a concrete example of OAS.
m
yes, but if you already have a pact file, then you already have a working client. So why do 2 and 3 if you already have one?
a
Right. If you notice, API Client is manually typed as well without 2 and 3. But I hope I can get an auto-generated API Client.
m
So it’s up to you if you want to have a typed API client generated from an OAS
1
you might like to read https://pactflow.io/blog/schemas-are-not-contracts/ for the downsides of this approach, from a contract testing perspective
a
will do. Many thanks
👍 1
Hi @Matt (pactflow.io / pact-js / pact-go), By looking at this, what do you mean by
pack + open api
? just wondering where i can find more details?
👍 1
I guess this is the one - https://pactflow.io/blog/introducing-bi-directional-contract-testing/. If so, this looks like the similar idea from

https://www.youtube.com/watch?v=-6x6XBDf9sQ

m
Yes, the core idea is identical. We wrap up that idea (and currently, even some of their tooling) into a unified workflow. so you can do it with Pact or future contract types (e.g. protobufs, graphql etc.)
1
a
nice work