Commands
generate
Generate types and operations from cached or local spec.
generate regenerates from disk. No network, no hash dance — just read the cached spec and rewrite _generated/. Use it when you're offline, iterating on generator output, or you've already copied a spec into _internal/.
For "did the remote API change?" use fetch. For "I have a spec file, make TypeScript" use this.
Usage
chowbea-axios generate [flags]What it does
- Reads the cached spec from
_internal/openapi.json - Generates
api.contracts.tsandapi.types.tsfrom OpenAPI schemas - Generates
api.operations.tsfrom endpoints withoperationId(skips the rest) - Creates client files if they don't exist
Flags
| Flag | Short | Description | Default |
|---|---|---|---|
--config | -c | Path to api.config.toml | Auto-detected |
--spec-file | -s | Use specific local spec file | - |
--dry-run | -n | Preview without writing files | false |
--types-only | - | Generate only TypeScript types | false |
--operations-only | - | Generate only operations | false |
--quiet | -q | Suppress non-error output | false |
--verbose | -v | Show detailed output | false |
Examples
Basic generate
chowbea-axios generateUse specific spec file
chowbea-axios generate --spec-file ./openapi.jsonCopies to cache first. Subsequent generate calls use that copy.
Dry run
chowbea-axios generate --dry-runGenerate only types
chowbea-axios generate --types-onlyGenerate only operations
chowbea-axios generate --operations-onlyWhen to use generate
- Working offline with a cached spec
- Quick iteration without network round-trips
- Local spec files that aren't served over HTTP
- Testing changes to the generation process
Prerequisites
No cache? You'll get a helpful error, not a stack trace:
Error [SPEC_NOT_FOUND]: OpenAPI spec not found at: app/services/api/_internal/openapi.json
Recovery: Run 'chowbea-axios fetch' to download the spec from the remote endpoint.Using local spec files
chowbea-axios generate --spec-file ./docs/api-spec.jsonFile is copied to cache before generation. Future generate calls use it until replaced by fetch.
Difference from fetch
fetch | generate |
|---|---|
| Downloads spec from remote | Uses cached/local spec |
| Checks for changes | Always regenerates |
| Network required | Works offline |
| Updates cache | Reads from cache |
Generated output
Same as fetch:
api.contracts.ts
api.types.ts
api.operations.ts
Import named types from api.contracts.ts. Call via api.op. See The Query Layer.