drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: Add createSchemaFactory to drizzle-valibot

Open
#6,212 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Feature hasn't been suggested before.

- [x] I have verified this feature I'm about to request hasn't been suggested before.

### Describe the enhancement you want to request

`drizzle-zod` and `drizzle-typebox` both export `createSchemaFactory`, but `drizzle-valibot` does not. This makes it harder to move between the validator packages and leaves no way to configure type coercion for Valibot schemas.

I propose adding the same factory to `drizzle-valibot`:

```ts
import { createSchemaFactory } from 'drizzle-valibot';

const { createSelectSchema, createInsertSchema, createUpdateSchema } = createSchemaFactory({ coerce: true });
```

Valibot has no global coerce option like Zod, but the factory can generate transform pipes for the affected columns instead. I am the author of Valibot and happy to open a PR if you are interested in this.

Contributor guide

Open the contributing guide

Research direction

Start by comparing the existing createSchemaFactory APIs in drizzle-zod and drizzle-typebox with the current drizzle-valibot schema creators. Trace how Valibot schemas handle affected columns and determine how the coerce option should generate transform pipes. Done means drizzle-valibot exports createSchemaFactory with the three requested schema creators and supports the shown coerce configuration consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.