Skip to content

Commit 46fe6eb

Browse files
committed
feat: remove trpc-openapi
1 parent ab54c31 commit 46fe6eb

File tree

1 file changed

+21
-25
lines changed

1 file changed

+21
-25
lines changed

src/server/trpc.ts

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import { initTRPC, TRPCError } from '@trpc/server'
1212
import superjson from 'superjson'
13-
import { type OpenApiMeta } from 'trpc-openapi'
1413
import { ZodError } from 'zod'
1514

1615
import getIP from '~/utils/getClientIp'
@@ -21,30 +20,27 @@ import { type Context } from './context'
2120
import { defaultMeSelect } from './modules/me/me.select'
2221
import { prisma } from './prisma'
2322

24-
const t = initTRPC
25-
.meta<OpenApiMeta>()
26-
.context<Context>()
27-
.create({
28-
/**
29-
* @see https://trpc.io/docs/v10/data-transformers
30-
*/
31-
transformer: superjson,
32-
/**
33-
* @see https://trpc.io/docs/v10/error-formatting
34-
*/
35-
errorFormatter({ shape, error }) {
36-
return {
37-
...shape,
38-
data: {
39-
...shape.data,
40-
zodError:
41-
error.code === 'BAD_REQUEST' && error.cause instanceof ZodError
42-
? error.cause.flatten()
43-
: null,
44-
},
45-
}
46-
},
47-
})
23+
const t = initTRPC.context<Context>().create({
24+
/**
25+
* @see https://trpc.io/docs/v10/data-transformers
26+
*/
27+
transformer: superjson,
28+
/**
29+
* @see https://trpc.io/docs/v10/error-formatting
30+
*/
31+
errorFormatter({ shape, error }) {
32+
return {
33+
...shape,
34+
data: {
35+
...shape.data,
36+
zodError:
37+
error.code === 'BAD_REQUEST' && error.cause instanceof ZodError
38+
? error.cause.flatten()
39+
: null,
40+
},
41+
}
42+
},
43+
})
4844

4945
// Setting outer context with tRPC will not get us correct path during request batching,
5046
// only by setting logger context in the middleware do we get the exact path to log

0 commit comments

Comments
 (0)