mirror of
https://github.com/Xevion/rdap.git
synced 2025-12-10 10:08:21 -06:00
implement de-facto schema
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import Link from "next/link";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
export const TargetTypeEnum = z.enum([
|
export const TargetTypeEnum = z.enum([
|
||||||
@@ -58,10 +59,13 @@ export const StatusEnum = z.enum([
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
export const LinkSchema = z.object({
|
export const LinkSchema = z.object({
|
||||||
value: z.string().optional(),
|
value: z.string().optional(), // de-facto optional
|
||||||
rel: z.string(),
|
rel: z.string().optional(), // de-facto optional
|
||||||
href: z.string(),
|
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({
|
export const EntitySchema = z.object({
|
||||||
@@ -90,16 +94,9 @@ export const EventSchema = z.object({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const NoticeSchema = z.object({
|
export const NoticeSchema = z.object({
|
||||||
|
description: z.string().array(), // de jure required
|
||||||
title: z.string().optional(),
|
title: z.string().optional(),
|
||||||
description: z.string().array(),
|
links: z.array(LinkSchema).optional()
|
||||||
links: z
|
|
||||||
.array(
|
|
||||||
z.object({
|
|
||||||
href: z.string(),
|
|
||||||
type: z.string(),
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.optional(),
|
|
||||||
});
|
});
|
||||||
export type Notice = z.infer<typeof NoticeSchema>;
|
export type Notice = z.infer<typeof NoticeSchema>;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user