Skip to content

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.csv

Success output ​

OK
  template:  template.ectemplate
  controls:  2 (Source Text, Opacity)
  data:      data.csv
  rows:      5 valid

Exit 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.png

Exit code: 3 (DATA_INVALID)

What gets validated ​

CheckExample error
Column matches controlColumn "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 existsfile not found: /path/to/missing.png
Required columns presentcolumn "Source Text" is required
Row column count matches headerexpected 2 columns, found 3

Exit codes for scripting ​

CodeConstantMeaning
0OKAll valid
3DATA_INVALIDValidation failed
bash
lakreet-swarm check --template t.ectemplate --data d.csv
if [ $? -eq 3 ]; then
  echo "Fix data before rendering"
  exit 1
fi

With column mapping ​

Mapping in lakreet.config.json is applied during check:

bash
lakreet-swarm check --template t.ectemplate --data d.csv --config lakreet.config.json

Dry-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 ​

Independent project. Not affiliated with the ArtCraft team or the EffectCraft project.