Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Prisma · Command

prisma validate

prisma validate checks a Prisma schema for Prisma Schema Language syntax errors and configuration issues. Optional flags let you select a custom schema or Prisma config file.

How it works

The command loads a Prisma schema and checks its Prisma Schema Language plus configuration for errors. Use --schema to validate a different schema file or --config to select a Prisma configuration file.

Syntax

prisma validate [options]

Parameters

NameTypeDescription
-h, --helpoptionDisplay help message
--configoptionCustom path to your Prisma config file
--schemaoptionCustom path to your Prisma schema

Returns

A validation result in the CLI: either confirmation that the loaded schema is valid or diagnostics for schema/configuration errors.

Key points

  • It checks the Prisma schema against Prisma Schema Language rules.
  • Validation catches schema syntax errors and configuration issues before other Prisma operations.
  • The command accepts optional flags rather than requiring positional arguments.
  • Use --config when the Prisma configuration file is not at its automatically discovered location.
  • Use --schema to validate a schema at a custom path.
  • A successful validation reports the resolved schema path and confirms validity.

Common mistakes

  • When using --config, provide the path to the Prisma configuration file; configuration paths are resolved relative to that file.
  • The --schema option accepts a custom schema path, so ensure it points to the intended schema.prisma file.

Example: Validate the default schema

npx prisma validate --schema=./prisma/schema.prisma

Run this from a project containing the default Prisma schema to check its syntax and configuration.

When to use it

Preflight schema changes

Check a schema after editing it and before generating a client or applying database changes.

Target an alternate schema

Validate a schema stored outside the default location.

Use custom configuration

Run validation in a project that uses a non-default Prisma configuration file.

Interview questions

QWhat does prisma validate do?

It validates the Prisma Schema Language in the schema file and checks for syntax or configuration problems. A successful run reports that the schema is valid.

Follow-up: How would you validate a non-default schema? Use --schema with its relative or absolute path.

QHow do you validate a specific schema?

Use the --schema option followed by the desired schema path, for example npx prisma validate --schema=./alternative/schema.prisma. This lets validation target a file other than the default schema location.

Follow-up: What other path-related option is available? Use --config to specify a custom Prisma config file.

QWhen would you use --config?

Use --config to point Prisma at a custom configuration file, such as npx prisma validate --config=./prisma.config.ts. The config file can locate the schema and other Prisma resources.

Follow-up: How are paths in the config interpreted? They are resolved relative to the config file's location, not the directory where the command is run.

  • prisma format
  • prisma migrate
  • prisma generate
  • Prisma Schema Language

Source: validate | Validate Prisma Schema (Prisma CLI v7). Checked 2026-10-16.