Skip to content

Scheduling infrastructure for absolutely everyone.

Fix raycast bug (#18756)

Syed Ali Shahbaz02ef6dc93461
diff --git a/apps/api/v1/lib/validations/shared/jsonSchema.ts b/apps/api/v1/lib/validations/shared/jsonSchema.ts
index bfc7ae1f2b9..423b28e9552 100644
--- a/apps/api/v1/lib/validations/shared/jsonSchema.ts
+++ b/apps/api/v1/lib/validations/shared/jsonSchema.ts
@@ -1,9 +1,11 @@
import { z } from "zod";
// Helper schema for JSON fields
-type Literal = boolean | number | string;
+type Literal = boolean | number | string | null;
type Json = Literal | { [key: string]: Json } | Json[];
-const literalSchema = z.union([z.string(), z.number(), z.boolean()]);
+const literalSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]);
+const jsonObjectSchema = z.record(z.lazy(() => jsonSchema));
+const jsonArraySchema = z.array(z.lazy(() => jsonSchema));
export const jsonSchema: z.ZodSchema<Json> = z.lazy(() =>
- z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)])
+ z.union([literalSchema, jsonObjectSchema, jsonArraySchema])
);