The fastest schema with next-gen DX.
Highlights:
Also, you can use Sury as a building block for your own tools or use existing ones:
S.toJSONSchema
⚠️ Be aware that Sury uses
new Function
for parsing. The approach is battle tested and has no known security issues. It's also used by TypeBox, Zod@4 and ArkType. Even Cloudflare Workers recently added support for it.
Instead of relying on a few large functions with many methods, Sury follows Valibot's approach, where API design and source code is based on many small and independent functions, each with just a single task. This modular design has several advantages.
For example, this allows a bundler to use the import statements to remove code that is not needed. This way, only the code that is actually used gets into your production build. This can reduce the bundle size by up to 2 times compared to Zod.
Besides the individual bundle size, the overall size of the library is also significantly smaller.
At the same time Sury is the fastest composable validation library in the entire JavaScript ecosystem. This is achieved because of the JIT approach when an ultra optimized validator is created using new Function
.
S.toJSONSchema
z.toJSONSchema
👑 @valibot/to-json-schema
T.toJsonSchema
Standard Schema ✅ ✅ ❌ ✅ ✅ Eval-free ❌ ⭕ opt-out ⭕ opt-in ✅ ⭕ opt-out Codegen-free (Doesn't need compiler) ✅ ✅ ✅ ✅ ✅ Infered TS Type S.Schema<{foo: string}, {foo: string}>
z.ZodObject<{foo: z.ZodString}, {}>
TObject<{foo: TString}>
v.ObjectSchema<{readonly foo: v.StringSchema<undefined>}, undefined>
Type<{foo: string}, {}>
Ecosystem ⭐️⭐️ ⭐️⭐️⭐️⭐️⭐️ ⭐️⭐️⭐️⭐️⭐️ ⭐️⭐️⭐️ ⭐️⭐️
If you're enjoying Sury and want to give back, that would be rad!
Your sponsorship doesn't go towards anything specific – it's simply a wonderful way to say "thank you" and make me happy. 😁
Donate with USDT:
0x509fCF7C24A94a776eb92B56B9DA4aA145615529
TFg5hKgkdcrFnPHNgYqfbp9yMyx25uaWrF
DM me on X/Twitter if you want to be featured or just to say hi! This would mean so much to me. ✨
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4