We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 76b6709 commit 5d41830Copy full SHA for 5d41830
1 file changed
packages/protovalidate/src/cel.ts
@@ -24,6 +24,7 @@ import {
24
type CelEnv,
25
CelError,
26
CelList,
27
+ CelObject,
28
type CelResult,
29
type CelVal,
30
createEnv,
@@ -234,6 +235,18 @@ function createCustomFuncs(): FuncRegistry {
234
235
},
236
),
237
);
238
+ reg.add(
239
+ Func.binary(
240
+ "getField",
241
+ ["dyn_string_get_field_dyn"],
242
+ (id: number, lhs: CelVal, rhs: CelVal): CelResult | undefined => {
243
+ if (typeof rhs == "string" && lhs instanceof CelObject) {
244
+ return lhs.accessByName(id, rhs);
245
+ }
246
+ return undefined;
247
+ },
248
+ ),
249
+ );
250
return reg;
251
}
252
0 commit comments