From ad9671c9fee24f184f89987f1b1d36cb963af4e8 Mon Sep 17 00:00:00 2001 From: Xevion Date: Fri, 10 May 2024 05:52:05 -0500 Subject: [PATCH] implement de-facto schema --- src/schema.ts | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/schema.ts b/src/schema.ts index e7a2e80..63018b1 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -1,3 +1,4 @@ +import Link from "next/link"; import { z } from "zod"; export const TargetTypeEnum = z.enum([ @@ -58,10 +59,13 @@ export const StatusEnum = z.enum([ ]); export const LinkSchema = z.object({ - value: z.string().optional(), - rel: z.string(), + value: z.string().optional(), // de-facto optional + rel: z.string().optional(), // de-facto optional href: z.string(), - type: z.string(), + hrefLang: z.array(z.string()).optional(), + title: z.string().optional(), + media: z.string().optional(), + type: z.string().optional(), }); export const EntitySchema = z.object({ @@ -90,16 +94,9 @@ export const EventSchema = z.object({ }); export const NoticeSchema = z.object({ + description: z.string().array(), // de jure required title: z.string().optional(), - description: z.string().array(), - links: z - .array( - z.object({ - href: z.string(), - type: z.string(), - }) - ) - .optional(), + links: z.array(LinkSchema).optional() }); export type Notice = z.infer;