mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-03 16:46:00 +00:00
added validator for rjsf, hook form via standard schema
This commit is contained in:
@@ -13,6 +13,7 @@ import { MantineSelect } from "ui/components/form/hook-form-mantine/MantineSelec
|
||||
import type { TFlowNodeData } from "../../../hooks/use-flow";
|
||||
import { KeyValueInput } from "../../form/KeyValueInput";
|
||||
import { BaseNode } from "../BaseNode";
|
||||
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
||||
|
||||
const schema = s.object({
|
||||
query: s.record(s.string()).optional(),
|
||||
@@ -37,8 +38,7 @@ export function FetchTaskForm({ onChange, params, ...props }: FetchTaskFormProps
|
||||
watch,
|
||||
control,
|
||||
} = useForm({
|
||||
// @todo: add resolver
|
||||
//resolver: typeboxResolver(schema),
|
||||
resolver: standardSchemaResolver(schema),
|
||||
defaultValues: params as s.Static<typeof schema>,
|
||||
mode: "onChange",
|
||||
//defaultValues: (state.relations?.create?.[0] ?? {}) as Static<typeof schema>
|
||||
|
||||
@@ -11,6 +11,7 @@ import { useFlowCanvas, useFlowSelector } from "../../../hooks/use-flow";
|
||||
import { BaseNode } from "../BaseNode";
|
||||
import { Handle } from "../Handle";
|
||||
import { s } from "core/object/schema";
|
||||
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
||||
|
||||
const schema = s.object({
|
||||
trigger: s.anyOf(
|
||||
@@ -45,8 +46,7 @@ export const TriggerNode = (props: NodeProps<Node<TAppFlowTriggerSchema & { labe
|
||||
watch,
|
||||
control,
|
||||
} = useForm({
|
||||
// @todo: add resolver
|
||||
//resolver: typeboxResolver(schema),
|
||||
resolver: standardSchemaResolver(schema),
|
||||
defaultValues: { trigger: state } as s.Static<typeof schema>,
|
||||
mode: "onChange",
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user