@drzl/generator-valibot
v3.20.5
Published
Readme
@drzl/generator-valibot
Valibot schemas from your Drizzle analysis (insert / update / select).
💚 Sponsor DRZL
DRZL is crafted nights & weekends. Sponsorships keep the generators fast, tested, and free.
- Every dollar speeds up CI hardware and offsets long test runs on my aging laptop.
- Sponsors get roadmap input and priority responses in GitHub Issues.
- Prefer a quick overview? The current goals and thank-yous are at https://use-drzl.github.io/drzl/sponsor.
Use
Add to drzl.config.ts:
generators: [{ kind: 'valibot', path: 'src/validators/valibot' }];Output
Insert<Table>Schema,Update<Table>Schema,Select<Table>Schema- Optional
indexbarrel - Shared vs inlined schemas supported
constraints.tsunderconstraints: true: every CHECK, unique constraint, primary key and foreign key on each table as plain data, plusconstraintForIssue, which maps a validation issue back to the constraint that caused it. Off by default. See the Constraint Data page.
Custom names
affix renames the exported schemas and type aliases, and tableCase: 'pascal' upper-camels
the Drizzle export name (users -> Users) instead of interpolating it verbatim. Omit it and
the names above are unchanged.
generators: [
{
kind: 'valibot',
path: 'src/validators/valibot',
affix: {
tableCase: 'pascal',
schema: { suffix: 'Schema' },
type: {
prefix: { insert: 'Create', update: 'Edit', select: '' },
suffix: { insert: 'Input', update: 'Input', select: '' },
},
},
},
];Emits InsertUsersSchema / UpdateUsersSchema / SelectUsersSchema plus CreateUsersInput,
EditUsersInput and a bare Users. Every prefix and suffix takes a string or a per-mode
object keyed by insert, update, select. The legacy schemaSuffix still works and is the
default for affix.schema.suffix.
