Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} else if (
(node.in === "query" || node.in === "path") &&
node.path[0] === "paths" &&
node.name
) {
// in this case we will want to normalize the path with the uri and the paramter name
node.path = [node.path[1], node.name]
}
path = consolidatePath(path, node.path)
}
const serializedErrors = flatMap(node.errors, validationError =>
serializeErrors(validationError, path)
).toArray()
const serializedInner = fold(
node.inner,
(acc, validationError) => {
const errs = serializeErrors(validationError, path)
errs.forEach(err => {
const similarErr = acc.find(el => areErrorsSimilar(err, el))
if (similarErr && similarErr.path) {
if (!similarErr.similarPaths) {
similarErr.similarPaths = []
}
similarErr.similarPaths.push(err.path as string)
if (!similarErr.similarJsonPaths) {
similarErr.similarJsonPaths = []
}
similarErr.similarJsonPaths.push(err.jsonPath as string)
} else {