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
feat: mockAll coverage mode and zodmint/storybook adapter (v2.5.0)
- mockAll(schema, options?) — returns full boundary set for any schema.
Numbers: min/min+1/max-1/max. Enums: all values. Booleans: [true, false].
Optional/nullable: includes undefined/null. Union: one per branch.
Every returned value passes safeParse. Duplicates removed.
- zodmint/storybook — new sub-entry with zodArgTypes() and mockArgs().
Maps Zod types to Storybook controls (text/number/range/boolean/select/date/object).
Zero @storybook/* dependencies.
- 55 new tests (37 coverage + 18 storybook), 534 total passing
- README, CHANGELOG, ROADMAP updated
Copy file name to clipboardExpand all lines: CHANGELOG.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,27 @@ All notable changes to zodmint are documented here. This project follows [Keep a
4
4
5
5
---
6
6
7
+
## [2.5.0] - 2026-06-03
8
+
9
+
### Added
10
+
-**`mockAll(schema, options?)`** — returns the full boundary set for a schema. For numbers, generates min, min+1, max-1, max (plus 0 if in range). For enums, returns every value. For booleans, always `[true, false]`. For optionals/nullables, includes `undefined`/`null` alongside the inner type's boundary values. For unions, one value per branch. For arrays, empty/1/2-item variants plus length-constrained boundaries. Duplicates are removed. Every returned value passes `schema.safeParse(v).success === true`. Accepts the same options as `mock()` (`seed`, `session`, `generators`); the `mode` option is ignored.
11
+
-**`zodmint/storybook`** — new sub-entry with `zodArgTypes(schema)` and `mockArgs(schema, options?)`. `zodArgTypes` maps a Zod object schema to a Storybook `ArgTypes` record — string→text, number→number (range when both min and max are present), boolean→boolean, enum→select, date→date, object/array→object. `z.optional()` and `z.nullable()` are transparently unwrapped. `z.describe()` populates the `description` field. `mockArgs` is a typed wrapper around `mock()` for generating story `args`. Zero runtime dependencies — no `@storybook/*` import required.
12
+
13
+
---
14
+
15
+
## [2.4.0] - 2026-05-29
16
+
17
+
### Added
18
+
-**`zodmint/seed`** — new sub-entry for schema-driven database seeding. `seed(inserter, schema, options?)` generates `count` valid fixtures and inserts them via any async function. Returns the full array of generated items for chaining.
19
+
-**`prismaInserter(model)`** — wraps a Prisma model delegate (`createMany`) into a `SeedInserter`. Zero runtime dependency: uses duck typing, so no `@prisma/client` import is required in `zodmint/seed` itself.
20
+
-**`drizzleInserter(db, table)`** — wraps a Drizzle `db.insert(table).values()` call into a `SeedInserter`. Same approach: duck typed, no drizzle-orm import.
21
+
-**`SeedOptions`** — extends `MockOptions` with `count` (default 10), `batchSize` (default: single batch), and `async` (uses `mockAsync()` when true, for schemas with async refinements).
22
+
-**Batched inserts** — when `batchSize < count`, records are split into chunks and inserted sequentially, respecting ORM and DB row limits per statement.
23
+
-**Seeded determinism** — when a `seed` value is provided, each item receives an offset seed (`seed + i`) so items are distinct but the full result set is reproducible.
24
+
-`@prisma/client >= 5.0.0` and `drizzle-orm >= 0.29.0` added as optional peer dependencies.
Copy file name to clipboardExpand all lines: README.md
+192Lines changed: 192 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -892,12 +892,48 @@ Known gaps:
892
892
893
893
**ORM/OpenAPI ingestion** — Only makes sense after relational generation matures.
894
894
895
+
**Relational dataset DSL** — `dataset()` + `model().belongsTo()` for generating fully coherent multi-schema datasets with referential integrity. Planned for v3.
896
+
895
897
---
896
898
897
899
Zod v4 uses `new Function()` internally to compile schema validators. If your environment disables `unsafe-eval` (e.g. via CSP), stick with Zod v3.
898
900
899
901
---
900
902
903
+
## Coverage Mode — `mockAll`
904
+
905
+
`mockAll(schema, options?)` returns the full boundary set for a schema — every interesting edge case — instead of a single value. Use it to systematically exercise constraint boundaries without writing the boundary values yourself.
906
+
907
+
```typescript
908
+
import { mockAll } from"zodmint";
909
+
910
+
// Numbers: min, min+1, max-1, max (plus 0 if in range)
Every value in the returned array is guaranteed to pass `schema.safeParse(v).success === true`. Duplicates are automatically removed.
932
+
933
+
`mockAll` accepts the same options as `mock()` — `seed`, `session`, `generators` — and forwards them to any internal generation calls. The `mode` option is ignored: `mockAll` always uses boundary-aware generation.
934
+
935
+
---
936
+
901
937
## Integrations
902
938
903
939
### fast-check
@@ -1014,6 +1050,103 @@ Or add a script to `package.json`:
1014
1050
1015
1051
---
1016
1052
1053
+
### Database Seeding — `zodmint/seed`
1054
+
1055
+
zodmint ships a `zodmint/seed` sub-entry for generating and inserting bulk fixtures directly into your database. It works with any ORM via a plain async inserter function, and ships first-class adapters for Prisma and Drizzle.
1056
+
1057
+
```bash
1058
+
# No extra install needed — seed works with whatever ORM you already have
`mockPin` generates a value and writes it to a JSON fixture file the first time it runs. Subsequent calls read from the file, giving you a stable snapshot that is always valid and always typed.
zodmint ships a `zodmint/storybook` sub-entry with two utilities for wiring Zod schemas into Storybook stories. No Storybook runtime dependency required — the package is a zero-dependency utility that produces plain objects Storybook understands.
**`zodArgTypes(schema)`** maps a Zod object schema to a Storybook `ArgTypes` map. Each field becomes an argType with an appropriate control based on its Zod type:
// same args every time — stable for snapshot tests
1275
+
};
1276
+
```
1277
+
1278
+
Control mapping:
1279
+
1280
+
| Zod type | Storybook control |
1281
+
|---|---|
1282
+
|`z.string()`|`"text"`|
1283
+
|`z.number()`|`"number"`|
1284
+
|`z.number().min(x).max(y)`|`{ type: "range", min: x, max: y }`|
1285
+
|`z.boolean()`|`"boolean"`|
1286
+
|`z.enum([...])` / `z.nativeEnum(E)`|`"select"` with `options`|
1287
+
|`z.date()`|`"date"`|
1288
+
|`z.object({...})` / `z.array(...)`|`"object"`|
1289
+
| everything else |`"text"` (fallback) |
1290
+
1291
+
`z.optional()` and `z.nullable()` are transparently unwrapped — the inner type determines the control. `z.describe("...")` populates the `description` field on the argType.
1292
+
1293
+
---
1294
+
1103
1295
## Prior art
1104
1296
1105
1297
zodmint was built with an eye on the existing ecosystem. Three libraries were studied for orientation:
0 commit comments