jlalmes / trpc-openapi

OpenAPI support for tRPC 🧩
https://www.npmjs.com/package/trpc-openapi
MIT License
2.23k stars 152 forks source link

trpc 11 #434

Open marc-on-github opened 10 months ago

marc-on-github commented 10 months ago

warning " > trpc-openapi@1.2.0" has incorrect peer dependency "@trpc/server@^10.0.0".

Is an update planned?

Tatamo commented 9 months ago

+1 trpc v11 has not been officially released yet, but I would be very happy if trpc-openapi could be used together with trpc@next.

ethndotsh commented 9 months ago

+1, Really need this

zzzev commented 9 months ago

This patch-package patch makes trpc-openapi work w/ trpc@11 for my app -- I'm sure this doesn't account for everything, but may be useful for others looking for a short-term fix: trpc-openapi+1.2.0.patch

ethndotsh commented 9 months ago

This patch-package patch makes trpc-openapi work w/ trpc@11 for my app -- I'm sure this doesn't account for everything, but may be useful for others looking for a short-term fix: trpc-openapi+1.2.0.patch

Yup this worked for me! Thank you.

crwnd commented 9 months ago

With dependency override in package.json:

"overrides": {
  "trpc-openapi": {
    "@trpc/server": "^11.0.0-next-beta.289"
  }
}
tdanh2k commented 8 months ago

+1 Love to see this soon

kdy1 commented 3 months ago

I forked it for now.

https://github.com/kdy1/trpc-openapi

npm package: better-trpc-openapi

I applied the patch by @zzzev

flawnn commented 2 months ago

I forked it for now.

kdy1/trpc-openapi

npm package: better-trpc-openapi

I applied the patch by @zzzev

⨯ TypeError: Cannot read properties of undefined (reading 'trpc')
    at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/better-trpc-openapi@0.1.0_@trpc+server@11.0.0-rc.502_zod@3.23.8/node_modules/better-trpc-openapi/dist/adapters/next.js:12:30)

Getting the following error - couldn't see an Issues tab on your fork, hence here

deldrid1 commented 2 months ago

In case its helpful to anyone, I ended up forking better-trpc-openapi and fixing quite a few more things. PR is https://github.com/kdy1/trpc-openapi/pull/2

I'm currently using it like this in my package.json with pnpm

    "better-trpc-openapi": "github:deldrid1/trpc-openapi#a99adb49e8e7c9304aa2988b425d36957d99fc53",

(Make sure you grab the latest commit SHA from https://github.com/deldrid1/trpc-openapi if you want the latest code)

chrisdobler commented 2 months ago

Hey @deldrid1 made one small pr for your fork to fix an issue with unknown errors. Seems to be working other than that. Thank you everyone! https://github.com/deldrid1/trpc-openapi/pull/1

mcampa commented 1 month ago

I also have a fork that works with tRPC 11 https://www.npmjs.com/package/trpc-to-openapi

it's been running fine with t3-app/NextJS. However, I don't use other adapters, I fixed all tests cases for everything so in theory they should work. The only thing I couldn't port was the serverless adapter, the trpc implementation changed too much.

This is a fork of another fork (https://github.com/LilyRose2798/trpc-openapi) which uses zod-openapi instead of zod-to-json-schema and some other fixes.

PR are welcomed