MCPcopy Create free account
hub / github.com/arktypeio/arktype / validate

Function validate

ark/aot/settings.ts:33–48  ·  view source on GitHub ↗
(
	getValidator: () => Validator,
	data: unknown,
	where = ""
)

Source from the content-addressed store, hash-verified

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
33const 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
50export const settingsFile = "ark.json"
51

Callers 10

validatedFunction · 0.70
withSettingsFileFunction · 0.70
resolvePrecompileOptionsFunction · 0.70
sampleFunction · 0.50
main.tsFile · 0.50
main.tsFile · 0.50
disagreementsOfFunction · 0.50
checkEquivalentFunction · 0.50

Calls 3

stringifyPathFunction · 0.90
printableFunction · 0.90
mapMethod · 0.65

Tested by 3

sampleFunction · 0.40
disagreementsOfFunction · 0.40
checkEquivalentFunction · 0.40