MCPcopy Create free account
hub / github.com/code-pushup/cli / validateAsync

Function validateAsync

packages/models/src/lib/implementation/validate.ts:52–62  ·  view source on GitHub ↗
(
  schema: T,
  data: ZodInputLooseAutocomplete<T>,
  context: SchemaValidationContext = {},
)

Source from the content-addressed store, hash-verified

50}
51
52export async function validateAsync<T extends ZodType>(
53 schema: T,
54 data: ZodInputLooseAutocomplete<T>,
55 context: SchemaValidationContext = {},
56): Promise<z.output<T>> {
57 const result = await schema.safeParseAsync(data);
58 if (result.success) {
59 return result.data;
60 }
61 throw new SchemaValidationError(result.error, schema, context);
62}

Callers 2

loadSetupScriptFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected