File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed
packages/runtime/src/client/crud/validator Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -279,17 +279,13 @@ export class InputValidator<Schema extends SchemaDef> {
279279 ] ) ,
280280 )
281281 . with ( 'Decimal' , ( ) => {
282- const options : [ z . ZodSchema , z . ZodSchema , ...z . ZodSchema [ ] ] = [
283- z . number ( ) ,
284- z . instanceof ( Decimal ) ,
285- z . string ( ) ,
286- ] ;
287- if ( this . extraValidationsEnabled ) {
288- for ( let i = 0 ; i < options . length ; i ++ ) {
289- options [ i ] = addDecimalValidation ( options [ i ] ! , attributes ) ;
290- }
291- }
292- return z . union ( options ) ;
282+ return z . union ( [
283+ 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 ( ) ,
288+ ] ) ;
293289 } )
294290 . with ( 'DateTime' , ( ) => z . union ( [ z . date ( ) , z . string ( ) . datetime ( ) ] ) )
295291 . with ( 'Bytes' , ( ) => z . instanceof ( Uint8Array ) )
You can’t perform that action at this time.
0 commit comments