Skip to content

Commit

Permalink
make zod schema for events more strict
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Oct 30, 2024
1 parent aaf7812 commit 571346d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const newsCollection = defineCollection({
const eventsCollection = defineCollection({
type: 'content',
schema: ({ image }) => z.object({
title: z.string(),
description: z.string().max(200),
title: z.string().trim().min(1),
description: z.string().trim().max(200).min(1),
category: z.enum(['Conference', 'Hackathon', 'Webinar', 'Training', 'Meeting']), // There might be more
mode: z.enum(['OfflineEventAttendanceMode', 'OnlineEventAttendanceMode', 'MixedEventAttendanceMode']), // There might be more
audience: z.enum(['Users', 'DataStewards', 'Developers']).array(), // There might be more
Expand All @@ -30,12 +30,12 @@ const eventsCollection = defineCollection({
tutors: z.string().array().optional(),
image: image().optional(),
organizer: z.object({
name: z.string(),
affiliation: z.string(),
name: z.string().trim().min(1),
affiliation: z.string().trim().min(1),
url: z.string().url()
}).partial().optional(),
location: z.object({
name: z.string().max(50),
name: z.string().trim().max(50).min(1),
address: z.string().optional(),
url: z.string().url().optional(),
}),
Expand Down

0 comments on commit 571346d

Please sign in to comment.