You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is like a question but may be a bug report. Can we use refine() and transform() together for an object? The following code will throw TypeScript type errors:
import{OpenAPIRegistry,extendZodWithOpenApi}from'@asteasolutions/zod-to-openapi'import{z}from'@hono/zod-openapi'extendZodWithOpenApi(z)constuser=z.object({name: z.string(),age: z.string()}).refine((val)=>val.name||val.age,{message: 'name or age required',path: ['name','age']}).transform((data)=>data)// <--- Add .transform()constregistry=newOpenAPIRegistry()registry.registerPath({method: 'get',path: '/users/{id}',summary: 'Get a single user',request: {params: user,// <-- errorquery: user,// <-- errorbody: {content: {'application/json': {schema: user}}}},responses: {}})
@yusukebe - yes this is something that we could try and fix. If you want to open a PR - feel free to do so. If not - I will try and take a look at it in the near future.
Hi, thank you for such a great library!
This is like a question but may be a bug report. Can we use
refine()
andtransform()
together for an object? The following code will throw TypeScript type errors:This is related to the honojs/middleware#560
The text was updated successfully, but these errors were encountered: