Skip to content

Commit 3385c75

Browse files
committed
update
1 parent e9cac0a commit 3385c75

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

packages/runtime/src/client/crud/validator/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,8 @@ export class InputValidator<Schema extends SchemaDef> {
281281
.with('Decimal', () => {
282282
return z.union([
283283
this.extraValidationsEnabled ? addNumberValidation(z.number(), attributes) : z.number(),
284-
this.extraValidationsEnabled
285-
? addDecimalValidation(z.instanceof(Decimal), attributes)
286-
: z.instanceof(Decimal),
287-
this.extraValidationsEnabled ? addDecimalValidation(z.string(), attributes) : z.string(),
284+
addDecimalValidation(z.instanceof(Decimal), attributes, this.extraValidationsEnabled),
285+
addDecimalValidation(z.string(), attributes, this.extraValidationsEnabled),
288286
]);
289287
})
290288
.with('DateTime', () => z.union([z.date(), z.string().datetime()]))

packages/runtime/src/client/crud/validator/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ export function addBigIntValidation(schema: z.ZodBigInt, attributes: AttributeAp
145145
export function addDecimalValidation(
146146
schema: z.ZodType<Decimal> | z.ZodString,
147147
attributes: AttributeApplication[] | undefined,
148+
addExtraValidation: boolean,
148149
): z.ZodSchema {
149150
let result: z.ZodSchema = schema;
150151

@@ -176,7 +177,7 @@ export function addDecimalValidation(
176177
});
177178
}
178179

179-
if (attributes) {
180+
if (attributes && addExtraValidation) {
180181
for (const attr of attributes) {
181182
const val = getArgValue<number>(attr.args?.[0]?.value);
182183
if (val === undefined) {

0 commit comments

Comments
 (0)