Skip to content

[IR-4340] Fix incidents get failing on labels parsing#8

Merged
kwent merged 2 commits intomasterfrom
feature/ir-4340-fix-incidents-get-labels-parsing
Mar 4, 2026
Merged

[IR-4340] Fix incidents get failing on labels parsing#8
kwent merged 2 commits intomasterfrom
feature/ir-4340-fix-incidents-get-labels-parsing

Conversation

@kwent
Copy link
Member

@kwent kwent commented Mar 4, 2026

Summary

  • Fixes rootly incidents get <id> failing with json: cannot unmarshal object into Go struct field ... of type []struct
  • The Rootly API returns "labels":{} (empty object) when no labels exist, but the CLI expected "labels":[] (array)
  • Added flexibleLabels custom type with UnmarshalJSON that handles both array and object formats
  • Applied the fix to all 3 label parsing locations (incident detail, alert list, alert detail)

Linear Issue

https://linear.app/rootly/issue/IR-4340

Test Plan

  • Added unit tests for flexibleLabels (array, empty object, object with keys)
  • All existing tests pass
  • Manual test: rootly incidents get <id> with an incident that has empty labels
  • Manual test: rootly incidents get <id> with an incident that has labels as array

kwent added 2 commits March 3, 2026 16:38
The Rootly API returns labels as an empty object {} when there are no
labels, but the Go struct expected an array []. Added flexibleLabels
custom type with UnmarshalJSON that handles both formats.

Fixes IR-4340
@kwent kwent merged commit 458ceeb into master Mar 4, 2026
7 checks passed
@kwent kwent deleted the feature/ir-4340-fix-incidents-get-labels-parsing branch March 4, 2026 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant