Output ​
You must set the output so we know where to generate your files.
Output ​
Output can be a path to the destination folder or an object containing the destination folder path and optional settings.
export default {
input: 'https://get.heyapi.dev/hey-api/backend',
output: 'src/client',
};
export default {
input: 'https://get.heyapi.dev/hey-api/backend',
output: {
path: 'src/client',
// ...other options
},
};
Format ​
To format your output folder contents, set output.format
to a valid formatter.
export default {
input: 'https://get.heyapi.dev/hey-api/backend',
output: {
format: false,
path: 'src/client',
},
};
export default {
input: 'https://get.heyapi.dev/hey-api/backend',
output: {
format: 'prettier',
path: 'src/client',
},
};
export default {
input: 'https://get.heyapi.dev/hey-api/backend',
output: {
format: 'biome',
path: 'src/client',
},
};
You can also prevent your output from being formatted by adding your output path to the formatter's ignore file.
Lint ​
To lint your output folder contents, set output.lint
to a valid linter.
export default {
input: 'https://get.heyapi.dev/hey-api/backend',
output: {
lint: false,
path: 'src/client',
},
};
export default {
input: 'https://get.heyapi.dev/hey-api/backend',
output: {
lint: 'eslint',
path: 'src/client',
},
};
export default {
input: 'https://get.heyapi.dev/hey-api/backend',
output: {
lint: 'biome',
path: 'src/client',
},
};
export default {
input: 'https://get.heyapi.dev/hey-api/backend',
output: {
lint: 'oxlint',
path: 'src/client',
},
};
You can also prevent your output from being linted by adding your output path to the linter's ignore file.
TSConfig Path ​
We use the TSConfig file to generate output matching your project's settings. By default, we attempt to find a TSConfig file starting from the location of the @hey-api/openapi-ts
configuration file and traversing up. If your file is located in a different place or you want to disable this setting, set output.tsConfigPath
to a string.
export default {
input: 'https://get.heyapi.dev/hey-api/backend',
output: {
path: 'src/client',
tsConfigPath: './config/tsconfig.custom.json',
},
};
export default {
input: 'https://get.heyapi.dev/hey-api/backend',
output: {
path: 'src/client',
tsConfigPath: 'off',
},
};
Custom Files ​
By default, you can't keep custom files in the output.path
folder because it's emptied on every run. If you're sure you need to disable this behavior, set output.clean
to false
.
export default {
input: 'https://get.heyapi.dev/hey-api/backend',
output: {
clean: false,
path: 'src/client',
},
};
WARNING
Setting output.clean
to false
may result in broken output. Ensure you typecheck your code.
Examples ​
You can view live examples on StackBlitz.
Sponsors ​
Love Hey API? Become our sponsor.