Files
plex-playlist/frontend/src/validation.ts
copilotcoder 87f977280c
Some checks failed
CICD / Build CICD Image Failure Postmortem (push) Has been cancelled
CICD / Build and Push CICD Images (push) Has been cancelled
CICD / Source Checks (push) Has been cancelled
CICD / Dependency Audits (Informational) (push) Has been cancelled
CICD / CICD Tests Complete (push) Has been cancelled
CICD / Build Release Images (push) Has been cancelled
CICD / Build Tester Images (push) Has been cancelled
CICD / Production Images Complete (push) Has been cancelled
CICD / Production Image Failures Postmortem (push) Has been cancelled
CICD / Source Lanes Failure Postmortem (push) Has been cancelled
CICD / Runtime Black-Box Integration Tests (push) Has been cancelled
CICD / Integration Tests Failure Postmortem (push) Has been cancelled
CICD / End-to-End Tests (push) Has been cancelled
CICD / E2E Tests Failure Postmortem (push) Has been cancelled
CICD / Promote Staging Images To Release (push) Has been cancelled
fix(frontend): align zod v4 typings and defaults
2026-07-22 10:59:55 -04:00

31 lines
855 B
TypeScript

/**
* Zod validation setup with automatic test hooks
* Schemas are automatically validated during test runs via test-setup.ts
*/
import { z } from 'zod';
// Global schemas for automatic validation
export const PlaylistSchema = z.object({
id: z.string().uuid(),
name: z.string().min(1),
description: z.string().optional(),
tracks: z.array(z.string()).default([]),
});
export const UserSchema = z.object({
id: z.number(),
username: z.string().min(1),
email: z.string().email(),
preferences: z
.object({
theme: z.enum(['light', 'dark']).default('light'),
notifications: z.boolean().default(true),
})
.default({ theme: 'light', notifications: true }),
});
// Inferred types (no manual type definitions needed)
export type Playlist = z.infer<typeof PlaylistSchema>;
export type User = z.infer<typeof UserSchema>;