Skip to content

Commit da32da3

Browse files
committed
Fix: Wrong projects sideload format
> failed to decode list projects response: json: cannot unmarshal object into > Go struct field .included.projectCategories of type > []projects.ProjectCategory
1 parent f849979 commit da32da3

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

projects/project.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ type ProjectGetResponse struct {
722722
// ProjectCategories contains the categories associated with the project.
723723
//
724724
// The key is the string representation of the project category ID.
725-
ProjectCategories []ProjectCategory `json:"projectCategories"`
725+
ProjectCategories map[string]ProjectCategory `json:"projectCategories"`
726726
} `json:"included"`
727727
}
728728

@@ -862,7 +862,7 @@ type ProjectListResponse struct {
862862
// ProjectCategories contains the categories associated with the project.
863863
//
864864
// The key is the string representation of the project category ID.
865-
ProjectCategories []ProjectCategory `json:"projectCategories"`
865+
ProjectCategories map[string]ProjectCategory `json:"projectCategories"`
866866
} `json:"included"`
867867
}
868868

projects/project_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,15 @@ func TestProjectList(t *testing.T) {
288288
input projects.ProjectListRequest
289289
}{{
290290
name: "all projects",
291+
input: projects.ProjectListRequest{
292+
Filters: projects.ProjectListRequestFilters{
293+
ProjectRequestFilters: projects.ProjectRequestFilters{
294+
Include: []projects.ProjectRequestSideload{
295+
projects.ProjectRequestSideloadProjectCategories,
296+
},
297+
},
298+
},
299+
},
291300
}}
292301

293302
for _, tt := range tests {

0 commit comments

Comments
 (0)