@saplings/validations
v0.17.3
Published
Use Zod-compatible schemas through the Saplings package, or opt into the independent native parser.
Readme
@saplings/validations
Use Zod-compatible schemas through the Saplings package, or opt into the independent native parser.
Install
npm install @saplings/validationsQuick start
import { z } from '@saplings/validations';
const Project = z.object({ name: z.string().min(1).max(80) });
type Project = z.infer<typeof Project>;
const parsed = Project.safeParse({ name: 'My project' });
if (parsed.success) {
const project: Project = parsed.data;
console.log(project.name);
}API and integration
- The root delegates to the pinned upstream Zod v4 dependency. Use
/v3for the v3-compatible API and/minior/v4/minifor the mini entry point. - Use
safeParsefor untrusted values andsafeParseAsyncwhen a schema performs asynchronous checks. Handle the reported issues at the input boundary. /nativeis an independent ESM parser with its own semantics and limits. Upstream packages importingzoddirectly resolve Zod through their own dependency.
Read the integration guide for configuration and operational details.
