From f60d68af2cae8e073e3ed6d18547a46b4029fa6f Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Thu, 29 May 2025 18:23:14 -0700 Subject: [PATCH] [pr-66] fix: make old_line and new_line optional for image diff discussions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🐛 Bug Fix: - Image files in GitLab MR discussions use x/y coordinates instead of line numbers - Fixed schema validation error when fetching discussions on image files 📝 Details: - Changed old_line and new_line from required to optional in GitLabDiscussionNoteSchema - Allows proper handling of image diff comments that use position_type: 'image' --- schemas.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/schemas.ts b/schemas.ts index 4450e01..67b5e1e 100644 --- a/schemas.ts +++ b/schemas.ts @@ -618,21 +618,21 @@ export const GitLabDiscussionNoteSchema = z.object({ old_path: z.string(), new_path: z.string(), position_type: z.enum(["text", "image", "file"]), - old_line: z.number().nullable(), - new_line: z.number().nullable(), + old_line: z.number().nullish(), // This is missing for image diffs + new_line: z.number().nullish(), // This is missing for image diffs line_range: z .object({ start: z.object({ line_code: z.string(), type: z.enum(["new", "old", "expanded"]), - old_line: z.number().nullable(), - new_line: z.number().nullable(), + old_line: z.number().nullish(), // This is missing for image diffs + new_line: z.number().nullish(), // This is missing for image diffs }), end: z.object({ line_code: z.string(), type: z.enum(["new", "old", "expanded"]), - old_line: z.number().nullable(), - new_line: z.number().nullable(), + old_line: z.number().nullish(), // This is missing for image diffs + new_line: z.number().nullish(), // This is missing for image diffs }), }) .nullable()