Skip to content

Commands and flags

command does
openapi-forge [generate] write the layer
openapi-forge pull fetch the documents in sources into specsDir, report what changed, then generate
openapi-forge diff <old> <new> report breaking / risky / safe changes between two documents (files or URLs)
openapi-forge doctor check the config, input, output, installed packages and runtime modules
openapi-forge init write a starter openapi-forge.config.yaml

Flags: --config, --input, --out, --api-prefix, --tags a,b, --exclude-tags a,b, --target hooks|requests, --library <name>, --http api-client|fetch|axios|angular, --client builtin|custom, --zod, --infinite, --headers "K: v;K2: v", --insecure, --ca <pem>, --check, --raw, --force-runtime, --no-pull, --verbose, --watch, --interval <s>, --format text|markdown|json, --fail-on breaking|risky|safe, -h, -v.

Environment: OPENAPI_FORGE_INPUT, OPENAPI_FORGE_HEADERS, OPENAPI_FORGE_INSECURE, OPENAPI_FORGE_CA, OPENAPI_FORGE_SOURCES (name=url;name2=url2). The CLI also reads .env.local and .env from the current folder first (a variable already set in the shell wins, then .env.local, then .env), so these can live next to the project’s other variables. The command line wins over the config file, which wins over the defaults.

  • --watch rebuilds when a local input document changes; a URL input is polled (--interval 30).
  • --check writes nothing and exits 1 when the committed output differs from what a run would write, or when a generated file is left over.
  • --raw skips Prettier.
  • A run removes the module of a tag the document no longer has — only files that still carry the generated banner, never your own files and never the runtime.