# `mix typedb.check`
[🔗](https://github.com/NoeticEcho/TypedbEx/blob/v0.11.0/typedb/lib/mix/tasks/typedb.check.ex#L1)

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-check

The 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 the `typeql-check` executable. Defaults to
    `typeql-check` on `PATH`, overridable with the `TYPEQL_CHECK` environment
    variable.
  * `--warn-only` — report problems but exit `0`.

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
