SchemaFn
Type Alias
stablesince v22.0
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, {when: ({valueOf}) => valueOf(p.name) === ''});
};
const f = form(userModel, userFormSchema, {injector});
跳到詳細內容