createBuildContext
Creates a build context for testing a field type's schema() on its own, without a definition around it.
ts
const ctx = createBuildContext(overrides)Parameters
overridesPartial<BuildContext>: optional, replaces any member, likepath
Explanation
Its buildFields and buildField use the default registries, and throw a DefinitionError when the child fields have issues. Its path defaults to [].
Returns
ctxBuildContext
Example
ts
const field: JsonField = { name: 'tags', type: 'tags', max: 3 }
const schema = tags.schema?.(
{ ...field, max: 3 },
createBuildContext({ path: ['fields', 0] }),
)