Skip to content

Conversation

@tburgin
Copy link

@tburgin tburgin commented Nov 21, 2025

Description

Add missing fields to directorysync.UserGroup. Looking at the API docs created_at and updated_at exist. When pulling real data the rest of the fields also exist. I am really only after created_at and updated_at - I am happy to drop the rest of the new fields if that is easier.

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[X] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

@tburgin tburgin requested a review from a team as a code owner November 21, 2025 21:25
@tburgin tburgin requested a review from atainter November 21, 2025 21:25
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 21, 2025

Greptile Overview

Greptile Summary

Added missing fields to directorysync.UserGroup struct to align with WorkOS API response data, including IdpID, DirectoryID, OrganizationID, CreatedAt, UpdatedAt, and RawAttributes.

  • Added 6 new fields with proper json tags matching API field names
  • Updated all test fixtures to include realistic data for new fields
  • Missing json tags on pre-existing fields (Object, ID, Name) - these should be added for consistency with the Group struct

Confidence Score: 3/5

  • Safe to merge with one fix needed for json tags on existing fields
  • The new fields are correctly added with proper json tags and comprehensive test coverage. However, the existing Object, ID, and Name fields lack json tags, which is inconsistent with the Group struct and could cause unmarshaling issues from API responses
  • Pay attention to pkg/directorysync/client.go - add missing json tags to existing fields

Important Files Changed

File Analysis

Filename Score Overview
pkg/directorysync/client.go 3/5 Added 6 fields to UserGroup struct with proper json tags, but existing fields (Object, ID, Name) lack json tags

Sequence Diagram

sequenceDiagram
    participant Client as API Client
    participant DS as DirectorySync Client
    participant API as WorkOS API
    participant DB as Directory Provider

    Note over Client,DB: List Users with Group Data
    Client->>DS: ListUsers(opts)
    DS->>API: GET /directory_users
    API->>DB: Fetch users with groups
    DB-->>API: User data with group metadata
    API-->>DS: JSON response with UserGroup fields
    Note over DS: Unmarshal UserGroup struct<br/>(object, id, name, idp_id,<br/>directory_id, organization_id,<br/>created_at, updated_at,<br/>raw_attributes)
    DS-->>Client: User objects with populated Groups[]
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Comments (1)

  1. pkg/directorysync/client.go, line 68-76 (link)

    syntax: Missing json tags on Object, ID, and Name fields. The Group struct (line 252) has json tags for these fields. Should add:

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant