feat: add support for role_slug in invitation schema#1567
Conversation
📝 WalkthroughWalkthroughAdded Changes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR adds Confidence Score: 5/5Safe to merge — the change is small, additive, and fully consistent across interfaces, serializers, and fixtures. All four interfaces, both serializers, and both fixtures are updated in lockstep. No breaking changes, no missing mappings, and the fixture cleanup resolves a pre-existing inconsistency. No P0 or P1 issues found. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["API Response\n(InvitationResponse / InvitationEventResponse)"] -->|"role_slug: string | null"| B["deserializeInvitation\ndeserializeInvitationEvent"]
B -->|"roleSlug: string | null"| C["Invitation / InvitationEvent\n(client model)"]
D["Fixtures\ninvitation.json\nlist-invitations.json"] -.->|"role_slug: 'admin'"| A
Reviews (3): Last reviewed commit: "add description" | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/user-management/interfaces/invitation.interface.ts`:
- Line 12: The new exported interface properties (e.g., roleSlug) were made
required and can break consumers; make each of these properties optional instead
by adding the optional modifier (e.g., change roleSlug: string | null to
roleSlug?: string | null) in the exported interfaces where they were added
(apply the same change to the other three newly-required properties referenced
in the review) so the API remains backward compatible.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 3b5d901b-9e3f-4663-a7fa-f5c4fbc9ad21
📒 Files selected for processing (4)
src/user-management/fixtures/invitation.jsonsrc/user-management/fixtures/list-invitations.jsonsrc/user-management/interfaces/invitation.interface.tssrc/user-management/serializers/invitation.serializer.ts
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/user-management/interfaces/invitation.interface.ts (1)
23-23:⚠️ Potential issue | 🟠 MajorMake newly added
roleSlug/role_slugfields optional to preserve backward compatibility.Line 23, Line 45, Line 61, and Line 79 currently make additive fields mandatory, which can break consumers that construct these exported types before all producers are updated.
Proposed compatibility-safe diff
export interface Invitation { @@ - roleSlug: string | null; + roleSlug?: string | null; @@ } export interface InvitationEvent { @@ - roleSlug: string | null; + roleSlug?: string | null; @@ } export interface InvitationResponse { @@ - role_slug: string | null; + role_slug?: string | null; @@ } export interface InvitationEventResponse { @@ - role_slug: string | null; + role_slug?: string | null; @@ }Also applies to: 45-45, 61-61, 79-79
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/user-management/interfaces/invitation.interface.ts` at line 23, The newly added fields (roleSlug / role_slug) were made required and must be optional to avoid breaking consumers; update each occurrence in the invitation interfaces so the property is optional (e.g., change roleSlug: string | null to roleSlug?: string | null and likewise role_slug?: string | null) in the related interface declarations (look for properties named roleSlug and role_slug in invitation.interface.ts and its exported types) to preserve backward compatibility.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@src/user-management/interfaces/invitation.interface.ts`:
- Line 23: The newly added fields (roleSlug / role_slug) were made required and
must be optional to avoid breaking consumers; update each occurrence in the
invitation interfaces so the property is optional (e.g., change roleSlug: string
| null to roleSlug?: string | null and likewise role_slug?: string | null) in
the related interface declarations (look for properties named roleSlug and
role_slug in invitation.interface.ts and its exported types) to preserve
backward compatibility.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: fdb59ebb-e809-40f1-9600-799f82b795bd
📒 Files selected for processing (1)
src/user-management/interfaces/invitation.interface.ts
Description
Adds support for
role_slugin invitation API responses and eventsDocumentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.
docs added in https://github.com/workos/workos/pull/56857
Summary by CodeRabbit