Statically validates TypeQL files, without a running TypeDB server.
mix typedb.check
mix typedb.check priv/typeql/schema.tql
mix typedb.check "priv/**/*.tql" "test/fixtures/*.tql"With no arguments, every **/*.tql file under priv/ is checked.
This wraps TypeDB's typeql-check CLI, which parses a query and reports syntax
errors. Install it first — see
https://typedb.com/docs/home/install/typeql-check/:
# macOS
brew install typedb/tap/typeql-check
# Linux
sudo apt install typeql-checkThe task exits non-zero when any file fails to parse, so it drops straight into
a CI pipeline. If typeql-check is not installed, the task says so and exits
non-zero rather than silently passing.
Options
--binary PATH— path to thetypeql-checkexecutable. Defaults totypeql-checkonPATH, overridable with theTYPEQL_CHECKenvironment variable.--warn-only— report problems but exit0.
What it does and does not catch
typeql-check validates syntax. It knows nothing about your schema, so an
undefined type or a mistyped attribute still parses cleanly and will only fail
when TypeDB runs it. Use TypeDB.Transaction.analyze/3 against a real database
for schema-aware checking.
Requirements
A POSIX shell on PATH. Each file is fed to typeql-check on stdin, because
passing a schema as a command-line argument fails with E2BIG once it grows
past roughly a megabyte — and neither System.cmd/3 nor Erlang's ports can
write a child's stdin and then close it. Linux, macOS and the BSDs have one;
on Windows, run the task from Git Bash, WSL or MSYS2.
Only this task needs a shell. The driver itself is pure Elixir and runs anywhere the BEAM does.