File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ setMessagesProvider(new MessageProvider({
17
17
'password.min' : 'Password must be at least {min} characters for security' ,
18
18
} ) )
19
19
20
- // Create a user validator
21
- const userValidator = v . object ( ) . shape ( {
20
+ // Create a user validator using direct schema syntax
21
+ const userValidator = v . object ( {
22
22
username : v . string ( ) . min ( 3 ) . max ( 20 ) . required ( ) ,
23
23
email : v . string ( ) . email ( ) . required ( ) ,
24
24
password : v . string ( ) . min ( 8 ) . required ( ) ,
Original file line number Diff line number Diff line change 1
1
import type { ArrayValidatorType } from './array'
2
+ import type { Validator } from './base'
2
3
import type { BinaryValidatorType } from './binary'
3
4
import type { BlobValidatorType } from './blob'
4
5
import type { BooleanValidatorType } from './boolean'
@@ -58,7 +59,7 @@ export interface ValidationInstance {
58
59
enum : < T extends string | number > ( values : readonly T [ ] ) => EnumValidatorType < T >
59
60
date : ( ) => DateValidatorType
60
61
datetime : ( ) => DatetimeValidatorType
61
- object : < T extends Record < string , any > > ( ) => ObjectValidatorType < T >
62
+ object : < T extends Record < string , any > > ( schema ?: Record < string , Validator < any > > ) => ObjectValidatorType < T >
62
63
custom : < T > ( validationFn : ( value : T ) => boolean , message : string ) => CustomValidatorType < T >
63
64
timestamp : ( ) => TimestampValidatorType
64
65
timestampTz : ( ) => TimestampTzValidatorType
You can’t perform that action at this time.
0 commit comments