A function that receives a SchemaPathTree and applies rules to fields.
API
type SchemaFn<TModel, TPathKind extends PathKind = PathKind.Root> = ( p: SchemaPathTree<TModel, TPathKind>, ) => void
Description
A function that receives a SchemaPathTree and applies rules to fields.
A SchemaFn can be passed directly to form or to the schema function to create a cached Schema.
const userFormSchema: SchemaFn<User> = (p) => {
required(p.name);
disabled(p.email, ({valueOf}) => valueOf(p.name) === '');
};
const f = form(userModel, userFormSchema, {injector});