-
Notifications
You must be signed in to change notification settings - Fork 0
cli_reference
openapigen.exe --config <path/to/config.json>
openapigen.exe --init <folder>
openapigen.exe --input <spec> [--output <dir>] [--prefix <name>] [--docs]
openapigen.exe --helpThe --config workflow is the primary mode — it reads all settings from a JSON config file
and is the recommended approach for any project you return to repeatedly. The --input
mode is a quick shortcut for one-off runs without a config file.
Run from a config file.
openapigen.exe --config ./myapi/config.jsonThe config file specifies the input spec path, output folders, prefix, and which targets to
emit. The tool also writes an openapigen.schema.json beside the config and patches
$schema in the config to enable IDE autocomplete.
See Getting Started for the config format.
Bootstrap a config.json and openapigen.schema.json in the given folder.
openapigen.exe --init ./myapiCreates:
-
./myapi/config.json— default config pointing at./openapi.json -
./myapi/openapigen.schema.json— JSON schema for IDE autocomplete
Edit config.json to point "Input" at your spec, then run with --config.
Path to an OpenAPI 3.x specification file.
openapigen.exe --input openapi.json
openapigen.exe --input path\to\spec.yamlBoth JSON and YAML are supported. The format is auto-detected from the file extension
(.yaml / .yml → YAML; anything else → JSON).
Note: the help text says "Path or URL" but URL input is not implemented — the tool checks
FileInfo.Existsimmediately and will fail if given a URL.
Output directory for generated files. Created automatically if it does not exist.
--output ./out
--output D:\gen\myapiDefault: build
The namespace prefix used for all generated names. Affects four naming patterns:
| Pattern | Example (gm) |
Example (myapi) |
|---|---|---|
| Public functions | gm_ |
myapi_ |
| Private helpers | _gm_ |
_myapi_ |
| Struct names | Gm |
Myapi |
| Macros / constants | GM_ |
MYAPI_ |
Default: gm
See Naming Conventions for full details.
Also emit JSDoc stubs (schemas_codegen.js, function_codegen.js) alongside the GML files.
In config mode, doc output is controlled by "Docs.Enabled" in config.json.
Print usage and exit.
| Code | Meaning |
|---|---|
0 |
Success |
1 |
Bad / missing arguments |
2 |
Option parse error |
3 |
Input file or config file not found |
5 |
Config JSON error or schema patch failure |
6 |
OpenAPI spec parse error |
30 |
Emitter failure |
98 |
--init failure |
99 |
Unhandled exception |
# Bootstrap a config, then run it
openapigen.exe --init ./myapi
openapigen.exe --config ./myapi/config.json
# Direct — JSON spec, output to ./out, default prefix
openapigen.exe --input openapi.json --output out
# Direct — YAML spec with custom prefix, also emit docs
openapigen.exe --input spec.yaml --output out --prefix petstore --docsGameMaker