Introducing a new way to review your PRs.

Read the announcement

bruin-data / dac

DaC is a dashboard-as-code tool. Build interactive dashboards using YAML and JSX. Built-in semantic layer. Get your agents to build standardized, reviewable dashboards.

View on GitHub

20 documents · Updated Nov 23, 2026

docs / interoperability-and-schemas

Interoperability and declarative contracts

DAC uses clear contracts to move dashboard content between external tools and version-controlled project files. Importers translate outside dashboard descriptions into DAC definitions, exporters turn validated dashboards into presentation formats, and versioned schemas keep declarative files understandable across tool versions.

Interoperability boundary

The interoperability boundary is the point where DAC accepts or produces a format owned by another system. DAC keeps its dashboard definition as the stable center of these exchanges, so an external format can change without changing the meaning of the project source.

The main exchange paths are:

  • External dashboard to DAC: An importer reads a saved document or a live service response and creates DAC dashboard content.
  • DAC to external presentation: An exporter reads a dashboard, runs its data work, and creates a presentation in an outside service.
  • DAC file to validated project object: The loader applies a declarative contract before the dashboard enters normal validation, serving, or build flows.

The following diagram shows how external content enters DAC, how declarative contracts protect the center, and how dashboard data can leave through an export target.

flowchart LR
    A[External dashboard format] --> B[Import conversion]
    B --> C[DAC dashboard definition]
    D[Versioned YAML contract] --> C
    C --> E[Meaning and reference checks]
    E --> F[Viewer or static build]
    E --> G[External presentation]

External format exchange

DAC treats an external dashboard format as input to a conversion flow, not as the project’s source of truth. The conversion preserves useful dashboard intent such as cards, filters, query sources, and layout while reporting content that the DAC model cannot represent.

The current dashboard import path accepts Metabase API JSON or YAML. It can also fetch a live Metabase dashboard when the caller provides the service address, dashboard ID, and an API key or session token. The result is DAC YAML and may include generated semantic model files when explicit Metabase models or metrics can be represented in DAC.

The conversion has an important portability rule: supported content becomes DAC widgets or queries, while unsupported content becomes a visible placeholder by default. Strict mode changes that trade-off into a failure, which lets a migration stop instead of producing a partial dashboard.

See Project import and export conversion for the detailed conversion page.

References: cmd/import.go• L19-25 cmd/import.go• L29-87 pkg/…/convert.go• L74-185

Dashboard presentation export

DAC can use a validated dashboard as the source for an external presentation. The Google Slides export resolves the dashboard’s filters and widget work, runs the needed queries, and creates a new presentation whose title slide and content slides reflect the dashboard structure.

The export is a presentation view, not a round-trip dashboard format. Metrics and tables become slide content, charts become images, and data that cannot be rendered is represented with a placeholder. The created presentation is returned as a Google Slides URL after temporary chart assets are removed.

References: cmd/export.go• L12-19 cmd/export.go• L22-71 pkg/…/export.go• L46-146 pkg/…/export.go• L183-229

Declarative contract model

Declarative contracts define the shape and identity of files that describe dashboards and themes. They make project files portable because the meaning of a document is tied to a stable schema identifier instead of an internal file location or a particular loader version.

Versioned document contracts

DAC currently uses embedded v1 contracts for dashboard and theme documents. A schema identifier is a stable URL that names both the document kind and its contract version. The schema field is optional for authors; when it is absent, DAC uses the current v1 contract for the document kind. When it is present, it must match that contract.

