From d759a6f59bf01ca3e7486375a2533cbdf327af3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Rish=C3=B8j?= Date: Fri, 25 Oct 2024 10:23:20 +0200 Subject: [PATCH] :wrench: fix: avoid side effects from response normalization (fixes #897) --- src/utils.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index 4d97c37b..a2973f93 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -715,13 +715,7 @@ export const getResponseSchemaValidator = ( const compile = (schema: TSchema, references?: TSchema[]) => { const cleaner = (value: unknown) => { - if (!value || typeof value !== 'object') - return Value.Clean(schema, value) - - if (Array.isArray(value)) value = Value.Clean(schema, value) - else value = Value.Clean(schema, value) - - return value + return Value.Clean(schema, structuredClone(value)) } if (dynamic)