Commands
generate
Generate types and operations from cached or local spec.
The generate command regenerates TypeScript types and operations from a locally cached spec file. Unlike fetch, it doesn't download anything.
Usage
chowbea-axios generate [flags]What It Does
- Reads the cached spec from
_internal/openapi.json - Generates
api.types.tsfrom OpenAPI schemas - Generates
api.operations.tsfrom endpoints with operationIds - 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
# Copy local file to cache and generate
chowbea-axios generate --spec-file ./openapi.jsonDry Run
chowbea-axios generate --dry-runGenerate Only Types
chowbea-axios generate --types-onlyGenerate Only Operations
chowbea-axios generate --operations-onlyWhen to Use generate
The generate command is useful when:
- Working offline and you have 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
The generate command requires a cached spec. If none exists, you'll see:
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
You can generate from any local OpenAPI file:
# Generate from a local file
chowbea-axios generate --spec-file ./docs/api-spec.jsonThis copies the file to the cache location before generating, so subsequent generate calls will use it.
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
The same files are generated as with fetch:
api.types.ts
api.operations.ts