From 009cc77cf5927230ef76b17770616b506f39aaef Mon Sep 17 00:00:00 2001 From: Sor4chi <80559385+sor4chi@users.noreply.github.com> Date: Fri, 29 Dec 2023 04:25:02 +0900 Subject: [PATCH] docs: replace jsonT with json (#328) --- packages/zod-openapi/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/zod-openapi/README.md b/packages/zod-openapi/README.md index e592d582..24ab9972 100644 --- a/packages/zod-openapi/README.md +++ b/packages/zod-openapi/README.md @@ -88,7 +88,7 @@ const app = new OpenAPIHono() app.openapi(route, (c) => { const { id } = c.req.valid('param') - return c.jsonT({ + return c.json({ id, age: 20, name: 'Ultra-man', @@ -157,7 +157,7 @@ app.openapi( route, (c) => { const { id } = c.req.valid('param') - return c.jsonT({ + return c.json({ id, age: 20, name: 'Ultra-man', @@ -166,7 +166,7 @@ app.openapi( // Hook (result, c) => { if (!result.success) { - return c.jsonT( + return c.json( { code: 400, message: 'Validation Error', @@ -186,7 +186,7 @@ In the case that you have a common error formatter, you can initialize the `Open const app = new OpenAPIHono({ defaultHook: (result, c) => { if (!result.success) { - return c.jsonT( + return c.json( { ok: false, errors: formatZodErrors(result), @@ -205,7 +205,7 @@ You can still override the `defaultHook` by providing the hook at the call site // uses the defaultHook app.openapi(createPostRoute, (c) => { const { title } = c.req.valid('json') - return c.jsonT({ title }) + return c.json({ title }) }) // override the defaultHook by passing in a hook @@ -213,11 +213,11 @@ app.openapi( createBookRoute, (c) => { const { title } = c.req.valid('json') - return c.jsonT({ title }) + return c.json({ title }) }, (result, c) => { if (!result.success) { - return c.jsonT( + return c.json( { ok: false, source: 'routeHook' as const, @@ -279,7 +279,7 @@ import { hc } from 'hono/client' const appRoutes = app.openapi(route, (c) => { const data = c.req.valid('json') - return c.jsonT({ + return c.json({ id: data.id, message: 'Success', })