Validate
Check cubes and views for errors before deploying.
Overview
The bon validate command checks your YAML cubes and views for syntax errors, schema violations, and optionally tests data source connections. Run this before deploying to catch issues early.
Usage
# Basic validation
bon validate
# Also test data source connections
bon validate --test-connectionWhat Gets Validated
YAML Syntax
- Valid YAML format
- Proper indentation
- Correct quoting
Schema Compliance
- Required fields present (name, type, sql)
- Valid field values (known measure types, relationship types)
- Consistent naming conventions
Reference Integrity
- Referenced cubes exist
- Referenced members exist
- Join relationships are valid
Connection Testing (--test-connection)
- Data source credentials work
- Database is accessible
- Tables/schemas exist
Example Output
Success
✓ Validating YAML syntax...
✓ Checking bonnard/cubes/orders.yaml
✓ Checking bonnard/cubes/users.yaml
✓ Checking bonnard/views/orders_overview.yaml
All cubes and views valid.Errors
✗ Validating YAML syntax...
bonnard/cubes/orders.yaml:15:5
error: Unknown measure type "counts"
Did you mean "count"?
14: measures:
15: - name: order_count
16: type: counts <-- here
17: sql: id
1 error found.Connection Warnings
✓ Validating YAML syntax...
✓ All cubes and views valid.
⚠ Testing connections...
⚠ datasource "analytics": Connection timed out
(This won't block deploy, but queries may fail)Common Errors
Missing Required Field
# Error: "sql" is required
measures:
- name: count
type: count
# Missing: sql: idInvalid Type
# Error: Unknown dimension type "text"
dimensions:
- name: status
type: text # Should be: string
sql: statusReference Not Found
# Error: Cube "user" not found (did you mean "users"?)
joins:
- name: user
relationship: many_to_one
sql: "\{CUBE\}.user_id = \{user.id\}"YAML Syntax
# Error: Bad indentation
measures:
- name: count # Should be indented
type: countOptions
| Option | Description |
|---|---|
--test-connection | Also test datasource connections |
Exit Codes
| Code | Meaning |
|---|---|
| 0 | All validations passed |
| 1 | Validation errors found |
Best Practices
- Run before every deploy —
bon validate && bon deploy - Add to CI/CD — validate on pull requests
- Fix errors first — don't deploy with validation errors
- Test connections periodically — catch credential issues early
See Also
- workflow
- workflow.deploy
- syntax