| 31 | // the validators read no configuration, so a program's configure() runs after. |
| 32 | // An issue's message names no path, so each is written after its option's |
| 33 | const validate = ( |
| 34 | getValidator: () => Validator, |
| 35 | data: unknown, |
| 36 | where = "" |
| 37 | ): void => { |
| 38 | const out = getValidator()(data, undefined, null) |
| 39 | if (!("issues" in out)) return |
| 40 | throw new Error( |
| 41 | out.issues |
| 42 | .map(issue => { |
| 43 | const option = stringifyPath(issue.path) |
| 44 | return `${where}${option && `${option} `}${issue.message} (was ${printable(issue.data)})` |
| 45 | }) |
| 46 | .join("\n") |
| 47 | ) |
| 48 | } |
| 49 | |
| 50 | export const settingsFile = "ark.json" |
| 51 | |