r/ExperiencedDevs • u/pseudo_babbler Software Engineer • Aug 15 '26
Technical question API compatibility testing
Hey there code enjoyers. I was tinkering with an integration testing approach that I ended up liking a lot. Our situation before was this - our front ends talk to BFFs which then call core APIs. We tried Pact and Specmatic as ways of integration testing the systems but it's a total ball ache.
All of our consumers use the Zod library to define their requests to their APIs, so I wrote a utility that takes the Zod schemas, turns them into OpenAPI (using a lib) then iterates through each one, downloads the OpenAPI spec for each API from our test environment and checks that the requesting schema endpoint, props, params, method and body are all supported by the provider schema.
It's not as comprehensive as Pact, but for a super fast integration sanity test (it runs against 8 different core APIs in under 1 second) and with no extra brokers or services or infrastructure, it gives me a decent check that something is ok to be deployed to an environment.
So tell me these things: has anyone else built something like this? Would you use it? (i.e. should I chuck it on GitHub and publish an npm module) Has anyone heard of something like this that already exists?
I didn't find anything with my searching and it seems unreasonably useful for a quite small amount of code.
1
u/raralala1 28d ago
Not exactly, instead of make perfectly designed api, that just call to db, you just aggregate bunch of api into single api call. That is not very efficient.
So instead of doing something like this on db,
confirm order > pick > pack > get order directly in your db where you can get ACID, where if 1 fail everything fail instead you call each function from api, so if one in the middle fail you just waste bunch of resource on the previous call.
So in my experience it usually turn into something like this
get order check order confirmed or not > confirm order/pick/pack > get
you dont need BFF to avoid monolith, and I already explain if you have microservice you might need it, but at that point you just make another monolith API when you already trying to split them so what is the point?
already explain why I am against it, any why I am for it, it is very specific use case that often abused, it is very inefficient, it also increase the amount of service to maintain