UNPKG

@rjsf/utils

Version:
15 lines (14 loc) 1.23 kB
import { Experimental_CustomMergeAllOf, FormContextType, IdSchema, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types.js'; /** Generates an `IdSchema` object for the `schema`, recursively * * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary * @param schema - The schema for which the `IdSchema` is desired * @param [id] - The base id for the schema * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s * @param [formData] - The current formData, if any, to assist retrieving a schema * @param [idPrefix='root'] - The prefix to use for the id * @param [idSeparator='_'] - The separator to use for the path segments in the id * @param [experimental_customMergeAllOf] - Optional function that allows for custom merging of `allOf` schemas * @returns - The `IdSchema` object for the `schema` */ export default function toIdSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, schema: S, id?: string | null, rootSchema?: S, formData?: T, idPrefix?: string, idSeparator?: string, experimental_customMergeAllOf?: Experimental_CustomMergeAllOf<S>): IdSchema<T>;