import type { JSONSchema } from "json-schema-to-ts"; import { AnyOfField } from "./AnyOfField"; import { Field } from "./Field"; import { FieldWrapper, type FieldwrapperProps } from "./FieldWrapper"; import { useFieldContext } from "./Form"; export type ObjectFieldProps = { path?: string; schema?: Exclude; label?: string | false; wrapperProps?: Partial; }; export const ObjectField = ({ path = "", schema: _schema, label: _label, wrapperProps = {} }: ObjectFieldProps) => { const { errors, ...ctx } = useFieldContext(path); const schema = _schema ?? ctx.schema; if (!schema) return "ObjectField: no schema"; const properties = schema.properties ?? {}; return ( {Object.keys(properties).map((prop) => { const schema = properties[prop]; const pointer = `${path}/${prop}`.replace(/\/+/g, "/"); if (!schema) return; if (schema.anyOf || schema.oneOf) { return ; } return ; })} ); };