Skip to content

Commit

Permalink
🔧 fix: avoid side effects from response normalization (fixes #897)
Browse files Browse the repository at this point in the history
  • Loading branch information
crishoj committed Oct 25, 2024
1 parent 9007186 commit d759a6f
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d759a6f

Please # to comment.