From 03e8e40052cc3eca8c6be5401db119cd18f6c9fb Mon Sep 17 00:00:00 2001 From: Adebesin Cell Date: Fri, 22 Nov 2024 12:58:46 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8chore:=20adds=20default=20empty=20a?= =?UTF-8?q?rray=20for=20linkedWikis,=20transforms=20null=20values?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/serious-foxes-visit.md | 5 +++++ src/schema/index.ts | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 .changeset/serious-foxes-visit.md diff --git a/.changeset/serious-foxes-visit.md b/.changeset/serious-foxes-visit.md new file mode 100644 index 0000000..79f86aa --- /dev/null +++ b/.changeset/serious-foxes-visit.md @@ -0,0 +1,5 @@ +--- +"@everipedia/iq-utils": patch +--- + +Fixes null to array transform for linked wikis diff --git a/src/schema/index.ts b/src/schema/index.ts index b006626..9f47e82 100644 --- a/src/schema/index.ts +++ b/src/schema/index.ts @@ -255,18 +255,23 @@ export const Wiki = z .object({ [LinkedWikiKey.Enum.blockchains]: z .array(z.string()) - .nullish() + .nullable() + .transform((val) => val ?? []) .default([]), + [LinkedWikiKey.Enum.founders]: z .array(z.string()) - .nullish() + .nullable() + .transform((val) => val ?? []) .default([]), + [LinkedWikiKey.Enum.speakers]: z .array(z.string()) - .nullish() + .nullable() + .transform((val) => val ?? []) .default([]), }) - .nullish() + .nullable() .default({}), }) .refine(isEventWikiValid, {