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

// generated from json-schema-to-zod
export const WidgetRequest = z.object({
  type: z.string().regex(new RegExp("create|delete|update")),
  requestId: z.string(),
  widgetId: 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 WidgetRequestT = z.infer<typeof WidgetRequest>;