fix: temporarily revert stricter schema so we can handle invalid DB e… (#17774)

This commit is contained in:
Alex van Andel
2024-11-20 21:35:43 -07:00
committed by GitHub
parent 8bc2c08288
commit 5d51c79739
+15 -1
View File
@@ -1,6 +1,20 @@
import { z } from "zod";
export const raqbChildSchema = z.object({
type: z.string().optional(),
properties: z
.object({
field: z.any().optional(),
operator: z.any().optional(),
value: z.any().optional(),
valueSrc: z.any().optional(),
valueError: z.array(z.union([z.string(), z.null()])).optional(),
valueType: z.any().optional(),
})
.optional(),
/*
* TODO: (emrysal) This schema is good, but our DB contains invalid entries-
* instead of crashing on read we need to handle this on write first.
type: z.union([z.literal("rule"), z.literal("rule_group")]),
properties: z.object({
// This is RAQB field that is used in the rules. The aluealue we provide here is used as a lookup key in RAQB_CONFIG.fields
@@ -21,7 +35,7 @@ export const raqbChildSchema = z.object({
// Type of the value - can be text, number, boolean, date, time, datetime, select, multiselect, treeselect, treemultiselect and maybe more
// We only use a few of them in our app
valueType: z.array(z.string()).optional(),
}),
}),*/
});
// The actual schema of children1 is quite complex, we don't want to worry about that at the moment.