Prisma Schema to JSON Schema Converter
Instant in-browser Prisma schema AST parser and JSON Schema Draft 2020-12 / Draft-07 generator with inverted nullability.
At a glance
Prisma Schema to JSON Schema Converter parses schema.prisma models into Draft 2020-12 and Draft-07 JSON Schema with inverted nullability, scalar mapping, enums, and $defs entirely in browser memory with zero network requests.
100% Client-Side Prisma to JSON Schema Converter
Zero Server UploadsParse Prisma Schema (schema.prisma) models and enums into standard JSON Schema (Draft 2020-12 & Draft-07) specifications with inverted nullability.
Schema Parsing Error
Inverted Nullability Logic
Prisma fields are strictly required by default unless marked with an explicit question mark (?). In JSON Schema, properties are optional by default. The converter automatically inverts this rule, appending all mandatory Prisma attributes directly into the model's "required": [...] array.
Draft 2020-12 & Draft-07
Modern API validators (Fastify, Ajv 8+) utilize $defs for schema reuse, whereas OpenAPI 3.0 and older Draft-07 engines use definitions. Switch drafts with one click to generate compatible references (#/$defs/Model vs #/definitions/Model).
Scalar & Attribute Mapping
Specialized Prisma primitives map accurately: DateTime to date-time format, BigInt to int64, @default(uuid()) to uuid format, and triple-slash doc comments (///) to JSON Schema description annotations.
Why Use This Prisma Schema to JSON Schema Converter?
How to Use Prisma Schema to JSON Schema Converter
Paste Prisma Schema
Paste your schema.prisma code or upload a .prisma file into the editor.
Configure Output Draft
Select Draft 2020-12 ($defs) or Draft-07 (definitions) and toggle relation references.
Copy or Download
Copy the generated JSON Schema to your clipboard or download schema.json immediately.
Prisma Schema to JSON Schema Conversion example
Demonstrates automated conversion of multiple Prisma models into Draft 2020-12 JSON Schema with inverted required arrays and relation references.
model User {
id Int @id @default(autoincrement())
email String @unique
bio String?
posts Post[]
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "User",
"type": "object",
"properties": {
"id": { "type": "integer" },
"email": { "type": "string" },
"bio": { "type": "string" },
"posts": { "type": "array", "items": { "$ref": "#/$defs/Post" } }
},
"required": ["id", "email", "posts"]
}
Technical Specifications & Engine Details
| Specification | Details |
|---|---|
| Supported JSON Schema Drafts | Draft 2020-12 ($defs), Draft-07 (definitions) |
| Supported Prisma Constructs | model, enum, type composite, @id, @default, @relation, @updatedAt |
| Execution Mode | 100% Client-Side In-Browser (Zero server latency) |
| Nullability Mapping | Mandatory fields → required array, optional ? fields → omitted |
| Relation Strategies | Typed $ref pointers (1:1 / 1:N) or omit relation navigation fields |
100% Client-Side Privacy Guarantee
Your files remain strictly on your local device. Zero data is transmitted to external servers.
Frequently Asked Questions
How does Prisma to JSON Schema handle nullability and optional fields?
What is the difference between Draft 2020-12 and Draft-07 output?
How are Prisma relations converted to JSON Schema?
Are default values and doc comments preserved in the JSON Schema?
Methodology
Validates inverted nullability, scalar types, relations, doc comments, and drafts without external dependencies or sponsored ranking.
Last updated .