tRPC client from swagger
I have a backend that is written using FastAPI, and it is already quite large and utilizes unique technologies. I would like to use tRPC in my create-t3-app, but I haven't been able to find a solution for generating a tRPC client from a swagger API through my research. I am unsure if this is even possible. I would greatly appreciate any help or suggestions on how to proceed.
8 Replies
Due to the nature of it i dont think an automatic generator can be made (without a huge amount of time to create it)
it should be pretty easy to manually convert it though
how "quite large" is it?
About 80-100 endpoints
So rewriting every endpoint and calling
fetch(...)
inside of it would take quite long.are the swagger endpoints already typed? (like what the inputs are, what the outputs are; i'm not asking if you've typed them on a keyboard lol)
wdym?
a trpc endpoint needs to know what types the inputs are, and what type the output is
does that information already exist on the swagger endpoints?
Yes
Example:
In json it looks like this: