Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

fix(teams): omit group_id from Create/Update payload when empty#62

Merged
vmvarela merged 1 commit intoenterprise-teamsfrom
fix/56-teams-group-id-empty
Mar 23, 2026
Merged

fix(teams): omit group_id from Create/Update payload when empty#62
vmvarela merged 1 commit intoenterprise-teamsfrom
fix/56-teams-group-id-empty

Conversation

@vmvarela
Copy link
Copy Markdown
Owner

Summary

Closes #56

Only set GroupID in the Create/Update API request when non-empty, consistent with how description is handled throughout the codebase.

Problem

The SDK struct uses GroupID *string json:"group_id,omitempty"``. Sending github.Ptr("") serializes as `"group_id": ""` in the JSON payload — the field is not omitted by `omitempty` because the pointer is non-nil. This can cause unexpected API behavior for teams created without a group assignment.

Fix

// Before
GroupID: github.Ptr(groupID), // Empty string is valid for no group

// After
if groupID != "" {
    req.GroupID = github.Ptr(groupID)
}

Tests

TestAccGithubEnterpriseTeam: 3/3 passing (create, update, import — all without group_id).

Only set GroupID in the API request when non-empty, consistent with
how description is handled. Sending an empty string pointer serializes
as "group_id": "" in the JSON payload which may cause unexpected
API behavior. Omitting the field (nil pointer with omitempty) is the
correct way to create a team without a group assignment.

Closes #56
@vmvarela vmvarela added the type:chore Maintenance, refactoring, tooling label Mar 23, 2026
@github-actions github-actions Bot added type:feature New functionality type:bug Something isn't working labels Mar 23, 2026
@vmvarela vmvarela merged commit d7d6a15 into enterprise-teams Mar 23, 2026
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

type:bug Something isn't working type:chore Maintenance, refactoring, tooling type:feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant