summaryrefslogtreecommitdiff
path: root/Homework/cs5260/shared/schema/Widget.ts
blob: e7f09d144201c8b0eb0718109e673d0fc5b51f7b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { z } from "zod";

export const Widget = z.object({
  id: z.string(),
  owner: z.string().regex(new RegExp("[A-Za-z ]+")),
  label: z.string().optional(),
  description: z.string().optional(),
  otherAttributes: z
    .array(z.object({ name: z.string(), value: z.string() }))
    .optional(),
});

export type WidgetT = z.infer<typeof Widget>;