Open mude-albij opened 4 months ago
Forked and Added support for Next.js 14. https://github.com/Vercjames/package-trpc-swagger
I don't know why i am getting this error.
i am using t3-app with next js 14 and app router.
@sutarrohit pretty sure that error happens because you're using tRPC v11. Either downgrade back to v10 (recommended if you really need the library) or you can do something like this (where you define your router):
const appRouter = router({
test: testRouter,
auth: authRouter,
});
const procedures = appRouter._def.procedures;
Object.keys(procedures).forEach((key) => {
const def = (procedures[key as keyof typeof procedures] as unknown as AnyProcedure)?._def;
// @ts-expect-error: internal API
if (def?.meta?.openapi) {
switch (def.type) {
case "query":
// @ts-expect-error: unstable support for tRPC v11
def.query = true;
break;
case "mutation":
// @ts-expect-error: unstable support for tRPC v11
def.mutation = true;
break;
case "subscription":
// @ts-expect-error: unstable support for tRPC v11
def.subscription = true;
break;
}
}
});
export { appRouter };
This is something I've been doing and it seems to work but it is in no way stable and I would not recommend running it in production.
@Pridestalkerr thanks definitely check for your solution
Greeting, I am using t3-app with next js 14 and app router. i've setup the
trpc-openapi
for OpenAPI but can't get the adapters working and is not clarified in the docs.