0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/astro-rss/src/schema.ts
2023-04-26 13:58:53 +01:00

20 lines
616 B
TypeScript

import { z } from 'astro/zod';
export const rssSchema = z.object({
title: z.string(),
pubDate: z.union([z.string(), z.number(), z.date()]).transform((value) => new Date(value)),
description: z.string().optional(),
customData: z.string().optional(),
draft: z.boolean().optional(),
categories: z.array(z.string()).optional(),
author: z.string().optional(),
commentsUrl: z.string().optional(),
source: z.object({ url: z.string().url(), title: z.string() }).optional(),
enclosure: z
.object({
url: z.string(),
length: z.number().positive().int().finite(),
type: z.string(),
})
.optional(),
});