From 480679aa32fa7931c444eb914ec9c3067ec0a529 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Sun, 11 Aug 2024 10:12:16 -0400 Subject: [PATCH] Relax restriction on data type in schema (#371) --- src/types/comfyWorkflow.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/types/comfyWorkflow.ts b/src/types/comfyWorkflow.ts index 6e3b6453f..d887ae978 100644 --- a/src/types/comfyWorkflow.ts +++ b/src/types/comfyWorkflow.ts @@ -15,6 +15,11 @@ export const zSlotIndex = z.union([ }) ]) +// TODO: Investigate usage of array and number as data type usage in custom nodes. +// Known usage: +// - https://github.com/rgthree/rgthree-comfy Context Big node is using array as type. +export const zDataType = z.union([z.string(), z.array(z.string()), z.number()]) + // Definition of an AI model file used in the workflow. const zModelFile = z.object({ name: z.string(), @@ -30,13 +35,13 @@ const zComfyLink = z.tuple([ zSlotIndex, // Output slot# of source node zNodeId, // Node id of destination node zSlotIndex, // Input slot# of destination node - z.string() // Data type + zDataType // Data type ]) const zNodeOutput = z .object({ name: z.string(), - type: z.string(), + type: zDataType, links: z.array(z.number()).nullable(), slot_index: zSlotIndex.optional() }) @@ -45,7 +50,7 @@ const zNodeOutput = z const zNodeInput = z .object({ name: z.string(), - type: z.string(), + type: zDataType, link: z.number().nullable(), slot_index: zSlotIndex.optional() })