Configuration

This page is a reference to the different ways of configuring your 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
InputDirectly the path to the specification or the configuration of the imported specification and also what you want to override on it.
OutputDirectly the path to where you want to generate your models and HTTP calls or the configuration of what and where you want to write the generated code.
HooksAllows you to run 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?

Copyright © 2024 Victor Bury. All Rights Reserved.