Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/workos/directory_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ def list_users(
}

if group_id is not None:
list_params["group"] = group_id
list_params["group_id"] = group_id
if directory_id is not None:
list_params["directory"] = directory_id
list_params["directory_id"] = directory_id
Comment on lines +187 to +189
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: The WorkOS API expects group not group_id. The type definition in src/workos/types/directory_sync/list_filters.py:15 defines DirectoryUserListFilters with group: Optional[str], and tests at tests/test_directory_sync.py:166 verify this. This change will break API calls.

Suggested change
list_params["group_id"] = group_id
if directory_id is not None:
list_params["directory"] = directory_id
list_params["directory_id"] = directory_id
if group_id is not None:
list_params["group"] = group_id
if directory_id is not None:
list_params["directory"] = directory_id
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/workos/directory_sync.py
Line: 187:189

Comment:
**logic:** The WorkOS API expects `group` not `group_id`. The type definition in `src/workos/types/directory_sync/list_filters.py:15` defines `DirectoryUserListFilters` with `group: Optional[str]`, and tests at `tests/test_directory_sync.py:166` verify this. This change will break API calls.

```suggestion
        if group_id is not None:
            list_params["group"] = group_id
        if directory_id is not None:
            list_params["directory"] = directory_id
```

How can I resolve this? If you propose a fix, please make it concise.


response = self._http_client.request(
"directory_users",
Expand Down Expand Up @@ -218,9 +218,9 @@ def list_groups(
}

if user_id is not None:
list_params["user"] = user_id
list_params["user_id"] = user_id
if directory_id is not None:
list_params["directory"] = directory_id
list_params["directory_id"] = directory_id
Comment on lines +221 to +223
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: The WorkOS API expects user and directory not user_id and directory_id. The type definition in src/workos/types/directory_sync/list_filters.py:20-21 defines DirectoryGroupListFilters with user: Optional[str] and directory: Optional[str], and tests at tests/test_directory_sync.py:184,202 verify this. This change will break API calls.

Suggested change
list_params["user_id"] = user_id
if directory_id is not None:
list_params["directory"] = directory_id
list_params["directory_id"] = directory_id
if user_id is not None:
list_params["user"] = user_id
if directory_id is not None:
list_params["directory"] = directory_id
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/workos/directory_sync.py
Line: 221:223

Comment:
**logic:** The WorkOS API expects `user` and `directory` not `user_id` and `directory_id`. The type definition in `src/workos/types/directory_sync/list_filters.py:20-21` defines `DirectoryGroupListFilters` with `user: Optional[str]` and `directory: Optional[str]`, and tests at `tests/test_directory_sync.py:184,202` verify this. This change will break API calls.

```suggestion
        if user_id is not None:
            list_params["user"] = user_id
        if directory_id is not None:
            list_params["directory"] = directory_id
```

How can I resolve this? If you propose a fix, please make it concise.


response = self._http_client.request(
"directory_groups",
Expand Down Expand Up @@ -322,9 +322,9 @@ async def list_users(
}

if group_id is not None:
list_params["group"] = group_id
list_params["group_id"] = group_id
if directory_id is not None:
list_params["directory"] = directory_id
list_params["directory_id"] = directory_id
Comment on lines +325 to +327
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Same issue in async version: API expects group and directory not group_id and directory_id. This will break async API calls.

Suggested change
list_params["group_id"] = group_id
if directory_id is not None:
list_params["directory"] = directory_id
list_params["directory_id"] = directory_id
if group_id is not None:
list_params["group"] = group_id
if directory_id is not None:
list_params["directory"] = directory_id
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/workos/directory_sync.py
Line: 325:327

Comment:
**logic:** Same issue in async version: API expects `group` and `directory` not `group_id` and `directory_id`. This will break async API calls.

```suggestion
        if group_id is not None:
            list_params["group"] = group_id
        if directory_id is not None:
            list_params["directory"] = directory_id
```

How can I resolve this? If you propose a fix, please make it concise.


response = await self._http_client.request(
"directory_users",
Expand Down Expand Up @@ -355,9 +355,9 @@ async def list_groups(
"order": order,
}
if user_id is not None:
list_params["user"] = user_id
list_params["user_id"] = user_id
if directory_id is not None:
list_params["directory"] = directory_id
list_params["directory_id"] = directory_id
Comment on lines +358 to +360
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Same issue in async version: API expects user and directory not user_id and directory_id. This will break async API calls.

Suggested change
list_params["user_id"] = user_id
if directory_id is not None:
list_params["directory"] = directory_id
list_params["directory_id"] = directory_id
if user_id is not None:
list_params["user"] = user_id
if directory_id is not None:
list_params["directory"] = directory_id
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/workos/directory_sync.py
Line: 358:360

Comment:
**logic:** Same issue in async version: API expects `user` and `directory` not `user_id` and `directory_id`. This will break async API calls.

```suggestion
        if user_id is not None:
            list_params["user"] = user_id
        if directory_id is not None:
            list_params["directory"] = directory_id
```

How can I resolve this? If you propose a fix, please make it concise.


response = await self._http_client.request(
"directory_groups",
Expand Down
8 changes: 4 additions & 4 deletions src/workos/types/directory_sync/list_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ class DirectoryUserListFilters(
ListArgs,
total=False,
):
group: Optional[str]
directory: Optional[str]
group_id: Optional[str]
directory_id: Optional[str]


class DirectoryGroupListFilters(ListArgs, total=False):
user: Optional[str]
directory: Optional[str]
user_id: Optional[str]
directory_id: Optional[str]
8 changes: 4 additions & 4 deletions tests/test_directory_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def test_list_users_with_directory(
assert request_kwargs["url"].endswith("/directory_users")
assert request_kwargs["method"] == "get"
assert request_kwargs["params"] == {
"directory": "directory_id",
"directory_id": "directory_id",
"limit": 10,
"order": "desc",
}
Expand All @@ -163,7 +163,7 @@ def test_list_users_with_group(
assert request_kwargs["url"].endswith("/directory_users")
assert request_kwargs["method"] == "get"
assert request_kwargs["params"] == {
"group": "directory_grp_id",
"group_id": "directory_grp_id",
"limit": 10,
"order": "desc",
}
Expand All @@ -181,7 +181,7 @@ def test_list_groups_with_directory(
assert request_kwargs["url"].endswith("/directory_groups")
assert request_kwargs["method"] == "get"
assert request_kwargs["params"] == {
"directory": "directory_id",
"directory_id": "directory_id",
"limit": 10,
"order": "desc",
}
Expand All @@ -199,7 +199,7 @@ def test_list_groups_with_user(
assert request_kwargs["url"].endswith("/directory_groups")
assert request_kwargs["method"] == "get"
assert request_kwargs["params"] == {
"user": "directory_user_id",
"user_id": "directory_user_id",
"limit": 10,
"order": "desc",
}
Expand Down