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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* [#447](https://github.com/workos/workos-php/pull/447) feat(generated): regenerate from spec

**Features**
* **[user_management](https://workos.com/docs/reference/authkit/user)**:
* Added model `UserRoleAssignmentSourceGroup`
* Added `group` to `UserRoleAssignmentSource`
2 changes: 1 addition & 1 deletion .last-synced-sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
13ba15b32754d2d635b7799ab779867df2b611d6
6f037208ce812063908f97744b4aaf4fdf570351
2 changes: 2 additions & 0 deletions .oagen-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@
"lib/Resource/UserRoleAssignment.php",
"lib/Resource/UserRoleAssignmentResource.php",
"lib/Resource/UserRoleAssignmentSource.php",
"lib/Resource/UserRoleAssignmentSourceGroup.php",
"lib/Resource/UserRoleAssignmentSourceType.php",
"lib/Resource/UserSessionsAuthMethod.php",
"lib/Resource/UserSessionsImpersonator.php",
Expand Down Expand Up @@ -1336,6 +1337,7 @@
"tests/Fixtures/user_role_assignment.json",
"tests/Fixtures/user_role_assignment_resource.json",
"tests/Fixtures/user_role_assignment_source.json",
"tests/Fixtures/user_role_assignment_source_group.json",
"tests/Fixtures/user_sessions_impersonator.json",
"tests/Fixtures/user_sessions_list_item.json",
"tests/Fixtures/user_updated.json",
Expand Down
4 changes: 4 additions & 0 deletions lib/Resource/UserRoleAssignmentSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public function __construct(
public UserRoleAssignmentSourceType $type,
/** The ID of the group role assignment the role was derived from, or null if direct. */
public ?string $groupRoleAssignmentId,
/** The group the role was derived from, or null if direct. */
public ?UserRoleAssignmentSourceGroup $group,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Required group argument breaks callers

If a consumer constructs UserRoleAssignmentSource with the previously valid two arguments, the new $group parameter is required even when there is no group. Upgrading will cause that call to throw an ArgumentCountError. Defaulting the nullable parameter to null would preserve those calls.

Suggested change
public ?UserRoleAssignmentSourceGroup $group,
public ?UserRoleAssignmentSourceGroup $group = null,
Prompt To Fix With AI
This is a comment left during a code review.
Path: lib/Resource/UserRoleAssignmentSource.php
Line: 20

Comment:
**Required group argument breaks callers**

If a consumer constructs `UserRoleAssignmentSource` with the previously valid two arguments, the new `$group` parameter is required even when there is no group. Upgrading will cause that call to throw an `ArgumentCountError`. Defaulting the nullable parameter to `null` would preserve those calls.

```suggestion
        public ?UserRoleAssignmentSourceGroup $group = null,
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

) {
}

Expand All @@ -24,6 +26,7 @@ public static function fromArray(array $data): self
return new self(
type: UserRoleAssignmentSourceType::from($data['type']),
groupRoleAssignmentId: $data['group_role_assignment_id'] ?? null,
group: isset($data['group']) ? UserRoleAssignmentSourceGroup::fromArray($data['group']) : null,
);
}

Expand All @@ -32,6 +35,7 @@ public function toArray(): array
return [
'type' => $this->type->value,
'group_role_assignment_id' => $this->groupRoleAssignmentId,
'group' => $this->group?->toArray(),
];
}
}
36 changes: 36 additions & 0 deletions lib/Resource/UserRoleAssignmentSourceGroup.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

// This file is auto-generated by oagen. Do not edit.

namespace WorkOS\Resource;

readonly class UserRoleAssignmentSourceGroup implements \JsonSerializable
{
use JsonSerializableTrait;

public function __construct(
/** The unique ID of the Group the role was derived from. */
public string $id,
/** The name of the Group the role was derived from. */
public string $name,
) {
}

public static function fromArray(array $data): self
{
return new self(
id: $data['id'],
name: $data['name'],
);
}

public function toArray(): array
{
return [
'id' => $this->id,
'name' => $this->name,
];
}
}
3 changes: 2 additions & 1 deletion tests/Fixtures/list_user_role_assignment.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
},
"source": {
"type": "direct",
"group_role_assignment_id": null
"group_role_assignment_id": null,
"group": null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Group assignments lack test coverage

The assignment fixtures contain only "group": null, and no test uses the new fixture with a non-null group. Add a group-derived assignment case that checks decoding and serialization through UserRoleAssignmentSource; otherwise a regression in the new nested-group path could pass the test suite.

Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/Fixtures/list_user_role_assignment.json
Line: 18

Comment:
**Group assignments lack test coverage**

The assignment fixtures contain only `"group": null`, and no test uses the new fixture with a non-null group. Add a group-derived assignment case that checks decoding and serialization through `UserRoleAssignmentSource`; otherwise a regression in the new nested-group path could pass the test suite.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

},
"created_at": "2026-01-15T12:00:00.000Z",
"updated_at": "2026-01-15T12:00:00.000Z"
Expand Down
3 changes: 2 additions & 1 deletion tests/Fixtures/user_role_assignment.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"source": {
"type": "direct",
"group_role_assignment_id": null
"group_role_assignment_id": null,
"group": null
},
"created_at": "2026-01-15T12:00:00.000Z",
"updated_at": "2026-01-15T12:00:00.000Z"
Expand Down
3 changes: 2 additions & 1 deletion tests/Fixtures/user_role_assignment_source.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"type": "direct",
"group_role_assignment_id": null
"group_role_assignment_id": null,
"group": null
}
4 changes: 4 additions & 0 deletions tests/Fixtures/user_role_assignment_source_group.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"id": "group_01HXYZ123456789ABCDEFGHIJ",
"name": "Marketing team"
}
Loading