chowbea-axios
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

  1. Reads the cached spec from _internal/openapi.json
  2. Generates api.types.ts from OpenAPI schemas
  3. Generates api.operations.ts from endpoints with operationIds
  4. Creates client files if they don't exist

Flags

FlagShortDescriptionDefault
--config-cPath to api.config.tomlAuto-detected
--spec-file-sUse specific local spec file-
--dry-run-nPreview without writing filesfalse
--types-only-Generate only TypeScript typesfalse
--operations-only-Generate only operationsfalse
--quiet-qSuppress non-error outputfalse
--verbose-vShow detailed outputfalse

Examples

Basic Generate

chowbea-axios generate

Use Specific Spec File

# Copy local file to cache and generate
chowbea-axios generate --spec-file ./openapi.json

Dry Run

chowbea-axios generate --dry-run

Generate Only Types

chowbea-axios generate --types-only

Generate Only Operations

chowbea-axios generate --operations-only

When 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.json

This copies the file to the cache location before generating, so subsequent generate calls will use it.

Difference from fetch

fetchgenerate
Downloads spec from remoteUses cached/local spec
Checks for changesAlways regenerates
Network requiredWorks offline
Updates cacheReads from cache

Generated Output

The same files are generated as with fetch:

api.types.ts
api.operations.ts

Next Steps

On this page