Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

cannot unmarshal number into Go struct field .object_attributes.updated_by_id of type string #1904

Closed
X-Guardian opened this issue Mar 26, 2024 · 0 comments · Fixed by #1910 or runatlantis/atlantis#4414

Comments

@X-Guardian
Copy link

GitLab have just enabled triggering webhooks when a comment is edited, see: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/127169. This is creating an event that causes this error when trying to unmarshal the event into the gitlab.MergeCommentEvent structure.

It looks like the string type here is incorrect and should be int:

UpdatedByID string `json:"updated_by_id"`

Sample event snippet

{
  "object_kind": "note",
  "event_type": "note",
  ...
  "object_attributes": {
    "attachment": null,
    "author_id": 11901354,
    "change_position": null,
    "commit_id": null,
    "created_at": "2024-02-01 16:56:42 UTC",
    "discussion_id": "b7b737e33d5b87c5f0cf964a231348d2c065b8a8",
    "id": 1754071451,
    "line_code": null,
    "note": "note",
    "noteable_id": 274443493,
    "noteable_type": "MergeRequest",
    "original_position": null,
    "position": null,
    "project_id": 53689091,
    "resolved_at": null,
    "resolved_by_id": null,
    "resolved_by_push": null,
    "st_diff": null,
    "system": false,
    "type": null,
    "updated_at": "2024-03-26 12:15:43 UTC",
    "updated_by_id": 14370654,
    "description": "note",
    "url": "redacted"
  },
  ...
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant