OrvalOrval

CLI

Command line interface reference

Generate type-safe clients from OpenAPI specifications.

Basic Usage

orval

By default, Orval searches for an orval.config.js file.

Options

--input, -i

Path or URL to your OpenAPI specification:

orval --input ./petstore.yaml

--output, -o

Output path for generated files:

orval --output ./api/endpoints/petstoreFromFileSpec.ts

--config, -c

Path to your Orval config:

orval --config ./api/orval.config.js

--project, -p

Focus on specific projects in your config:

orval --project petstore
orval --project dogstore catstore

--watch, -w

Watch files and regenerate on changes:

orval --watch
orval --watch ./src

--clean

Clean the output directories before regenerating:

orval --clean
orval --clean ./src

This cleans all output target and schemas folders.

--formatter

Format generated files with the specified formatter (prettier, biome, or oxfmt):

orval --formatter prettier
orval --formatter biome
orval --formatter oxfmt

--tsconfig

Specify the path to your tsconfig:

orval --tsconfig ./src/tsconfig.json

--log-level

Set the log level. One of error, warn, info, verbose, or debug. The default is info. Mutually exclusive with --verbose and --quiet:

orval --log-level warn

--verbose

Shortcut for --log-level verbose. Mutually exclusive with --log-level and --quiet:

orval --verbose

--quiet

Shortcut for --log-level warn. Errors and warnings are printed; info, verbose, and debug are suppressed. Mutually exclusive with --log-level and --verbose:

orval --quiet

--fail-on-warnings

Exit with error code 1 when warnings are emitted during generation. Useful in CI pipelines to enforce warning-free builds:

orval --fail-on-warnings

--outdated

Compare what Orval would generate with the files already on disk, without writing anything. Each file that needs regeneration is listed with its status, and the process exits with code 1 when any is found, so CI can catch a specification or configuration change that was not followed by a regeneration:

orval --outdated
outdated: src/api/pets.ts
missing: src/api/model/petSummary.ts
obsolete: src/api/legacyUsers.ts
  • outdated: the file exists but its content differs from the generated output, including formatting by prettier.
  • missing: the file would be generated but does not exist.
  • obsolete: the file would be removed by clean and is no longer generated. Only reported when clean is configured.

Nothing is written or removed, including when clean is configured. Running orval regenerates the listed files.

A project with hooks.afterAllFilesWrite, the biome or oxfmt formatter, or docs cannot be checked, because those change files after generation. The check fails with an error for such a project. Disable them when running the check.

Mutually exclusive with --watch.

On this page