We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bb387f0 commit c840fe2Copy full SHA for c840fe2
src/core/edgedb/dto.repository.ts
@@ -12,6 +12,7 @@ import { LazyGetter as Once } from 'lazy-get-decorator';
12
import { lowerCase } from 'lodash';
13
import { AbstractClass } from 'type-fest';
14
import {
15
+ ClientException,
16
DBName,
17
EnhancedResource,
18
EnumType,
@@ -162,7 +163,11 @@ export const RepoFor = <
162
163
scope: ScopeOf<Root>,
164
input: SortablePaginationInput,
165
): OrderByExpression {
- // TODO Validate this is a valid sort key
166
+ if (!(input.sort in scope.__element__.__pointers__)) {
167
+ throw new ClientException(
168
+ `'${input.sort}' is not a valid sort key for '${resource.name}'`,
169
+ );
170
+ }
171
return {
172
expression: (scope as any)[input.sort],
173
direction: input.order,
0 commit comments