( path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, logic: NoInfer<FieldValidator<TValue, TPathKind>>, )
| 29 | * @publicApi 22.0 |
| 30 | */ |
| 31 | export function validate<TValue, TPathKind extends PathKind = PathKind.Root>( |
| 32 | path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, |
| 33 | logic: NoInfer<FieldValidator<TValue, TPathKind>>, |
| 34 | ): void { |
| 35 | assertPathIsCurrent(path); |
| 36 | |
| 37 | const pathNode = FieldPathNode.unwrapFieldPath(path); |
| 38 | pathNode.builder.addSyncErrorRule((ctx) => { |
| 39 | return addDefaultField(logic(ctx as FieldContext<TValue, TPathKind>), ctx.fieldTree); |
| 40 | }); |
| 41 | } |
searching dependent graphs…