MCPcopy Index your code
hub / github.com/directus/directus / validateSort

Function validateSort

api/src/utils/validate-query.ts:249–258  ·  view source on GitHub ↗
(sort: string[])

Source from the content-addressed store, hash-verified

247}
248
249function validateSort(sort: string[]) {
250 for (const sortField of sort) {
251 const field = sortField.startsWith('-') ? sortField.slice(1) : sortField;
252
253 if (extractFunctionName(field) === 'json') {
254 // throws InvalidQueryError on invalid json() syntax
255 parseJsonFunction(field);
256 }
257 }
258}
259
260function validateRelationalDepth(query: Query) {
261 const maxRelationalDepth = Number(env['MAX_RELATIONAL_DEPTH']) > 2 ? Number(env['MAX_RELATIONAL_DEPTH']) : 2;

Callers 1

validateQueryFunction · 0.85

Calls 3

parseJsonFunctionFunction · 0.90
extractFunctionNameFunction · 0.85
sliceMethod · 0.80

Tested by

no test coverage detected