import { z } from 'zod'; const literalSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]); type Literal = z.infer; export type JsonObject = { [key: string]: Json }; export type Json = Literal | JsonObject | Json[]; export const jsonSchema: z.ZodType = z.lazy(() => z.union([ literalSchema, z.array(jsonSchema), z.record(z.string(), jsonSchema), ]) ); export const HalListLinksSchema = z.object({ self: z.object({ href: z.string(), }), previous: z .object({ href: z.string(), }) .optional(), next: z .object({ href: z.string(), }) .optional(), }); export const ListSchema = z.object({ count: z.number(), totalCount: z.number(), _links: HalListLinksSchema, });