Configuration

This page is a reference to the different ways of configuring Orval projects.

Using an orval.config.(js|mjs|ts) configuration file, placed at the root of a project, you can provide a list of options that changes the default behavior of the Orval generated files.

Configuration options for the following are described on this page:

CategoryDescription
Input

The path to the specification, or a configuration object specifying how to transform the specification before generation.

Output

The output path for Orval's auto-generated files, or a configuration object specifying what is generated and how, as well as where to save the generated files.

Hooks

Allows running scripts on certain events.

orval.config.js

import { defineConfig } from 'orval';
export default defineConfig({
petstore: {
input: './petstore.yaml',
output: './petstore.ts',
hooks: {
afterAllFilesWrite: 'prettier --write',
},
},
});

orval.config.ts

import { defineConfig } from 'orval';
export default defineConfig({
petstore: {
input: './petstore.yaml',
output: './petstore.ts',
hooks: {
afterAllFilesWrite: 'prettier --write',
},
},
});
Was this page helpful?