Skip to content

Commit 819a787

Browse files
committed
fix decimal schema
1 parent d1dd828 commit 819a787

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/schema/src/plugins/zod/generator.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,14 @@ export class ZodSchemaGenerator {
224224
import { z } from 'zod';
225225
export const DecimalSchema = z.any().refine((val) => {
226226
if (typeof val === 'string' || typeof val === 'number') {
227-
return val;
227+
return true;
228228
}
229229
// Decimal.js shape
230230
if (typeof val === 'object' && val && Array.isArray(val.d) && typeof val.e === 'number' && typeof val.s === 'number') {
231-
return val;
231+
return true;
232232
}
233-
});
233+
return false;
234+
}, { message: 'Not a valid Decimal value'});
234235
`,
235236
{ overwrite: true }
236237
)

0 commit comments

Comments
 (0)