-
Notifications
You must be signed in to change notification settings - Fork 942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Derive TodoTarget.IDString #1744
Conversation
Create derived field IDString to work around xanzy#1743. Sometimes GitLab will return a string id instead of an int (e.g. when target is a commit). This change intercepts a string id before it causes unmarshaling to fail and redirects it to the new IDString field. Conversely when marshaling it routes either ID or IDString into the expected JSON "id" field.
Thanks for your PR, but I'm not a big fan of this solution. If the GitLab API sometimes returns an Also not ideal, but at least we are not introducing arbitrary fields that do not exists in the actual APIs... |
Yeah, it should have been an |
The API changes quite a lot. Generally the changes are backwards compatible, but sometimes they are not. One of the reasons I'm still using 0.x.x versions. So I'm OK with changing this it it "fixes" a bug... |
Do you intent to update this PR following our conversation, or should it be closed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update according to our discussion... So LGTM now 👍🏻
@svanharmelen I think there is a typo in the last commit: ID int `json:"id"`
+ IID interface{} `json:"iid"` You set the I just tested it on my project: {
"id": 89908,
"project": {
"id": 63,
"description": "",
"name": "REDACTED",
"name_with_namespace": "REDACTED",
"path": "platform",
"path_with_namespace": "REDACTED",
"created_at": "2018-06-21T15:30:47.435Z"
},
"author": {
"id": 63,
"username": "abderraouf.elgasser",
"name": "Abderraouf El Gasser",
"state": "active",
"locked": false,
"avatar_url": "REDACTED",
"web_url": "REDACTED"
},
"action_name": "directly_addressed",
"target_type": "Commit",
"target": {
"id": "1d76d1b2e3e886108f662765c97f4687f4134d8c", // THE BAD ID IS HERE
"short_id": "1d76d1b2",
"created_at": "2024-01-29T11:17:05.000+01:00",
"parent_ids": [
"66ca971205388f39905d0f3fb48538dce7932bc5"
],
"title": "fix: updated relay schemas",
"message": "fix: updated relay schemas\n",
"author_name": "Abderraouf El Gasser",
"author_email": "REDACTED",
"authored_date": "2024-01-29T11:17:05.000+01:00",
"committer_name": "Abderraouf El Gasser",
"committer_email": "REDACTED",
"committed_date": "2024-01-29T11:17:05.000+01:00",
"trailers": {},
"web_url": "REDACTED"
},
"target_url": "REDACTED",
"body": "@abderraouf.elgasser test on commit",
"state": "pending",
"created_at": "2024-01-30T17:14:46.520Z",
"updated_at": "2024-01-30T17:14:46.520Z"
}, Could you please make a change so I can tell to the mattermost plugin team here to use the latest version to fix the problem there. |
Fixed in cd61482 |
Thank you! |
Create derived field IDString to work around
#1743.
Sometimes GitLab will return a string id instead of an int (e.g. when target is a commit). This change intercepts a string id before it causes unmarshaling to fail and redirects it to the new IDString field. Conversely when marshaling it routes either ID or IDString into the expected JSON "id" field.