Skip to content

Commit

Permalink
🎉 release: 1.1.25
Browse files Browse the repository at this point in the history
  • Loading branch information
SaltyAom committed Nov 14, 2024
1 parent d52c0b1 commit 1bc60d7
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ export const getSchemaValidator = <T extends TSchema | string | undefined>(
Check: (value: unknown) => Value.Check(schema, value),
Errors: (value: unknown) => Value.Errors(schema, value),
Code: () => '',
Clean: cleaner,
Clean: createCleaner(schema),
Decode: (value: unknown) => Value.Decode(schema, value),
Encode: (value: unknown) => Value.Encode(schema, value)
} as unknown as TypeCheck<TSchema>
Expand Down Expand Up @@ -728,21 +728,6 @@ export const getResponseSchemaValidator = (
const maybeSchemaOrRecord = typeof s === 'string' ? models[s] : s

const compile = (schema: TSchema, references?: TSchema[]) => {
const cleaner = (value: unknown) => {
if (typeof value === 'object')
try {
return Value.Clean(schema, structuredClone(value))
} catch {
try {
return Value.Clean(schema, value)
} catch {
return value
}
}

return value
}

if (dynamic)
return {
schema,
Expand All @@ -752,6 +737,7 @@ export const getResponseSchemaValidator = (
Check: (value: unknown) => Value.Check(schema, value),
Errors: (value: unknown) => Value.Errors(schema, value),
Code: () => '',
Clean: createCleaner(schema),
Decode: (value: unknown) => Value.Decode(schema, value),
Encode: (value: unknown) => Value.Encode(schema, value)
} as unknown as TypeCheck<TSchema>
Expand Down

0 comments on commit 1bc60d7

Please sign in to comment.