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.

Universal Switcher:
From:
To:

100% Client-Side Prisma to JSON Schema Converter

Zero Server Uploads

Parse Prisma Schema (schema.prisma) models and enums into standard JSON Schema (Draft 2020-12 & Draft-07) specifications with inverted nullability.

Local Browser Sandbox
Presets:
Prisma Schema (schema.prisma) 0 lines • 0 chars
Generated JSON Schema
0 models • 0 enums
Models 0
Enums 0
Nullability Inverted Required
Draft Mode Draft 2020-12

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?

100% Client-Side Privacy: Your schema.prisma files never leave your device or touch any external server.
Inverted Nullability Engine: Mandatory Prisma fields automatically populate JSON Schema required arrays; optional ? fields are excluded.
Dual Draft Support: Generates modern JSON Schema Draft 2020-12 ($defs) or legacy Draft-07 (definitions) with a single click.
Complete Type Coverage: Handles DateTime, BigInt, Float, Decimal, Bytes, Json, arrays, and standalone enums.
Smart Relation Handling: Resolves 1:1 and 1:N relations into typed $ref pointers or strips them for raw database column validation.

How to Use Prisma Schema to JSON Schema Converter

1

Paste Prisma Schema

Paste your schema.prisma code or upload a .prisma file into the editor.

2

Configure Output Draft

Select Draft 2020-12 ($defs) or Draft-07 (definitions) and toggle relation references.

3

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.

Sample schema.prisma Source
model User {
  id Int @id @default(autoincrement())
  email String @unique
  bio String?
  posts Post[]
}
Sample JSON Schema (Draft 2020-12) Processed
{
  "$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

Technical specifications and engine details for Prisma Schema to JSON Schema Converter
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
Maintained by Pragyan Pahadi

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?
Prisma fields are required by default unless marked with a question mark (?). Conversely, JSON Schema properties are optional by default. The converter inverts this rule: unadorned Prisma fields are automatically listed in the required array, while fields marked with ? are omitted from required.
What is the difference between Draft 2020-12 and Draft-07 output?
Draft 2020-12 places shared model and enum definitions under the $defs keyword and uses #/$defs/Model URI pointers. Draft-07 places definitions under definitions and uses #/definitions/Model references for compatibility with OpenAPI 3.0 and older schema validators.
How are Prisma relations converted to JSON Schema?
When relation inclusion is enabled, 1:1 relations are converted to direct $ref references to the target model, and 1:N relations are converted to array types with items referencing the target model. If relation inclusion is disabled, virtual navigation fields are omitted, preserving only raw foreign key columns.
Are default values and doc comments preserved in the JSON Schema?
Yes. Literal default values (@default(100), @default("draft"), @default(true)) are mapped to standard default attributes. Triple-slash documentation comments (///) preceding models and fields are converted to description fields.

Methodology

Validates inverted nullability, scalar types, relations, doc comments, and drafts without external dependencies or sponsored ranking.

Last updated .