Validates several event inputs at once against their schemas.
For each [key, schema] it validates event.get(key) and collects every issue (each issue's
path is prefixed with its key). If any input fails, it throws a single ValidationError
carrying all the issues — so the caller sees the full picture, not just the first failure.
Platform-agnostic: the event only needs a get(key) method, so it works for HTTP, CLI, browser
or any other context.
Returns the parsed values, keyed as the rules were. A schema does not only accept or reject,
it coerces and strips: z.coerce.number() turns "42" into 42, and a strict object drops the
keys you did not declare. Throwing the parsed value away and reading the raw input again is how
an application ends up validating one value and using another.
Validates several event inputs at once against their schemas.
For each
[key, schema]it validatesevent.get(key)and collects every issue (each issue's path is prefixed with its key). If any input fails, it throws a single ValidationError carrying all the issues — so the caller sees the full picture, not just the first failure.Platform-agnostic: the event only needs a
get(key)method, so it works for HTTP, CLI, browser or any other context.Returns the parsed values, keyed as the rules were. A schema does not only accept or reject, it coerces and strips:
z.coerce.number()turns"42"into42, and a strict object drops the keys you did not declare. Throwing the parsed value away and reading the raw input again is how an application ends up validating one value and using another.