Validate a template with data
validate_templateValidates a template and its data without rendering, catching syntax errors, missing variables, and schema violations before you produce a document.
Instructions
Checks a template and its data without rendering: free, no units, nothing stored, no document produced. Call it before render when you assembled the data yourself, or after writing ad-hoc html. With template, the API checks the published version (else the latest) as a render would: syntax, header and footer, errors only this data triggers, and the data against the stored JSON Schema (a wrong type or a missing required field is an error). With html and engine it compiles offline and reports syntax errors, unknown filters and variables missing from data. Returns ok and diagnostics (severity, code, message, plus path, line and column, or part and paragraph for Word and PowerPoint). Warnings leave ok true: settle each before rendering.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | The data the document will be rendered with, shaped as get_template_schema describes. Left out, a stored template is checked with its sample data | |
| html | No | Template source to check offline, when there is no stored template; pass this or template | |
| engine | No | Template language of html; required with html | |
| template | No | Slug or tpl_ id of a stored template; pass this or html |