Skip to content
CLI Usage

CLI Usage

All configuration options can be passed as CLI flags. Flags override values from the config file.

Basic usage

ng-openapi-gen -i openapi.yaml -o src/app/api

Flags

FlagAliasDescription
--config-cPath to configuration JSON file
--input-iOpenAPI spec file or URL
--output-oOutput directory
--silentSuppress verbose output
--helpShow help

All configuration properties can also be passed as flags using camelCase or kebab-case:

ng-openapi-gen --input spec.yaml --model-prefix "My" --enum-style upper --promises false

Examples

Basic generation

ng-openapi-gen -i petstore.yaml -o src/app/api

With URL input

ng-openapi-gen -i https://example.com/openapi.json -o src/app/api

Using a config file

ng-openapi-gen -c my-config.json

Multi-API setup

ng-openapi-gen -c api-users.json
ng-openapi-gen -c api-orders.json

Exit codes

CodeMeaning
0Success
1Error (parsing, generation, etc.)

Environment

No environment variables are required. The tool respects $GOPATH if set for Go-based installs, but the binary itself is standalone.