Bonnard Docs

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-connection

What 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: id

Invalid Type

# Error: Unknown dimension type "text"
dimensions:
  - name: status
    type: text    # Should be: string
    sql: status

Reference 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: count

Options

OptionDescription
--test-connectionAlso test datasource connections

Exit Codes

CodeMeaning
0All validations passed
1Validation errors found

Best Practices

  1. Run before every deploybon validate && bon deploy
  2. Add to CI/CD — validate on pull requests
  3. Fix errors first — don't deploy with validation errors
  4. Test connections periodically — catch credential issues early

See Also

  • workflow
  • workflow.deploy
  • syntax