chowbea-axios
Commands

validate

Check OpenAPI spec for issues that could affect generation.

The validate command analyzes your OpenAPI specification and reports issues that could cause problems during type generation.

Usage

chowbea-axios validate [flags]

What It Checks

  1. Required fields - openapi/swagger version, info object
  2. Paths structure - Valid path items and HTTP methods
  3. Operation IDs - Missing operationId warnings
  4. Response definitions - Missing responses
  5. Components/Schemas - Schema definitions present

Flags

FlagShortDescriptionDefault
--config-cPath to api.config.tomlAuto-detected
--spec-sPath to OpenAPI spec fileFrom cache
--strict-Treat warnings as errorsfalse
--quiet-qSuppress non-error outputfalse
--verbose-vShow detailed outputfalse

Examples

Validate Cached Spec

chowbea-axios validate

Validate Specific File

chowbea-axios validate --spec ./openapi.json

Strict Mode

# Fail on warnings too
chowbea-axios validate --strict

Output

No Issues

╭────────────────────────────────────────
│ chowbea-axios validate
├────────────────────────────────────────

│ ✓ Validating OpenAPI spec... (specPath=app/services/api/_internal/openapi.json)

╰────────────────────────────────────────

│ ✓ Validation complete (errors=0, warnings=0)
│ ✓ OpenAPI spec is valid

With Warnings

╭────────────────────────────────────────
│ chowbea-axios validate
├────────────────────────────────────────

│ ✓ Validating OpenAPI spec...

├────────────────────────────────────────
│ Warnings
├────────────────────────────────────────

│ ⚠ Missing operationId - operation will be skipped during generation (path=/paths/users/get)
│ ⚠ Missing operationId - operation will be skipped during generation (path=/paths/users/post)

╰────────────────────────────────────────

│ ✓ Validation complete (errors=0, warnings=2)
│ ✓ OpenAPI spec is valid

With Errors

╭────────────────────────────────────────
│ Errors
├────────────────────────────────────────

│ ✗ Missing 'openapi' or 'swagger' version field (path=/)
│ ✗ Missing required 'info' object (path=/info)

╰────────────────────────────────────────

│ ✓ Validation complete (errors=2, warnings=0)

Validation Rules

Errors (Always Fail)

IssueDescription
Missing versionNo openapi or swagger field
Missing infoNo info object
Invalid path itemPath item is not an object
Invalid specSpec is not valid JSON

Warnings (Fail with --strict)

IssueDescription
Missing operationIdOperations without operationId are skipped
Missing responsesNo responses defined for operation
No pathsNo API paths defined
No schemasNo component schemas defined

Why operationId Matters

Operations without operationId will:

  • Not generate operation-based methods (api.op.xxx)
  • Still work with path-based API (api.get("/path"))

Example spec without operationId:

paths:
  /users:
    get:
      # No operationId - will be skipped for operations
      summary: List users

With operationId:

paths:
  /users:
    get:
      operationId: listUsers  # Will generate api.op.listUsers()
      summary: List users

Use Cases

Before Deployment

# Ensure spec is valid before CI/CD
chowbea-axios validate --strict

Debugging Missing Operations

# See which endpoints lack operationId
chowbea-axios validate

Validating External Specs

# Check a spec before using it
chowbea-axios validate --spec ./external-api.json

Exit Codes

CodeMeaning
0Valid (no errors, warnings allowed)
1Errors found, or warnings found with --strict

Next Steps

On this page