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
- Required fields -
openapi/swaggerversion,infoobject - Paths structure - Valid path items and HTTP methods
- Operation IDs - Missing operationId warnings
- Response definitions - Missing responses
- Components/Schemas - Schema definitions present
Flags
| Flag | Short | Description | Default |
|---|---|---|---|
--config | -c | Path to api.config.toml | Auto-detected |
--spec | -s | Path to OpenAPI spec file | From cache |
--strict | - | Treat warnings as errors | false |
--quiet | -q | Suppress non-error output | false |
--verbose | -v | Show detailed output | false |
Examples
Validate Cached Spec
chowbea-axios validateValidate Specific File
chowbea-axios validate --spec ./openapi.jsonStrict Mode
# Fail on warnings too
chowbea-axios validate --strictOutput
No Issues
╭────────────────────────────────────────
│ chowbea-axios validate
├────────────────────────────────────────
│
│ ✓ Validating OpenAPI spec... (specPath=app/services/api/_internal/openapi.json)
│
╰────────────────────────────────────────
│
│ ✓ Validation complete (errors=0, warnings=0)
│ ✓ OpenAPI spec is validWith 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 validWith 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)
| Issue | Description |
|---|---|
| Missing version | No openapi or swagger field |
| Missing info | No info object |
| Invalid path item | Path item is not an object |
| Invalid spec | Spec is not valid JSON |
Warnings (Fail with --strict)
| Issue | Description |
|---|---|
| Missing operationId | Operations without operationId are skipped |
| Missing responses | No responses defined for operation |
| No paths | No API paths defined |
| No schemas | No 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 usersWith operationId:
paths:
/users:
get:
operationId: listUsers # Will generate api.op.listUsers()
summary: List usersUse Cases
Before Deployment
# Ensure spec is valid before CI/CD
chowbea-axios validate --strictDebugging Missing Operations
# See which endpoints lack operationId
chowbea-axios validateValidating External Specs
# Check a spec before using it
chowbea-axios validate --spec ./external-api.jsonExit Codes
| Code | Meaning |
|---|---|
| 0 | Valid (no errors, warnings allowed) |
| 1 | Errors found, or warnings found with --strict |