Options that can be used to configure the generation when using the generator programmatically. The options match the CLI options.

Hierarchy

  • GeneratorOptions

Properties

clearOutputDir?: boolean

Remove all files in the output directory before generation. Be cautious when using this option, as it really removes EVERYTHING in the output directory.

config?: string

Set the path to the file containing the options for generation. If other flags are used, they overwrite the options set in the configuration file. If a directory is passed, a config.json file is read from this directory.

include?: string

Include files matching the given glob into the root of each generated client directory.

input: string

Specify the path to the directory or file containing the OpenAPI service definition(s) to generate clients for. Accepts Swagger and OpenAPI definitions as YAML and JSON files. Throws an error if the path does not exist.

licenseInPackageJson?: string

Deprecated

Since v2.13.0. Use the include option to add a custom package.json. License name to be used on the generated package.json. Only considered if 'packageJson' is enabled.

metadata?: boolean

Hidden option only for internal usage - generate metadata for API hub integration.

optionsPerService?: string

Set the path to a file containing the options per service. The configuration allows to set a directoryName and packageName for every service, identified by the path to the original file. It also makes sure that names do not change between generator runs. If a directory is passed, a options-per-service.json file is read/created in this directory.

outputDir: string

Specify the path to the directory to generate the client(s) in. Each client is generated into a subdirectory within the given output directory. Creates the directory if it does not exist. Customize subdirectory naming through optionsPerService.

overwrite?: boolean

Allow overwriting files that already exist. This is useful when running the generation regularly.

packageJson?: boolean

When enabled, a package.json containing dependencies and scripts for transpilation and documentation generation, is generated.

packageVersion?: string

Deprecated

Since v2.13.0. Use the include option to add a custom package.json. Internal option used to adjust the version in the generated package.json. Will not be used in the future.

prettierConfig?: string

Specify the path to the prettier config. If not given a default config will be used for the generated sources.

readme?: boolean

Generate default README.md files in the client directories.

skipValidation?: boolean

By default, the generation fails when there are duplicate or invalid names for operations and/or path parameters after transforming them to camel case. Set this to true to enable unique and valid name generation. The names will then be generated by appending numbers and prepending prefixes.

transpile?: boolean

Transpile the generated TypeScript code. When enabled, a default tsconfig.json will be generated and used. It emits .js, .js.map, .d.ts and .d.ts.map files. To configure transpilation set tsconfig.

tsConfig?: string

Replace the default tsconfig.json by passing a path to a custom configuration. By default, a tsconfig.json is only generated when transpilation is enabled (transpile). If a directory is passed, a tsconfig.json file is read from this directory.

verbose?: boolean

Turn on verbose logging.

Copyright Ⓒ 2023 SAP SE or an SAP affiliate company. All rights reserved.