0.2.1-pre8 • Published 6 months ago
@kingbri1/standard-json v0.2.1-pre8
Standard JSON
Standard Schema Validator's JSON Schema Converter
Installation
Install the main package -
pnpm add @standard-community/standard-jsonFor 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
0.2.1-pre8
6 months ago
0.2.1-pre6
6 months ago
0.2.1-pre4
6 months ago
0.2.1-pre3
6 months ago
0.2.1-pre2
6 months ago
0.2.1-pre1
6 months ago