Skip to content

Conversation

@arv
Copy link
Contributor

@arv arv commented Nov 24, 2025

… schemas to Zod schemas with comprehensive tests

… schemas to Zod schemas with comprehensive tests
@arv arv requested a review from 0xcadams November 24, 2025 22:19
@vercel
Copy link

vercel bot commented Nov 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
replicache-docs Ready Ready Preview Comment Nov 24, 2025 10:21pm
zbugs Ready Ready Preview Comment Nov 24, 2025 10:21pm

@github-actions
Copy link

🐰 Bencher Report

Brancharv/zero-to-zod
TestbedLinux
Click to view all benchmark results
BenchmarkFile SizeBenchmark Result
kilobytes (KB)
(Result Δ%)
Upper Boundary
kilobytes (KB)
(Limit %)
zero-package.tgz📈 view plot
🚷 view threshold
1,726.52 KB
(0.00%)Baseline: 1,726.52 KB
1,761.05 KB
(98.04%)
zero.js📈 view plot
🚷 view threshold
234.69 KB
(0.00%)Baseline: 234.69 KB
239.38 KB
(98.04%)
zero.js.br📈 view plot
🚷 view threshold
64.86 KB
(0.00%)Baseline: 64.86 KB
66.16 KB
(98.04%)
🐰 View full continuous benchmarking report in Bencher

@github-actions
Copy link

🐰 Bencher Report

Brancharv/zero-to-zod
Testbedself-hosted
Click to view all benchmark results
BenchmarkThroughputBenchmark Result
operations / second (ops/s) x 1e3
(Result Δ%)
Lower Boundary
operations / second (ops/s) x 1e3
(Limit %)
src/client/custom.bench.ts > big schema📈 view plot
🚷 view threshold
911.44 ops/s x 1e3
(+8.77%)Baseline: 837.99 ops/s x 1e3
633.64 ops/s x 1e3
(69.52%)
src/client/zero.bench.ts > basics > All 1000 rows x 10 columns (numbers)📈 view plot
🚷 view threshold
3.02 ops/s x 1e3
(+2.46%)Baseline: 2.95 ops/s x 1e3
2.80 ops/s x 1e3
(92.85%)
src/client/zero.bench.ts > pk compare > pk = N📈 view plot
🚷 view threshold
48.61 ops/s x 1e3
(+7.75%)Baseline: 45.11 ops/s x 1e3
39.84 ops/s x 1e3
(81.95%)
src/client/zero.bench.ts > with filter > Lower rows 500 x 10 columns (numbers)📈 view plot
🚷 view threshold
3.94 ops/s x 1e3
(-4.39%)Baseline: 4.12 ops/s x 1e3
3.67 ops/s x 1e3
(93.20%)
🐰 View full continuous benchmarking report in Bencher

@github-actions
Copy link

🐰 Bencher Report

