ITADN

fix: allow null description in CondensedMergeRequestSchema

#3823Openmobinyardim 创建于 2026-01-20
type:types
M
mobinyardimcommented
**Description** - Node.js version: 22 - Gitbeaker version: @gitbeaker/rest: ^38.0.0 (used via danger-js) - Gitbeaker release (cli, rest, core, requester-utils): rest, core - OS & version: macOS Sonoma The `CondensedMergeRequestSchema` interface defines `description` as a required `string`. However, the GitLab API returns `null` for this field when a Merge Request is created without a description (a common occurrence when using IDE integrations like IntelliJ). This causes a crash or type error when the library attempts to handle the null value. **Steps to reproduce** 1. Create a Merge Request in GitLab (e.g., via IntelliJ) without entering any text in the description field. 2. Run a script using `@gitbeaker/rest` (or `danger-js`) that fetches this specific Merge Request. 3. The process will fail when it tries to map the API response to the `CondensedMergeRequestSchema`. **Expected behaviour** The `description` field should be nullable (`string | null`) to safely accommodate Merge Requests that do not have a description. **Actual behaviour** The application crashes or throws an error because it receives `null` for a field typed strictly as a `string`. **Possible fixes** In `packages/core/src/resources/MergeRequests.ts`, update the `CondensedMergeRequestSchema` interface as follows: ```typescript interface CondensedMergeRequestSchema extends Record<string, unknown> { id: number; iid: number; project_id: number; title: string; description: string | null; // Allow null to prevent crashes state: string; created_at: string; updated_at: string; web_url: string; } ``` **Checklist** - [x] I have checked that this is not a duplicate issue. - [x] I have read the documentation.
3 条评论