8000 GitHub - DZakh-forks/standard-json: Standard Schema to JSON Schema convertor
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

DZakh-forks/standard-json

 
 

Repository files navigation

Standard JSON

npm version npm downloads license

Standard Schema Validator's JSON Schema Converter

Installation

Install the main package -

pnpm add @standard-community/standard-json

For some specific vendor, install the respective package also -

Vendor Package
Zod zod-to-json-schema
Valibot @valibot/to-json-schema

Usage

import { toJsonSchema } from "@standard-community/standard-json";

// Define your schema
const schema = v.pipe(
    v.object({
        myString: v.string(),
        myUnion: v.union([v.number(), v.boolean()]),
    }),
    v.description("My neat object schema"),
);

// Convert it to JSON Schema
const jsonSchema = await toJsonSchema(schema);

Compatibility

List of supported validators -

Vendor Supported
Zod
Valibot
ArkType
Typebox ✅ (Using TypeMap
Effect Schema 🛠️

You can check the compatibility versions at standardschema.dev

Credit

  • This project is inspired by the work of kwaa and their xsschema package.

About

Standard Schema to JSON Schema convertor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 92.5%
  • JavaScript 7.5%
0