The dashboard contract requires a name and at least one row. It describes the shared language for filters, queries, rows, widgets, and chart or table encodings. Widgets can hold query-backed or supplied data and can express metrics, charts, tables, pivot tables, text, dividers, images, and switchable tab views. Widgets and tab views can also map data fields to dashboard filters for cross-filter actions. Charts can describe multiple value axes, reference lines or bands, heatmap scales, and per-series or per-slice style choices. Tables can describe image or sparkline columns and grouped display columns. A tab view contains complete child widgets and cannot contain another tab view. Dashboards can also define reusable notes and link them to widgets through dimension-based scope. The contract covers chart-specific encoding and styling choices, including custom Vega-Lite specifications, table image columns, pivot configuration, and conditional formatting. It allows x- extension fields for local metadata while rejecting other unknown fields. The theme contract requires a name and at least one string token map, with an optional parent theme. It also permits x- extension fields while rejecting other unknown fields.

The contract also enforces type-specific combinations. A pivot table must provide pivot settings, a non-pivot widget cannot use them, and pivot table columns use text rendering. A sparkline column must provide both of its encodings, while grouped and collapsed columns must follow their group rules. These rules keep the declarative form aligned with the meaning of the dashboard feature rather than only checking isolated field types.

ContractPurposeMain boundary
Dashboard v1Describes dashboard content and layoutDashboard YAML loading and conversion output
Theme v1Describes named presentation tokensTheme loading and visual configuration
Semantic model contractDescribes reusable dimensions and metricsSemantic model loading used by dashboard meaning checks

See Versioned declarative schemas for the contract details and the distinction between structure checks and meaning checks.

References: schemas/embed.go• L12-18 schemas/embed.go• L26-43 schemas/…/schema.json• L1-60 schemas/…/schema.json• L123-134 schemas/…/schema.json• L206-467 schemas/…/schema.json• L469-602 schemas/…/schema.json• L528-662 schemas/…/schema.json• L720-943 schemas/…/schema.json• L1009-1100 schemas/…/schema.json• L1-29 docs/…/schemas.md• L5-11

Validation boundary

Validation has two layers with different jobs. Structural validation checks whether a document follows its selected contract, while dashboard validation checks whether the named parts work together as a project.

The structural layer checks required fields, types, allowed values, collection sizes, type-specific combinations, and unknown fields. The meaning layer checks relationships such as query references, semantic model references, widget data sources, layout limits, and valid combinations of chart or filter fields. A document can therefore have valid field shapes and still fail because a referenced project object does not exist or because the requested combination has no valid meaning.

The normal load path applies the dashboard contract before it creates the in-memory dashboard. The same contract boundary supports validation, checking, serving, and building. Import conversion also validates the generated dashboard before it reports success, so imported output enters the same trust boundary as hand-written YAML. The schema test suite checks minimal dashboard and theme documents, repository YAML, optional schema fields, and representative dashboard features such as notes, Vega-Lite charts, pivot tables, tab views, image and sparkline columns, filter placement, widget sizing, and conditional formatting constraints. It also checks newer chart and widget contract forms through valid and invalid examples, so schema changes remain tied to the behavior authors can declare.

References: pkg/…/loader.go• L103-126 pkg/…/validator.go• L37-160 pkg/…/validator.go• L219-238 pkg/…/convert.go• L179-185 schemas/schema_test.go• L9-311 schemas/schema_test.go• L313-678 schemas/schema_test.go• L680-721

Project contract relationships

The dashboard contract does not stand alone. A dashboard can point to semantic models, connections, queries, and filters, so the loader joins these project resources before meaning checks and later data work use them.

Semantic models provide reusable dimensions and metrics for dashboard queries. The dashboard may select a model directly or map a local name to one. This relationship is outside the basic JSON shape check; the model must be present and its query must be valid before DAC can treat the dashboard as usable.

External conversion must respect the same relationships. For example, semantic import creates model files only for explicit external models that have enough source and field information. A model-backed card that cannot be expressed in the semantic layer can remain SQL-backed or fail in strict mode, depending on the migration choice.

References: pkg/…/project.go• L15-75 pkg/…/model.go• L447-482 pkg/…/validator.go• L134-154 pkg/…/semantic.go• L46-161 pkg/…/semantic.go• L164-285

Change checklist

When these files or sections are changed, remember to consider these:

  • Change a contract version as one unit across the public identifier, embedded schema, default selection, and any conversion output that writes the identifier.
  • When a dashboard field names another project object, update both the structural contract and the meaning checks that resolve the name.
  • When a widget feature or type-specific rule changes, update representative schema validation cases and review import conversion output for the same contract.
  • When cross-filter mappings change, keep the field-to-filter shape aligned for both top-level widgets and tab children. Review the dashboard behavior that consumes those mappings.
  • When a tab view changes, keep the container and child-widget rules aligned. Review that child tabs remain complete widgets and cannot nest another tab view.
  • When table column display modes change, keep the rules for image, sparkline, grouped, and collapsed columns aligned with the dashboard consumers.
  • When an external format gains or loses a supported concept, review the conversion result, warning or strict-mode behavior, and the target contract together.
  • When a widget or query contract changes, review Google Slides rendering because export consumes the validated dashboard rather than the external source format.
  • When semantic model fields change, review dashboard model references and external semantic import because both depend on the shared model relationship.

Important failure modes

TriggerConsequenceGuard
An input declares a schema identifier from another versionStructural validation rejects the document instead of guessing its meaningUse the matching contract identifier or omit schema only when the current default is intended
An imported external card uses a feature DAC cannot representThe import creates a visible placeholder or stops in strict modeReview warnings and use strict mode when partial conversion is not acceptable
A dashboard has a valid field shape but names a missing query or semantic modelLoading or meaning validation fails before normal useKeep referenced project resources aligned with dashboard names
A cross-filter mapping omits its field or filter name, or uses an empty valueStructural validation rejects the widget or tab definitionProvide a non-empty field-to-filter mapping for each cross-filter action
A dashboard note omits its required dimensionsSchema validation rejects the dashboard before it enters the projectDefine the note’s dimension scope even when the list is intentionally empty
A pivot-table setting is used with a different widget type, or a pivot table lacks its pivot definitionSchema validation rejects the dashboard before it enters the projectKeep widget type and type-specific fields aligned
A tab view contains a nested tab view or a child tab omits its own widget typeSchema validation rejects the dashboard before it enters the projectKeep tab containers flat and define each child as a complete widget
A sparkline column omits an x or y encoding, or uses a format rule that the column type does not supportSchema validation rejects the table definitionProvide both sparkline encodings and use the supported scalar format form
A grouped table column is hidden, or a collapsed column has no groupSchema validation rejects the table definitionKeep group, hidden, and collapsed settings consistent
A chart or table is valid in YAML but has no usable query resultThe viewer or presentation export shows an empty or placeholder resultValidate the data source and query behavior before relying on an export
An external model lacks source SQL or a supported metric shape during semantic importThe generated project cannot use that model semantically, or strict import failsKeep SQL fallback enabled unless semantic completeness is required

Key files

FileWhy to read it
schemas/embed.goDefines the public contract identifiers and the shared schema validation boundary.
schemas/…/schema.jsonDefines the stable dashboard document language used by authors and converters.
schemas/…/schema.jsonDefines the theme document boundary and extension rule.
schemas/schema_test.goShows the supported document forms and the rules that must remain valid across schema changes.
pkg/…/loader.goShows where dashboard files cross from project text into validated dashboard objects.
pkg/…/validator.goShows the meaning checks that follow structural validation.
pkg/…/project.goShows how dashboards connect to semantic model and theme project resources.
cmd/import.goDefines the external dashboard import interface and its conversion choices.
pkg/…/convert.goShows how an external dashboard becomes DAC content and is checked before use.
cmd/export.goDefines the presentation export interface.
pkg/…/export.goShows how a validated dashboard becomes a Google Slides presentation.
docs/project-import-export.mdChild page for import and export conversion behavior.
docs/declarative-schemas.mdChild page for versioned declarative contracts and validation boundaries.