File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -203,6 +203,11 @@ func (cp *CopilotSeatDetails) UnmarshalJSON(data []byte) error {
203203 cp .PlanType = seatDetail .PlanType
204204
205205 switch v := seatDetail .Assignee .(type ) {
206+ case nil :
207+ // Assignee can be null according to GitHub API specification.
208+ // See: https://docs.github.com/en/rest/copilot/copilot-user-management?apiVersion=2022-11-28#list-all-copilot-seat-assignments-for-an-organization
209+ // Note: Copilot API is in public preview and subject to change.
210+ cp .Assignee = nil
206211 case map [string ]any :
207212 jsonData , err := json .Marshal (seatDetail .Assignee )
208213 if err != nil {
Original file line number Diff line number Diff line change @@ -58,6 +58,16 @@ func TestCopilotSeatDetails_UnmarshalJSON(t *testing.T) {
5858 want : & CopilotSeatDetails {},
5959 wantErr : true ,
6060 },
61+ {
62+ name : "Null Assignee" ,
63+ data : `{
64+ "assignee": null
65+ }` ,
66+ want : & CopilotSeatDetails {
67+ Assignee : nil ,
68+ },
69+ wantErr : false ,
70+ },
6171 {
6272 name : "Invalid Assignee Field Type" ,
6373 data : `{
You can’t perform that action at this time.
0 commit comments