xschema

Effect Schema

Generate Effect schemas from JSON Schema definitions

The Effect adapter converts JSON Schema definitions into Effect Schema validation schemas with full TypeScript type inference.

Overview

  • Package: @xschemadev/effect
  • Peer Dependency: effect ^3.0.0
  • Compliance: 100%

Effect Schema is part of the Effect ecosystem, providing a powerful schema library with encoding/decoding capabilities. The xschema Effect adapter generates native Effect schemas from JSON Schema with:

  • 100% compliance with JSON Schema Test Suite (all supported drafts)
  • Full type inference - generated schemas include TypeScript types
  • Bidirectional transformations - encode and decode data
  • Effect ecosystem integration - works seamlessly with Effect

Installation

bun add @xschemadev/effect effect
npm install @xschemadev/effect effect
pnpm add @xschemadev/effect effect
yarn add @xschemadev/effect effect

Usage

user.xschema.jsonc
{
  "$schema": "https://xschema.dev/schemas/typescript.jsonc",
  "schemas": [
    {
      "id": "User",
      "adapter": "@xschemadev/effect",
      "source": "./user.schema.json"
    }
  ]
}
import {  } from "./client";
import {  } from "effect";

const user = .(("User"))({ : "1", : "a@b.com" });
const user: {
    id: string;
    email: string;
    name?: string;
}

See the TypeScript guide for full setup instructions.

Supported Features

The Effect adapter has 100% compliance across all JSON Schema drafts. All tests pass.

See the Compliance page for the full breakdown by draft.

On this page