Files
Kent Wang eb0b49f7a3 feat: Migrate collection and document workspace zod schema and type definitions- #10520 (#10582)
* migrate request related p2
- grpc-request
- cookie-jar
- fix ts errors

* add unit test to check field mismatch
* migrate request group model
* migrate the socket io request and import parser
* migrate websocket schema and fix ts error
* fix order issue and add unit tests
2026-10-15 13:45:30 +08:00

14 lines
554 B
TypeScript

import { z } from 'zod/v4';
// Basic literal types that can appear in JSON data
export const LiteralSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]);
export const KeyLiteralSchema = z.union([z.string(), z.number()]);
type Literal = z.infer<typeof LiteralSchema>;
type Json = Literal | { [key: string]: Json } | Json[];
// Recursive JSON schema that can handle nested objects and arrays
export const JsonSchema: z.ZodType<Json> = z.lazy(() =>
z.union([LiteralSchema, z.array(JsonSchema), z.record(KeyLiteralSchema, JsonSchema)]),
);