feat(generated): Add user info to organization memberships and new event types#541
Conversation
Greptile SummaryThis generated PR extends several core models with embedded user data and new event types, driven by an OpenAPI spec update. Two public API changes — the return type of
Confidence Score: 3/5PR introduces two compile-time breaking API changes in a versioned module that may affect existing consumers before a major version bump is issued. Two P1 findings: the iterator element type change and the APIKeyValidationResponse field type change both break compilation for existing callers without a semver-major bump. The rest of the changes (new structs, new event types, added fields) are additive and safe. authorization.go (iterator return type) and models.go (APIKeyValidationResponse.APIKey field type) Important Files Changed
|
| func (s *AuthorizationService) ListMembershipsForResource(ctx context.Context, resourceID string, params *AuthorizationListMembershipsForResourceParams, opts ...RequestOption) *Iterator[UserOrganizationMembershipBaseWithUser] { | ||
| return newIterator[UserOrganizationMembershipBaseWithUser](ctx, s.client, "GET", fmt.Sprintf("/authorization/resources/%s/organization_memberships", url.PathEscape(resourceID)), params, "after", "data", opts, map[string]string{"limit": "10", "order": "desc"}) |
There was a problem hiding this comment.
Breaking API change — iterator element type
Both ListMembershipsForResource and ListMembershipsForResourceByExternalID now return *Iterator[UserOrganizationMembershipBaseWithUser] instead of *Iterator[UserOrganizationMembershipBaseListData]. Any caller that stores the result, assigns it to a typed variable, or calls iter.Current() and assigns the return value will fail to compile after upgrading. Since the module is already at v7, this constitutes a semver-breaking change that normally requires a major version bump (e.g. v8).
| Role *SlimRole `json:"role"` | ||
| // User is the user that belongs to the organization through this membership. |
There was a problem hiding this comment.
User field missing omitempty on membership structs
User *User \json:"user"`is added to bothUserOrganizationMembershipandOrganizationMembershipwithoutomitempty. When callers marshal these structs to JSON and the API response did not embed a user (e.g. older API versions or endpoints that don't expand user details), the output will include "user": nullrather than omitting the key. If the field is only conditionally populated by the API, addingomitempty` would be safer.
| // User is the user that belongs to the organization through this membership. | ||
| User *User `json:"user"` |
There was a problem hiding this comment.
User field on UserOrganizationMembershipBaseWithUser missing omitempty
Same consideration as the sibling structs: User *User \json:"user"`withoutomitemptywill serialize as"user": null when the field is unset. If the embedded user is always required by the API contract, the field could be non-pointer (User User). If it is optional, omitempty` is appropriate.
Summary
Userfield toUserOrganizationMembershipandOrganizationMembershipstructs to include user details in membership responsesUserOrganizationMembershipBaseWithUserstruct with embedded user information for authorization endpointsAuthorizationService.ListMembershipsForResource()andListMembershipsForResourceByExternalID()fromUserOrganizationMembershipBaseListDatatoUserOrganizationMembershipBaseWithUserDsyncTokenCreated,DsyncTokenCreatedData,DsyncTokenDeleted, andDsyncTokenDeletedDatafor directory sync token lifecycle eventsNamefield toDirectoryUser,DirectoryUserWithGroups,DsyncUserUpdatedData, andProfilestructsEventContextActorSourceAdminPortalconstant for admin portal actor sourceUserOrganizationMembershipBaseWithUserStatusAPIKeyValidationResponseto use newAPIKeyValidationResponseAPIKeystruct with its own owner typeTriggered by workos/openapi-spec@91fc76a