From 5a453cf2ce2412c76d90802eca0abdfd55607cff Mon Sep 17 00:00:00 2001 From: nivedin Date: Mon, 12 Feb 2024 16:44:32 +0530 Subject: [PATCH] fix: update schema validation type for restTab test --- .../services/persistence/validation-schemas/index.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/hoppscotch-common/src/services/persistence/validation-schemas/index.ts b/packages/hoppscotch-common/src/services/persistence/validation-schemas/index.ts index ff7e975ec..b5854403d 100644 --- a/packages/hoppscotch-common/src/services/persistence/validation-schemas/index.ts +++ b/packages/hoppscotch-common/src/services/persistence/validation-schemas/index.ts @@ -374,6 +374,10 @@ const EnvironmentVariablesSchema = z.union([ key: z.string(), secret: z.literal(true), }), + z.object({ + key: z.string(), + value: z.string(), + }), ]) export const SECRET_ENVIRONMENT_VARIABLE_SCHEMA = z.union([ @@ -405,7 +409,9 @@ const HoppTestResultSchema = z .object({ additions: z.array(EnvironmentVariablesSchema), updations: z.array( - EnvironmentVariablesSchema.refine((x) => !x.secret).and( + EnvironmentVariablesSchema.refine( + (x) => "secret" in x && !x.secret + ).and( z.object({ previousValue: z.string(), }) @@ -418,7 +424,9 @@ const HoppTestResultSchema = z .object({ additions: z.array(EnvironmentVariablesSchema), updations: z.array( - EnvironmentVariablesSchema.refine((x) => !x.secret).and( + EnvironmentVariablesSchema.refine( + (x) => "secret" in x && !x.secret + ).and( z.object({ previousValue: z.string(), })