← @mortar-kit/core

validateEntriesfunction

import { validateEntries } from '@mortar-kit/core'

function validateEntries(bricks: readonly AnyBrick[], raw: readonly unknown[], issues: EntryIssue[]): PageEntry[]

Checks entries before they are saved: each entry's shape, unique ids, and its data against its brick's schema. Problems are pushed onto issues (shape problems at ['entries', index]); the returned entries have each known brick's validated data, and entries of unknown bricks are kept as they are, so retiring a brick never loses content.

Parameters

bricks: readonly AnyBrick[]
raw: readonly unknown[]
issues: EntryIssue[]

Returns

PageEntry[]