Validate first
Always run check before render. It validates template + data without rendering anything.
Basic usage
bash
lakreet-swarm check --template template.ectemplate --data data.csvSuccess output
OK
template: template.ectemplate
controls: 2 (Source Text, Opacity)
data: data.csv
rows: 5 validExit code: 0
Error output
Found 3 problem(s) in data.csv:
- Line 3, column "Opacity": "abc" is not a number.
- Line 5, column "Source Text": column "Source Text" is required.
- Line 7, column "Logo": file not found: /assets/missing.pngExit code: 3 (DATA_INVALID)
What gets validated
| Check | Example error |
|---|---|
| Column matches control | Column "Foo" is not a control of the template |
| Slider = number | "abc" is not a number |
| Checkbox = boolean | "yes" is not a boolean (accepts true/false/yes/no/1/0/ya/tidak) |
| Media file exists | file not found: /path/to/missing.png |
| Required columns present | column "Source Text" is required |
| Row column count matches header | expected 2 columns, found 3 |
Exit codes for scripting
| Code | Constant | Meaning |
|---|---|---|
| 0 | OK | All valid |
| 3 | DATA_INVALID | Validation failed |
bash
lakreet-swarm check --template t.ectemplate --data d.csv
if [ $? -eq 3 ]; then
echo "Fix data before rendering"
exit 1
fiWith column mapping
Mapping in lakreet.config.json is applied during check:
bash
lakreet-swarm check --template t.ectemplate --data d.csv --config lakreet.config.jsonDry-run render
Alternative: render --dry-run does the same validation but exits 0 on success:
bash
lakreet-swarm render --template t.ectemplate --data d.csv --dry-run
# 5 row(s) valid. Dry run: nothing rendered.In CI pipelines
yaml
# .github/workflows/ci.yml
- name: Validate data
run: lakreet-swarm check --template ${{ env.TEMPLATE }} --data ${{ env.DATA }}Fails fast, no render cost, clear error messages.
Next steps
- Prepare a CSV — avoid common validation errors
- Map columns — fix header mismatches
- Troubleshoot — all error codes & fixes