Skip to main content

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 behaviour of the Orval generated files.

Configuration options for the following are described on this page:

CategoryDescription
InputThe path to the specification, or a configuration object specifying how to transform the specification before generation.
OutputThe 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.
HooksAllows running scripts on certain events.

orval.config.js

module.exports = {
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?