Options
All
  • Public
  • Public/Protected
  • All
Menu

SAP Cloud SDK OpenAPI Client Generator (Beta)

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.

Prerequisites

The official OpenAPI generator is Java based, therefore you need to have a Java runtime installed to use the SAP Cloud SDK OpenAPI generator.

Installation

$ npm install @sap-cloud-sdk/openapi-generator

Usage (CLI)

generate-openapi-client autocomplete [SHELL]

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

generate-openapi-client help [COMMAND]

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

Usage (programatically)

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);

Documentation

Getting started guide API documentation

Helpful Links

Index

Functions

Functions

generate

  • generate(options: GeneratorOptions): Promise<void>
  • experimental

    This API is experimental and might change in newer versions. Use with caution. Main entry point for OpenApi client generation. Generates files using the OpenApi Generator CLI and wraps the resulting API in an SDK compatible API.

    Parameters

    • options: GeneratorOptions

      Options to configure generation.

    Returns Promise<void>