0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-22 21:48:32 +00:00
renovatebot_renovate/lib/modules/manager/helmfile/schema.ts
Sebastian Poxhofer d0878d99b6
refactor(manager/helmfile): use schema for yaml parsing (#27539)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-03-15 21:58:19 +00:00

36 lines
1.0 KiB
TypeScript

import { z } from 'zod';
import { LooseArray, Yaml } from '../../../util/schema-utils';
export const HelmRepository = z.object({
name: z.string(),
url: z.string(),
oci: z.boolean().optional(),
});
export type HelmRepository = z.infer<typeof HelmRepository>;
export const HelmRelease = z.object({
name: z.string(),
chart: z.string(),
version: z
.string()
.or(z.number())
.optional()
.nullable()
.transform((version) => (version ? version.toString() : null)),
strategicMergePatches: z.unknown().optional(),
jsonPatches: z.unknown().optional(),
transformers: z.unknown().optional(),
});
export type HelmRelease = z.infer<typeof HelmRelease>;
export const Doc = z.object({
releases: LooseArray(HelmRelease).optional(),
repositories: LooseArray(HelmRepository).optional(),
});
export type Doc = z.infer<typeof Doc>;
export const LockVersion = Yaml.pipe(
z.object({ version: z.string() }).transform(({ version }) => version),
);
export type LockVersion = z.infer<typeof LockVersion>;