# Spec validation

> Spec validation checks a dashboard spec against a schema before it is saved, so malformed panels, unknown properties, and off-list values are rejected early.

Canonical: https://dvt.dev/glossary/spec-validation/

Spec validation is the step that checks a dashboard spec against a formal schema before it is saved, so a malformed panel, an unknown property, or an invalid value is rejected with a clear error instead of reaching a viewer.

Validation is what makes a dashboard document trustworthy as code. A text format with no schema is only a convention; a format with a schema is a contract that every author, human or agent, is held to.

## How it works in dvt

Every write to a dvt [dashboard spec](https://dvt.dev/glossary/dashboard-spec) is validated against a published JSON Schema before it saves, whether it comes from the browser editor, the REST API, or the [MCP server](https://dvt.dev/glossary/mcp-model-context-protocol). Agents can also call the validate tool on a draft at any point. The schema covers structure (required fields, known panel types) and values (for example, a theme preset must be a named, built-in preset, and a font stack must come from an allowed list). Unknown properties in the panel, layout, and theme structure are rejected rather than silently ignored, so a misspelled setting never looks like it worked. Chart options pass through to Apache ECharts, where an advisory lint warns on keys it does not recognize.

A validation error points at the failing field, which gives an [agent](https://dvt.dev/glossary/agent-built-dashboard) something concrete to fix before it tries again. Validation runs first in the validate, [preview](https://dvt.dev/glossary/dashboard-preview), apply loop, so every change that reaches a live dashboard has already passed the schema.

## Related terms

- [Preview (dry run)](https://dvt.dev/glossary/dashboard-preview)
- [Dashboard spec](https://dvt.dev/glossary/dashboard-spec)
- [Agent-built dashboard](https://dvt.dev/glossary/agent-built-dashboard)
- [Dashboards as code, the dvt implementation](https://dvt.dev/solutions/dashboards-as-code)
