npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@schemashift/zod-valibot

v0.14.0

Published

Zod to Valibot transformer for SchemaShift — converts fluent chain API to pipe-based API

Readme

@schemashift/zod-valibot

Zod ↔ Valibot transformer for SchemaShift. Supports both forward (Zod → Valibot) and backward (Valibot → Zod) migrations.

npm version npm downloads CI License: MIT

Tier: Pro

Installation

npm install @schemashift/zod-valibot

Usage

import { createZodToValibotHandler, createValibotToZodHandler } from '@schemashift/zod-valibot';
import { TransformEngine } from '@schemashift/core';

const engine = new TransformEngine();
engine.registerHandler('zod', 'valibot', createZodToValibotHandler());
engine.registerHandler('valibot', 'zod', createValibotToZodHandler()); // Backward migration (Pro+)

Backward Migration: Valibot → Zod

Text-based transformer that converts Valibot schemas to Zod equivalents:

| Valibot | Zod | |---------|-----| | v.object({...}) | z.object({...}) | | v.string() | z.string() | | v.number() | z.number() | | v.boolean() | z.boolean() | | v.date() | z.date() | | v.array(s) | z.array(s) | | v.picklist([...]) | z.enum([...]) | | v.union([...]) | z.union([...]) | | v.literal(val) | z.literal(val) | | v.optional(s) | s.optional() | | v.nullable(s) | s.nullable() | | v.nullish(s) | s.nullish() | | v.pipe(s, ...) | Unwrapped with validations chained | | v.check(fn, msg) | .refine(fn, msg) | | v.transform(fn) | .transform(fn) | | v.brand(name) | .brand(name) | | v.partial(s) | s.partial() | | v.pick(s, [...]) | s.pick({...}) | | v.omit(s, [...]) | s.omit({...}) |

Tier: Pro+

API Model Difference

Zod uses a fluent method chain API:

z.string().email().min(5).max(100)

Valibot uses a pipe-based API where validations are arguments to v.pipe():

v.pipe(v.string(), v.email(), v.minLength(5), v.maxLength(100))

Modifiers like .optional() and .nullable() become wrapping functions:

// Zod
z.string().optional()

// Valibot
v.optional(v.string())

Transformation Mappings

Imports

| Zod | Valibot | |-----|---------| | import { z } from 'zod' | import * as v from 'valibot' | | import * as z from 'zod' | import * as v from 'valibot' |

Factory Methods

| Zod | Valibot | |-----|---------| | z.string() | v.string() | | z.number() | v.number() | | z.boolean() | v.boolean() | | z.date() | v.date() | | z.bigint() | v.bigint() | | z.symbol() | v.symbol() | | z.undefined() | v.undefined_() | | z.null() | v.null_() | | z.void() | v.void_() | | z.any() | v.any() | | z.unknown() | v.unknown() | | z.never() | v.never() | | z.nan() | v.nan() | | z.literal(val) | v.literal(val) | | z.enum([...]) | v.picklist([...]) | | z.nativeEnum(E) | v.enum_(E) | | z.array(s) | v.array(s) | | z.object({...}) | v.object({...}) | | z.record(k, v) | v.record(k, v) | | z.tuple([...]) | v.tuple([...]) | | z.union([...]) | v.union([...]) | | z.discriminatedUnion(d, [...]) | v.variant(d, [...]) | | z.intersection(a, b) | v.intersect(a, b) | | z.lazy(() => s) | v.lazy(() => s) | | z.promise(s) | v.promise(s) | | z.instanceof(C) | v.instance(C) |

String Validations (Pipe)

| Zod | Valibot | |-----|---------| | .email() | v.email() | | .url() | v.url() | | .uuid() | v.uuid() | | .regex(r) | v.regex(r) | | .ip() | v.ip() | | .min(n) | v.minLength(n) | | .max(n) | v.maxLength(n) | | .length(n) | v.length(n) | | .trim() | v.trim() | | .toLowerCase() | v.toLowerCase() | | .toUpperCase() | v.toUpperCase() | | .includes(s) | v.includes(s) | | .startsWith(s) | v.startsWith(s) | | .endsWith(s) | v.endsWith(s) | | .datetime() | v.isoDateTime() | | .date() | v.isoDate() | | .time() | v.isoTime() | | .emoji() | v.emoji() |

Number Validations (Pipe)

| Zod | Valibot | |-----|---------| | .min(n) | v.minValue(n) | | .max(n) | v.maxValue(n) | | .gt(n) | v.minValue(n + 1) | | .lt(n) | v.maxValue(n - 1) | | .gte(n) | v.minValue(n) | | .lte(n) | v.maxValue(n) | | .int() | v.integer() | | .positive() | v.minValue(1) | | .negative() | v.maxValue(-1) | | .nonnegative() | v.minValue(0) | | .nonpositive() | v.maxValue(0) | | .multipleOf(n) | v.multipleOf(n) | | .finite() | v.finite() | | .safe() | v.safeInteger() |

Array Validations

| Zod | Valibot | |-----|---------| | .min(n) | v.minLength(n) | | .max(n) | v.maxLength(n) | | .nonempty() | v.nonEmpty() |

Modifiers (Wrapping)

| Zod | Valibot | |-----|---------| | .optional() | v.optional(schema) | | .nullable() | v.nullable(schema) | | .nullish() | v.nullish(schema) | | .default(val) | v.optional(schema, val) | | .catch(val) | v.fallback(schema, val) | | .readonly() | v.readonly(schema) | | .transform(fn) | v.pipe(schema, v.transform(fn)) | | .refine(fn, msg) | v.pipe(schema, v.check(fn, msg)) | | .brand(name) | v.pipe(schema, v.brand(name)) | | .describe(msg) | (removed — Valibot has no equivalent) |

Object Methods (Wrapping)

| Zod | Valibot | |-----|---------| | .partial() | v.partial(schema) | | .required() | v.required(schema) | | .pick({...}) | v.pick(schema, {...}) | | .omit({...}) | v.omit(schema, {...}) | | .extend(other) | v.merge([schema, other]) | | .merge(other) | v.merge([schema, other]) | | .strict() | v.strict(schema) | | .passthrough() | (no-op — Valibot objects are loose by default) | | .strip() | (no-op — Valibot strips unknown by default with v.object) |

Type Helpers

| Zod | Valibot | |-----|---------| | z.infer<typeof s> | v.InferOutput<typeof s> | | z.input<typeof s> | v.InferInput<typeof s> | | z.output<typeof s> | v.InferOutput<typeof s> |

Patterns Requiring Manual Review

.superRefine()

.superRefine() is converted with a warning since Valibot's custom validation has a different API:

// Zod
z.object({...}).superRefine((data, ctx) => {
  ctx.addIssue({ code: 'custom', message: '...' });
});

// Valibot (needs manual conversion)
v.pipe(v.object({...}), /* TODO: superRefine -> custom validation */ v.check(...))

.catchall()

Zod's .catchall() for extra properties requires manual conversion to Valibot's v.record() or custom validation.

.keyof()

Zod's .keyof() requires manual conversion to v.picklist(Object.keys(...)).

Related Packages

License

MIT