Skip to main content

normalizeQuery

@webda/ql


Function: normalizeQuery()

normalizeQuery(query): Query

Defined in: packages/ql/src/query.ts:2010

Normalize a query object built or changed by code: every part is checked against what the grammar allows, the query is printed from its data and parsed again

Use it before handing a Query object received from a caller to a backend: field paths (letters, digits, _), operators, values (strings, finite numbers, booleans), LIMIT (non-negative integer) and OFFSET (string) are checked, and the result only holds expressions built by the parser.

Parameters​

query​

Partial<Query>

the query object

Returns​

Query

the same query, as parsed from its canonical text

Throws​

when a part of the query cannot be written in WebdaQL