Files
renovate/lib/modules/platform/gitlab/schema.ts
T
renovate[bot] 4a2578d18d build(deps): update dependency zod to v4 (main) (#41225)
* build(deps): update dependency zod to v4

| datasource | package | from    | to    |
| ---------- | ------- | ------- | ----- |
| npm        | zod     | 3.25.76 | 4.3.6 |

* fix: zod migration

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2026-02-18 07:37:50 +00:00

46 lines
1.3 KiB
TypeScript

import { z } from 'zod/v3';
import type { LongCommitSha } from '../../../util/git/types.ts';
import { LooseArray } from '../../../util/schema-utils/index.ts';
export const LastPipelineId = z
.object({
last_pipeline: z.object({
id: z.number(),
}),
})
.transform(({ last_pipeline }) => last_pipeline.id);
const GitlabUserSchema = z.object({
id: z.number(),
username: z.string(),
});
const LongCommitShaSchema = z.string().transform((val) => val as LongCommitSha);
export const GitLabMergeRequestSchema = z.object({
iid: z.number(),
title: z.string(),
description: z.string().nullable(),
state: z.string(),
source_branch: z.string(),
target_branch: z.string(),
created_at: z.string(),
updated_at: z.string(),
diverged_commits_count: z.number().optional(),
merge_status: z.string().optional(),
assignee: GitlabUserSchema.nullish(),
assignees: LooseArray(GitlabUserSchema).catch([]),
reviewers: LooseArray(GitlabUserSchema).catch([]),
labels: z.array(z.string()).optional(),
sha: LongCommitShaSchema.nullish(),
head_pipeline: z
.object({
status: z.string(),
sha: LongCommitShaSchema,
})
.nullish(),
});
export const GitLabMergeRequestsSchema = z.array(GitLabMergeRequestSchema);
export type GitLabMergeRequest = z.infer<typeof GitLabMergeRequestSchema>;