From 67ee197d9b9e4bc74766908bafcd53c92f55a348 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Mon, 16 Jan 2023 17:22:34 +0100 Subject: [PATCH] :children_crossing: (dashboard) Soften imported bot model check --- .../templates/components/ImportTypebotFromFileButton.tsx | 9 +++------ apps/docs/openapi/chat/_spec_.json | 3 ++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/apps/builder/src/features/templates/components/ImportTypebotFromFileButton.tsx b/apps/builder/src/features/templates/components/ImportTypebotFromFileButton.tsx index bcc0bb3c0d..d3d1f32c5e 100644 --- a/apps/builder/src/features/templates/components/ImportTypebotFromFileButton.tsx +++ b/apps/builder/src/features/templates/components/ImportTypebotFromFileButton.tsx @@ -1,8 +1,9 @@ import { useToast } from '@/hooks/useToast' import { readFile } from '@/utils/helpers' import { Button, ButtonProps, chakra } from '@chakra-ui/react' -import { Typebot, typebotSchema } from 'models' +import { groupSchema, Typebot } from 'models' import React, { ChangeEvent } from 'react' +import { z } from 'zod' type Props = { onNewTypebot: (typebot: Typebot) => void @@ -20,11 +21,7 @@ export const ImportTypebotFromFileButton = ({ const fileContent = await readFile(file) try { const typebot = JSON.parse(fileContent) - typebotSchema.parse({ - ...typebot, - createdAt: new Date(), - updatedAt: new Date(), - }) + z.array(groupSchema).parse(typebot.groups) onNewTypebot(typebot) } catch (err) { console.error(err) diff --git a/apps/docs/openapi/chat/_spec_.json b/apps/docs/openapi/chat/_spec_.json index dfd4bf3797..c59223527b 100644 --- a/apps/docs/openapi/chat/_spec_.json +++ b/apps/docs/openapi/chat/_spec_.json @@ -3146,7 +3146,8 @@ }, "prefilledVariables": { "type": "object", - "additionalProperties": {} + "additionalProperties": {}, + "description": "[More info about prefilled variables.](https://docs.typebot.io/editor/variables#prefilled-variables)" } }, "required": [