This repository was archived by the owner on Nov 19, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 168
express example problems out of the box #169
Comments
Please ensure you have followed the instructions in the |
@jlalmes , thanks for the answer. this "monorepo" works fine, but I don't see any instructions on how to get a working export const appRouter = t.router({
sayHello: t.procedure
.meta({ openapi: { method: 'GET', path: '/say-hello' } }) /* the property enabled is mandatory here */
.input(z.object({ name: z.string() }))
.output(z.object({ greeting: z.string() }))
.query(({ input }) => {
return { greeting: `Hello ${input.name}!` };
}); /* semicolon here breaks the code */
}); const server = http.createServer(createOpenApiHttpHandler({ router: appRouter })); /* it seems that properties `createContext, responseMeta, onError, teardown, maxBodySize` are mandatory as well, even thought that's not mentioned in the documentation */
My {
"name": "project",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "ts-node-dev --respawn --transpile-only --exit-child ./src/index.ts"
},
"dependencies": {
"@trpc/server": "^10.0.0-proxy-beta.18",
"trpc-openapi": "^0.7.0",
"zod": "^3.19.1"
},
"devDependencies": {
"ts-node": "^10.9.1",
"ts-node-dev": "^2.0.0",
"typescript": "^4.7.4"
}
} |
You must install |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
on compile there are errors about input schemas
TRPCError: [mutation.auth.register] - Input parser expects a Zod validator
also, the line
app.use('/api', createOpenApiExpressMiddleware({ router: appRouter, createContext }));
produces this errorThe text was updated successfully, but these errors were encountered: