feat: Add resource_type_slug to createOrganizationRole to create resource-scoped custom roles#1549
feat: Add resource_type_slug to createOrganizationRole to create resource-scoped custom roles#1549
Conversation
…coped custom roles
Greptile SummaryThis PR makes Confidence Score: 5/5Safe to merge — changes are small, consistent with existing patterns, and well-tested. No P0/P1 findings. The serializer correctly relies on JSON.stringify to strip undefined optional fields. The interface changes are backward-compatible (making a required field optional is non-breaking). Tests cover both new behaviors. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant SDK as WorkOS SDK
participant Serializer as serializeCreateOrganizationRoleOptions
participant API as WorkOS API
Caller->>SDK: createOrganizationRole(orgId, { name, slug?, resourceTypeSlug? })
SDK->>Serializer: serialize options
Note over Serializer: Maps resourceTypeSlug → resource_type_slug<br/>Strips undefined fields via JSON.stringify
Serializer-->>SDK: { name, slug?, resource_type_slug? }
SDK->>API: POST /authorization/organizations/{orgId}/roles
API-->>SDK: OrganizationRoleResponse (with resource_type_slug)
SDK->>SDK: deserializeOrganizationRole() resource_type_slug → resourceTypeSlug
SDK-->>Caller: OrganizationRole
Reviews (1): Last reviewed commit: "Add resource_type_slug to createOrganiza..." | Re-trigger Greptile |
Also makes permission slug optional. If omitted, the service will create auto-generated slugs