Skip to content

contextDecls

contextDecls(desc): Decl[]

Defined in: packages/aip/src/filtering/context.ts:21

Generate filter type declarations from a protobuf message descriptor. Each field on the message becomes a top-level ident declaration, allowing filter expressions to reference fields directly without a prefix.

DescMessage

Decl[]

import { TimestampSchema } from "@bufbuild/protobuf/wkt";
const decls = contextDecls(TimestampSchema);
// → [ident("seconds", INT64), ident("nanos", INT64)]
const { checkedExpr } = check(parsed, { decls });
// filter: "seconds < 4 AND nanos > 50"