Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (Array.isArray(item)) {
throw new Error(
`multidimensional arrays are not supported (at path "${pathToString(path)}")`
)
}
return validateValue(item, path.concat(i), true)
})
}
if (!isPlainObject(value)) {
return value
}
// Apply missing keys is the parent is an array
const initial: {[key: string]: any} = parentIsArray && !value._key ? {_key: randomKey()} : {}
// Ensure non-root objects have _type
if (path.length > 0 && !value._type) {
if (value._ref) {
// In the case of references, we know what the type should be, so apply it
initial._type = 'reference'
} else {
throw new Error(`missing "_type" property at path "${pathToString(path)}"`)
}
}
if (value._ref) {
validateReference(value, path)
}
// Validate deeply