added validator for rjsf, hook form via standard schema

This commit is contained in:
dswbx
2025-07-05 13:29:30 +02:00
parent cfbec5b6ea
commit 0d3bb3b7d6
34 changed files with 69 additions and 1369 deletions
@@ -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",
});