SurrealDB Docs Logo

Enter a search query

Validate command

The validate command validates one or many SurrealQL (.surql) language files.

BEFORE YOU START

Make sure you’ve installed SurrealDB — it should only take a second!

Command options

ArgumentsDescription
[PATTERNS]

Glob pattern for the files to validate [default: ”**/*.surql”]

Example usage

To perform validation on a SurrealQL local file, in a terminal run the surreal validate command with the required argument.

Using the command on its own will validate all the .surql files in the current directory.

surreal validate user1.surql: OK user2.surql: OK user3.surql: OK

You can perform validation on a single file, regardless of extension.

surreal validate user.surql
surreal validate user.txt

You can also perform validation on multiple files using a single glob pattern:

# equivalent to "surreal validate"
surreal validate **/*.surql

Finally, you can also perform validation on multiple files using multiple paths/patterns:

surreal validate index.surql schemas/*.surql queries/*.surql
surreal validate *.(txt|surql)

If any files are invalid, the command will abort at this point and return an error.

surreal validate user1.surql: OK user2.surql: KO Parse error: Unexpected token `an identifier`, expected Eof --> [1:15] | 1 | CREATE person SE name = "Billy"; | ^^

Command help

To see the help information and usage instructions, in a terminal run the surreal validate --help command without any further arguments. This command gives general information on the arguments, inputs, and additional options for the validate command.

surreal validate --help

The output of the above command:

Validate SurrealQL query files Usage: surreal validate [OPTIONS] [PATTERNS]... Arguments: [PATTERNS]... Glob pattern for the files to validate [default: **/*.surql] Options: -l, --log <LOG> The logging level for the command-line tool [env: SURREAL_LOG=] [default: info] [possible values: none, full, error, warn, info, debug, trace] -h, --help Print help