Generate custom JavaScript/TypeScript clients for services with OpenAPI specifications. This generator is based on the OpenAPI Tools generator for OpenAPI and adds some additional code for convenience to better integrate with the SAP Cloud SDK.
The official OpenAPI generator is Java based, therefore you need to have a Java runtime installed to use the SAP Cloud SDK OpenAPI generator.
$ npm install @sap-cloud-sdk/openapi-generator
display autocomplete installation instructions
USAGE
$ generate-openapi-client autocomplete [SHELL]
ARGUMENTS
SHELL shell type
OPTIONS
-r, --refresh-cache Refresh cache (ignores displaying instructions)
EXAMPLES
$ generate-openapi-client autocomplete
$ generate-openapi-client autocomplete bash
$ generate-openapi-client autocomplete zsh
$ generate-openapi-client autocomplete --refresh-cache
See code: @oclif/plugin-autocomplete
display help for generate-openapi-client
USAGE
$ generate-openapi-client help [COMMAND]
ARGUMENTS
COMMAND command to show help for
OPTIONS
--all see all commands in CLI
See code: @oclif/plugin-help
import { generate } from '@sap-cloud-sdk/openapi-generator';
// initialize generator options based on what you want to do
// note that inputDir and outputDir are mandatory
const options: GeneratorOptions = {
inputDir: 'path/to/inputDir',
outputDir: 'path/to/outputDir'
};
// generates the files and writes them to the outputDir
await generate(options);