Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE]: Export factory functions from drizzle-zod to allow usage with extended Zod classes #2245

Open
juliusmarminge opened this issue May 2, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@juliusmarminge
Copy link

juliusmarminge commented May 2, 2024

Describe what you want

To allow generating schemas from an extended Zod class, such as: https://github.com/honojs/middleware/tree/main/packages/zod-openapi

Currently, this doesn't work since generated schemas are using the default z object which will cause runtime errors if later combined with .openapi() from the lib above

Something like this would be nice

import { z } from '@hono/zod-openapi'
import { createInsertSchemaFactory } from 'drizzle-zod/factories'

import { User } from '~/schema'

const createInsertSchema = createInsertSchemaFactory(z);

const InsertUser = createInsertSchema(User)

// later

InsertUser.openapi() // works
@d4mr
Copy link

d4mr commented May 12, 2024

This would be very helpful. I don't understand how people use Hono with Drizzle without this, is everyone duplicating their source of truth?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants