You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

validation-adapter

Package Overview
Dependencies
Maintainers
0
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validation-adapter

Universal validation adapter that integrates various validation libraries like Zod, Valibot, and Yup

0.0.24
latest
Source
npmnpm
Version published
Weekly downloads
2.7K
-10.79%
Maintainers
0
Weekly downloads
 
Created
Source

validation-adapter banner

GitHub License NPM bundle minzipped size NPM total downloads Join Discord

Status: Experimental

validation-adapter is a universal validation adapter that integrates different validators like Zod, Valibot, Yup, and more.

  • Universal Integration: Combine multiple validation libraries seamlessly
  • Flexible: Easily append and extend validation rules
  • Typesafe: Build with TypeScript for strong type safety

🌟 Motivation

Create a universal validation adapter that generalizes different validation libraries like Zod, Valibot, etc. for use in libraries & applications requiring diverse validation strategies like feature-form.

📖 Usage

import * as v from 'valibot';
import { createValidator } from 'validation-adapter';
import { vValidator } from 'validation-adapters/valibot';
import { zValidator } from 'validation-adapters/zod';
import * as z from 'zod';

const zodNameValidator = zValidator(
	z
		.string()
		.min(2)
		.max(10)
		.regex(/^([^0-9]*)$/)
);

const valibotNameValidator = vValidator(
	v.pipe(v.string(), v.minLength(2), v.maxLength(10), v.regex(/^([^0-9]*)$/))
);

const customValidator = createValidator([
	{
		key: 'custom',
		validate: (cx) => {
			if (cx.value !== 'CustomValue') {
				cx.registerError({
					code: 'custom-error',
					message: 'Value must be CustomValue.'
				});
			}
		}
	}
]);

const combinedValidator = valibotNameValidator.clone().append(customValidator);

FAQs

Package last updated on 03 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.