Brancharv/zero-to-zod
Testbedself-hosted
Click to view all benchmark results
BenchmarkThroughputBenchmark Result
operations / second (ops/s)
(Result Δ%)
Lower Boundary
operations / second (ops/s)
(Limit %)
zpg: (pk lookup) select * from track where id = 3163📈 view plot
🚷 view threshold
843.00 ops/s
(-6.69%)Baseline: 903.49 ops/s
746.94 ops/s
(88.60%)
zpg: (secondary index lookup) select * from track where album_id = 248📈 view plot
🚷 view threshold
934.23 ops/s
(+0.11%)Baseline: 933.18 ops/s
812.75 ops/s
(87.00%)
zpg: (table scan) select * from album📈 view plot
🚷 view threshold
690.01 ops/s
(-1.99%)Baseline: 703.99 ops/s
614.03 ops/s
(88.99%)
zpg: OR with empty branch and limit📈 view plot
🚷 view threshold
849.18 ops/s
(+2.81%)Baseline: 825.95 ops/s
670.48 ops/s
(78.96%)
zpg: OR with empty branch and limit with exists📈 view plot
🚷 view threshold
637.36 ops/s
(-5.82%)Baseline: 676.78 ops/s
538.31 ops/s
(84.46%)
zpg: all playlists📈 view plot
🚷 view threshold
5.75 ops/s
(+0.01%)Baseline: 5.75 ops/s
5.58 ops/s
(96.99%)
zpg: scan with one depth related📈 view plot
🚷 view threshold
440.18 ops/s
(+3.71%)Baseline: 424.42 ops/s
390.93 ops/s
(88.81%)
zql: (pk lookup) select * from track where id = 3163📈 view plot
🚷 view threshold
132,193.37 ops/s
(+1.27%)Baseline: 130,534.69 ops/s
105,791.93 ops/s
(80.03%)
zql: (secondary index lookup) select * from track where album_id = 248📈 view plot
🚷 view threshold
2,305.40 ops/s
(+5.04%)Baseline: 2,194.76 ops/s
1,613.79 ops/s
(70.00%)
zql: (table scan) select * from album📈 view plot
🚷 view threshold
7,151.50 ops/s
(+3.36%)Baseline: 6,919.04 ops/s
6,250.89 ops/s
(87.41%)
zql: OR with empty branch and limit📈 view plot
🚷 view threshold
54,256.22 ops/s
(-9.82%)Baseline: 60,165.89 ops/s
48,652.74 ops/s
(89.67%)
zql: OR with empty branch and limit with exists📈 view plot
🚷 view threshold
12,004.97 ops/s
(-3.31%)Baseline: 12,416.22 ops/s
9,567.72 ops/s
(79.70%)
zql: all playlists📈 view plot
🚷 view threshold
4.52 ops/s
(+0.22%)Baseline: 4.51 ops/s
4.06 ops/s
(89.77%)
zql: edit for limited query, inside the bound📈 view plot
🚷 view threshold
247,690.39 ops/s
(+3.83%)Baseline: 238,549.69 ops/s
221,874.21 ops/s
(89.58%)
zql: edit for limited query, outside the bound📈 view plot
🚷 view threshold
263,040.96 ops/s
(+5.90%)Baseline: 248,380.31 ops/s
210,027.76 ops/s
(79.85%)
zql: push into limited query, inside the bound📈 view plot
🚷 view threshold
121,465.34 ops/s
(+3.41%)Baseline: 117,455.76 ops/s
110,272.78 ops/s
(90.79%)
zql: push into limited query, outside the bound📈 view plot
🚷 view threshold
489,635.69 ops/s
(+6.66%)Baseline: 459,079.10 ops/s
396,911.66 ops/s
(81.06%)
zql: push into unlimited query📈 view plot
🚷 view threshold
340,915.69 ops/s
(-5.93%)Baseline: 362,424.11 ops/s
325,844.89 ops/s
(95.58%)
zql: scan with one depth related📈 view plot
🚷 view threshold
483.86 ops/s
(-3.80%)Baseline: 502.97 ops/s
439.09 ops/s
(90.75%)
zqlite: (pk lookup) select * from track where id = 3163📈 view plot
🚷 view threshold
55,874.54 ops/s
(+19.37%)Baseline: 46,805.99 ops/s
39,805.50 ops/s
(71.24%)
zqlite: (secondary index lookup) select * from track where album_id = 248📈 view plot
🚷 view threshold
11,531.98 ops/s
(+0.79%)Baseline: 11,442.04 ops/s
10,537.36 ops/s
(91.38%)
zqlite: (table scan) select * from album📈 view plot
🚷 view threshold
1,343.74 ops/s
(-2.93%)Baseline: 1,384.23 ops/s
1,255.27 ops/s
(93.42%)
zqlite: OR with empty branch and limit📈 view plot
🚷 view threshold
20,324.25 ops/s
(+5.82%)Baseline: 19,206.91 ops/s
15,687.73 ops/s
(77.19%)
zqlite: OR with empty branch and limit with exists📈 view plot
🚷 view threshold
5,891.55 ops/s
(+3.76%)Baseline: 5,678.02 ops/s
4,613.51 ops/s
(78.31%)
zqlite: all playlists📈 view plot
🚷 view threshold
1.53 ops/s
(+2.25%)Baseline: 1.49 ops/s
1.37 ops/s
(89.59%)
zqlite: edit for limited query, inside the bound📈 view plot
🚷 view threshold
132,437.83 ops/s
(+3.82%)Baseline: 127,560.19 ops/s
118,878.20 ops/s
(89.76%)
zqlite: edit for limited query, outside the bound📈 view plot
🚷 view threshold
133,460.88 ops/s
(+2.17%)Baseline: 130,627.14 ops/s
120,217.39 ops/s
(90.08%)
zqlite: push into limited query, inside the bound📈 view plot
🚷 view threshold
4,212.20 ops/s
(-1.33%)Baseline: 4,268.87 ops/s
4,096.73 ops/s
(97.26%)
zqlite: push into limited query, outside the bound📈 view plot
🚷 view threshold
150,384.98 ops/s
(-1.78%)Baseline: 153,113.26 ops/s
137,900.29 ops/s
(91.70%)
zqlite: push into unlimited query📈 view plot
🚷 view threshold
133,049.89 ops/s
(-0.31%)Baseline: 133,459.26 ops/s
122,692.85 ops/s
(92.22%)
zqlite: scan with one depth related📈 view plot
🚷 view threshold
166.53 ops/s
(+1.31%)Baseline: 164.38 ops/s
129.18 ops/s
(77.57%)
🐰 View full continuous benchmarking report in Bencher

@aboodman
Copy link
Contributor

I see that all the mutators typically take a subset of columns (often a small subset). I was thinking that you'd use zeroToZod(schema.tables.issue).partial() to select just the columns you want.

But another concern is that you often want to maintain backward compat for these mutators since they are a network boundary. So automatically changing their types when the db schema changes is maybe not what you want.

So maybe explicit is better here.

@aboodman
Copy link
Contributor

Is that what you were thinking?

I think a lot of people might still want the convenience. Maybe we should check it in or publish a separate library as a utility anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants