Files
Sebastian Poxhofer 15f4bd8eff chore: migrate from zod/v3 to zod/v4 (#43691)
* chore: migrate from zod/v3 to zod/v4

This commit contains the logic changes

* chore: migrate imports from zod/v3 to zod/v4

This contains import updates and adds explicit record keys as zod/v4 requires these now

* ci: enforce usage of zod/v4
2026-05-30 16:01:58 +00:00

48 lines
1.2 KiB
TypeScript

import { z } from 'zod/v4';
import { LooseRecord, Yaml } from '../../../util/schema-utils/index.ts';
const PubspecDependency = LooseRecord(
z.string(),
z.union([
z.string(),
z.object({
version: z.string().optional(),
path: z.string().optional(),
git: z.union([
z.string().optional(),
z.object({
url: z.string().optional(),
ref: z.string().optional(),
path: z.string().optional(),
tag_pattern: z.string().optional(),
}),
]),
hosted: z.union([
z.string().optional(),
z.object({ name: z.string().optional(), url: z.string().optional() }),
]),
}),
]),
);
export const Pubspec = Yaml.pipe(
z.object({
environment: z.object({ sdk: z.string(), flutter: z.string().optional() }),
dependencies: PubspecDependency.optional(),
dev_dependencies: PubspecDependency.optional(),
}),
);
export type Pubspec = z.infer<typeof Pubspec>;
export const PubspecLock = Yaml.pipe(
z.object({
sdks: z.object({
dart: z.string(),
flutter: z.string().optional(),
}),
}),
);
export type PubspecLock = z.infer<typeof PubspecLock>;