Skip to content

FilterNodeSchema

const FilterNodeSchema: z.ZodType<FilterNode>;

Defined in: filters/schemas-zod.ts:355

Recursive and/or/not tree (the model’s FilterNode), annotated as z.ZodType<FilterNode> for recursion without a cast.

import { FilterNodeSchema } from "@xtandard/lib/filters/zod";
const input = {
type: "or",
nodes: [
{ type: "column", field: "status", filter: { kind: "enum", operator: "eq", value: "open" } },
{
type: "not",
node: { type: "column", field: "name", filter: { kind: "text", operator: "isNull" } },
},
],
};
FilterNodeSchema.parse(input);
// → `input`, typed as `FilterNode`
FilterNodeSchema.safeParse({ type: "xor", nodes: [] }).success;
// → false (unknown connective)