A JSON Schema-first framework for validation, persistence, SDK generation, and migrations.
Built by Omnikon — Developer tools for the next generation.
Schema Cast is NOT a replacement for JSON Schema. It is a powerful framework that extends JSON Schema.
By strictly adhering to the JSON Schema standard, you define your data models once. Schema Cast enriches these standard models with persistence logic, ORM bindings, and API definitions using the custom x-schema-cast namespace.
The x-schema-cast namespace follows the JSON Schema extension model: standard validators like AJV and Hyperjump safely ignore this key, while Schema Cast uses it to drive persistence, code generation, and migrations.
Because we use standard JSON Schema, your schemas remain 100% compatible with existing ecosystem tooling:
- AJV / Hyperjump for runtime validation
- OpenAPI for API specifications
- VS Code for free autocomplete and linting via
$schema - Spectral for linting
Create a user.schema.json file using standard JSON Schema. Add ORM and relationship metadata under the x-schema-cast keyword:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/user.schema.json",
"title": "User",
"type": "object",
"x-schema-cast": {
"tableName": "users",
"timestamps": true
},
"properties": {
"id": {
"type": "string",
"format": "uuid",
"x-schema-cast": { "primaryKey": true }
},
"email": {
"type": "string",
"format": "email",
"x-schema-cast": { "unique": true }
},
"role": {
"type": "string",
"enum": ["admin", "user", "guest"],
"default": "user"
}
},
"required": ["id", "email"],
"additionalProperties": false
}Schema Cast is designed to generate everything you need across your stack. Here's what's available today versus what's on the way:
Available now
| Output | Use Case |
|---|---|
| Zod / AJV Wrappers | Request and form validation |
| Mongoose / Prisma / TypeORM | Database models and ORM configurations |
| PostgreSQL DDL | Table and column generation from your schema |
Planned (see Roadmap)
| Output | Use Case | Target |
|---|---|---|
| OpenAPI v3 | Full API specifications | Q3 2026 |
| Automated migration diffing | Schema-snapshot-based ALTER plans |
Q4 2026 |
| TypeScript / Rust / Go / Python SDKs | Typed clients with built-in networking | Q1 2027 |
All outputs stay in sync automatically as your schemas change.
Schema Cast is designed as a modular compiler that works in 4 layers:
- Standard JSON Schema: You write standard JSON Schema with
$refpointers. - Extension Metadata: You add
x-schema-castto properties to define relationships, primary keys, and indexes. - Compiler Engine: Schema Cast resolves
$refgraphs natively, validates the JSON Schema, and extracts the metadata into a unified Internal Representation (IR). - Generators: The IR is passed to language-specific plugins to generate code.
We don't invent new syntax for relationships. We use standard $ref pointers enriched with metadata.
{
"properties": {
"author": {
"$ref": "./user.schema.json",
"x-schema-cast": {
"relationship": "many-to-one",
"cascadeDelete": true
}
}
}
}All Schema Cast specific logic lives strictly inside the x-schema-cast object. It can be applied at the root schema level or the property level.
| Option | Type | Description |
|---|---|---|
model |
string |
The explicit model name (defaults to schema title). |
tableName |
string |
Database table or collection name. |
timestamps |
boolean |
Automatically add createdAt and updatedAt. |
softDelete |
boolean |
Enable soft deletes (deletedAt). |
indexes |
object[] |
Define compound indexes across multiple properties. |
| Option | Type | Description |
|---|---|---|
primaryKey |
boolean |
Mark as the primary key. |
unique |
boolean |
Enforce unique constraint. |
dbType |
string |
Override the database column type (e.g., VARCHAR(255)). |
relationship |
string |
one-to-one, one-to-many, many-to-one, many-to-many. |
cascadeDelete |
boolean |
Delete child records when parent is deleted. |
Schema Cast's migration engine is under active development, targeted for Q4 2026 (see Roadmap). Once shipped, it's designed to work like this, without requiring you to write manual SQL:
- Schema Cast saves a snapshot of your schema graph.
- When you modify your JSON schemas,
schema-cast migratediffs the new schemas against the snapshot. - It generates an explicit SQL migration plan (e.g.,
ALTER TABLE users ADD COLUMN age INT).
Today, Schema Cast can already generate PostgreSQL DDL directly from a schema; the diff-based migration planner on top of that is what's still in progress.
Inventing a new schema language requires reinventing formatters, validators, and editor integrations.
By building natively on JSON Schema, Schema Cast gives you:
- Zero Learning Curve: If you know JSON Schema, you know Schema Cast.
- Maximum Interoperability: Use your schemas with any tool that accepts standard JSON Schema.
- Zero Vendor Lock-In: Your data definitions are standard; the framework just adds automation.
MIT © Omnikon