浏览代码

coerce character id to number in schema

Jason Gorst 4 天之前
父节点
当前提交
61a6f6fe18
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      shared/utils/schema/character.js

+ 3 - 1
shared/utils/schema/character.js

@@ -1,5 +1,7 @@
 export const characterSchema = z.object({
-  id: z.number().int().positive(),
+  // coerce id to number since normalizer plugin wants string ids, and this way
+  //   we can just use strings on the client side
+  id: z.coerce.number().int().positive(),
   player: z.string().trim().min(1),
   mortalName: z.string().trim(),
   faeName: z.string().trim(),