Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(helm): More idiomatic schema usage (#24934)
- Loading branch information
Showing
5 changed files
with
27 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,30 @@ | ||
import { z } from 'zod'; | ||
import { Yaml } from '../../../util/schema-utils'; | ||
|
||
export const RepositorySchema = z.object({ | ||
export const HelmRepository = z.object({ | ||
name: z.string(), | ||
url: z.string(), | ||
oci: z.boolean().optional(), | ||
}); | ||
export type HelmRepository = z.infer<typeof HelmRepository>; | ||
|
||
export const ReleaseSchema = z.object({ | ||
export const HelmRelease = z.object({ | ||
name: z.string(), | ||
chart: z.string(), | ||
version: z.string(), | ||
strategicMergePatches: z.unknown().optional(), | ||
jsonPatches: z.unknown().optional(), | ||
transformers: z.unknown().optional(), | ||
}); | ||
export type HelmRelease = z.infer<typeof HelmRelease>; | ||
|
||
export const DocSchema = z.object({ | ||
releases: z.array(ReleaseSchema).optional(), | ||
repositories: z.array(RepositorySchema).optional(), | ||
export const Doc = z.object({ | ||
releases: z.array(HelmRelease).optional(), | ||
repositories: z.array(HelmRepository).optional(), | ||
}); | ||
export type Doc = z.infer<typeof Doc>; | ||
|
||
export const LockSchema = z.object({ | ||
version: z.string(), | ||
}); | ||
export const LockVersion = Yaml.pipe( | ||
z.object({ version: z.string() }).transform(({ version }) => version) | ||
); | ||
export type LockVersion = z.infer<typeof LockVersion>; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters