Skip to main content

validateQueryFields

@webda/ql


Function: validateQueryFields()

validateQueryFields(query, allowedFields): void

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

Validate the SELECT fields, the aggregation metric fields and the UPDATE SET targets of a query against the allowed fields

A dotted path is allowed when it is listed, or when one of its parents is (profile.email is allowed by profile or by profile.email). GROUP BY paths are the SELECT fields; the field of every aggregation metric (SUM(points)) is checked too, COUNT(*) has none. Filter attributes are not checked.

Parameters​

query​

Pick<Query, "fields" | "assignments" | "aggregation">

parsed query to validate

allowedFields​

string[]

allowed field paths (dot-notation)

Returns​

void

Throws​

if a field, a metric field or an assignment target is not allowed