Skip to main content

Hooks

afterAllFilesWrite

Type: String or String[] or Function.

Runs after Orval generates the client(s) and writes the generated files to the file system. File paths or their directory is passed as arguments to the script. You can run configured linter tasks on files that are generated by Orval with this hook.

module.exports = {
petstore: {
hooks: {
afterAllFilesWrite: 'prettier --write',
},
},
};

To opt out of having Orval inject the generated files into the command, set injectGeneratedDirsAndFiles option to false, and provide the arguments to the command yourself:

module.exports = {
petstore: {
hooks: {
afterAllFilesWrite: {
command: 'prettier --write .',
injectGeneratedDirsAndFiles: false,
},
},
},
};
Was this page helpful?