The value to validate
Type predicate indicating whether response is an EpagesVariationsResponse
const json = await httpGetJson({ path: `/rs/shops/${shopId}/products/${id}/variations` });
if (isEpagesVariationsResponse(json)) {
const purchasable = json.items.filter((i) => i.additionalAttributes?.purchasable !== false);
}
export function isEpagesVariationsResponse(
response: unknown,
): response is EpagesVariationsResponse {
return v.safeParse(epagesVariationsResponseSchema, response).success;
}
Type guard for a master product's variations list (
GET …/products/{masterId}/variations). Verifies theitemsarray, each entry carrying alinkto its variation product page.