Skip to content

crisconru/schemasjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏠 This is the publish-only mirror of SchemasJS.

Source code, issues, pull requests, and discussions live on Codeberg. This GitHub repository exists only to publish npm packages via OIDC trusted publishing (which doesn't currently support Codeberg / Woodpecker).

SchemasJS

Read this in other languages: Español · 简体中文

SchemasJS

SchemasJS is to runtime validation schemas what DefinitelyTyped is to TypeScript type definitions — a collection of ready-to-use, community-maintained schemas organized by validator library.

Choose your validator (Valibot, Zod, etc.) and get production-ready schemas for common needs — numeric types, binary protocols, typed arrays, and more. Each schema ships with its inferred TypeScript type, so you write once and get full type safety.



Packages

Valibot

Package Description Version
@schemasjs/valibot-numbers C-style numeric schemas (Uint8, Int32, Float64…) npm

Zod

Package Description Version
@schemasjs/zod-numbers C-style numeric schemas (Uint8, Int32, Float64…) npm

Utilities

Package Description Version
@schemasjs/validator Validator-agnostic wrapper — write schema-based logic once, swap the underlying validator later npm

Why @schemasjs/validator?

Schemas are tightly coupled to their validator library — a Valibot schema won't work with Zod, and vice versa. @schemasjs/validator provides a thin abstraction layer with a unified API (is(), parse(), safeParse()) so your application code doesn't need to know which validator sits underneath. Define your schemas, wrap them, and swap validators without touching business logic.

import { ValibotValidator, ZodValidator } from '@schemasjs/validator'

// These work identically regardless of the underlying validator
const uint8 = ValibotValidator<Uint8>(Uint8Schema)
uint8.is(255)   // true
uint8.parse(42) // 42

About

Javascript (and Typescript) schemas to guarantee runtime type checking

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors