atlassian / atlassian/go-sentry-api

Issue Annotations can be more than just `string`

Open
#56 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
55
Forks
45
PR merge metrics
No merged PRs in 30d

Description

The error is `json: cannot unmarshal object into Go struct field Issue.annotations of type string` and if I output the raw JSON from Sentry I can see that some issues have an `annotations:[{}]`(with content inside, not just empty hehe) so basically can also have an object inside.

I can fix this by just doing:

```diff
diff --git a/issue.go b/issue.go
index b1986ef..1a83f10 100644
--- a/issue.go
+++ b/issue.go
@@ -82,7 +82,7 @@ type Activity struct {

// Issue returns a issue found in sentry
type Issue struct {
- Annotations *[]string `json:"annotations,omitempty"`
+ Annotations *[]interface{} `json:"annotations,omitempty"`
AssignedTo *InternalUser `json:"assignedTo,omitempty"`
Activity *[]Activity `json:"activity,omitempty"`
Count *string `json:"count,omitempty"`
```

But when I tried to test it I could not find a way to actually inject the `Annotations`.

The fix is easy but also it's a change of type so it'll not be backwards compatible also.

What would be the right process to fix this?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in issue.go at the Issue.Annotations field and inspect how the Sentry response is unmarshaled. Reproduce or add coverage for an annotations value containing an object, then verify that the chosen field type handles the response and consider the backward-compatibility concern described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.