assertSelectFields
Function: assertSelectFields()
assertSelectFields(
model,query):void
Defined in: packages/core/src/models/permissions.ts:522
Check the field list of a client query (SELECT f1, f2.g) against what a client can see of the model
A selected path must start with a field of the Output schema of the model or of one of its subclasses (a query on a model returns the rows of its subclasses), or with a primary key field. The Stored and Input schemas are not used: they can name server-only fields. A model without Output schema metadata of its own is not checked: unknown paths are then absent from the results.
The error names the refused path only, and is decided from the schema, never from the rows.
Parameters
model
any
the queried model class
query
QueryValidator
the parsed client query
Returns
void
Throws
WebdaError.BadRequest for more than MAX_SELECT_FIELDS paths, a path deeper than
MAX_SELECT_DEPTH, a constructor or prototype segment, or a path that is not in the Output schema