Skip to content

Schema Validation

Schema Validation is done with Zod, a typeScript-first schema validation with static type inference.

These are the response shapes:

{
success: true,
data: data,
meta: MetaSchema.optional(),
}
{
success: false,
error: HttpErrorSchema,
meta: MetaSchema.optional(),
}

HttpResponse(dataSchema: T) is the type for either.

Successful responses should use the httpSuccess(reply, data, metaq) wrapper.

return httpSuccess(reply,data);