Skip to content

Panic when description is null in GitLab Merge Request JSON #1366

@AJ699

Description

@AJ699

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

When running git-cliff as part of our CI/CD pipeline, a panic occurs if the description field in a merge request’s metadata is null instead of an empty string.

thread 'main' (351) panicked at git-cliff-core/src/changelog.rs:590:18:
Could not get gitlab metadata: JsonError(Error("invalid type: null, expected a string", line: 1, column: 370937))

This issue started occurring after upgrading from git-cliff 2.10.1 to 2.11. It is still present in 2.12.

Steps To Reproduce

  1. Have a merge request in GitLab where "description": null
  2. Run git-cliff

Example JSON:

{
  "id": 319131,
  "iid": 149,
  "project_id": 19011,
  "title": "MR Title",
  "description": null,
  ...
}

Expected behavior

The description field should be treated as optional if it is null.

Screenshots / Logs

No response

Software information

  • Operating system:
  • Rust version:
  • Project version: git-cliff 2.11 and 2.12 (issue occurs), 2.10.1 (working)

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions