Generator reference
5.x only
This page applies to the 5.x line only (npm 5.1.x, branch 5.x). From 6.0, @ahoo-wang/fetcher-generator lives in the Wow repository (typescript/) and is documented at wow.ahoo.me; its successor @ahoo-wang/wow-generator is on npm from Wow 9.2.0 (9.2.1 or later accepts fetcher 6).
Generate TypeScript models and decorator clients from an OpenAPI document, with optional Wow CQRS discovery. The only root symbols are CodeGenerator and DEFAULT_CONFIG_PATH.
Install
pnpm add -D @ahoo-wang/fetcher-generator @ahoo-wang/fetcher @ahoo-wang/fetcher-eventstream @ahoo-wang/fetcher-decorator @ahoo-wang/fetcher-openapi @ahoo-wang/fetcher-wow typescriptVersion 5.0.0 itself declares Node >=18.20.8, but its CLI dependency commander 14 requires Node >=20. Use Node >=22.12.0 for this toolchain; repository development additionally pins pnpm 10.34.5. The command includes all recursive peers (Generator → Wow/Decorator/EventStream/OpenAPI → Fetcher) and the compiler used below. ts-morph, commander and yaml install automatically as regular dependencies. These are generation-time dependencies; generated clients need their imported packages installed as runtime dependencies in the consuming application, as listed under generated output.
Minimal example
pnpm exec fetcher-generator generate -i ./openapi.json -o ./src/generated -t ./tsconfig.jsonChoose an entry point
Use the CLI for a reproducible build step and CodeGenerator.generate() for a Node script with a custom logger. Both produce source files; neither executes API operations. Start with the complete CLI input and tsconfig, then check output ownership before regenerating.
