Skip to content

feat: Add resource_type_slug to createOrganizationRole to create resource-scoped custom roles#1549

Merged
gjtorikian merged 1 commit intomainfrom
at-add-custom-fga-role-support
Apr 13, 2026
Merged

feat: Add resource_type_slug to createOrganizationRole to create resource-scoped custom roles#1549
gjtorikian merged 1 commit intomainfrom
at-add-custom-fga-role-support

Conversation

@atainter
Copy link
Copy Markdown
Contributor

Also makes permission slug optional. If omitted, the service will create auto-generated slugs

@atainter atainter requested review from a team as code owners April 10, 2026 23:01
@atainter atainter requested a review from mattgd April 10, 2026 23:01
@atainter atainter changed the title Add resource_type_slug to createOrganizationRole to create resource-scoped custom roles feat: Add resource_type_slug to createOrganizationRole to create resource-scoped custom roles Apr 10, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 10, 2026

Greptile Summary

This PR makes slug optional in CreateOrganizationRoleOptions (allowing the service to auto-generate slugs) and adds resourceTypeSlug to support resource-scoped custom organization roles. The changes are minimal, follow the existing pattern established by createEnvironmentRole, and are covered by two new tests.

Confidence Score: 5/5

Safe 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

Filename Overview
src/authorization/interfaces/create-organization-role-options.interface.ts Makes slug optional and adds resourceTypeSlug/resource_type_slug to both the input and serialized interfaces — consistent with the environment role counterpart.
src/authorization/serializers/create-organization-role-options.serializer.ts Adds resource_type_slug: options.resourceTypeSlug mapping; undefined values are stripped by JSON.stringify, so omitting optional fields is handled correctly.
src/authorization/authorization.spec.ts Adds two tests covering the new resourceTypeSlug field and optional slug; fixtures and assertions align correctly with the serializer and deserializer behavior.

Sequence Diagram

sequenceDiagram
    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
Loading

Reviews (1): Last reviewed commit: "Add resource_type_slug to createOrganiza..." | Re-trigger Greptile

Copy link
Copy Markdown
Contributor

@swaroopAkkineniWorkos swaroopAkkineniWorkos left a comment

Choose a reason for hiding this comment

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

Curious, was the pr autogenerated by the sdk generator?

@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 13, 2026

ENT-5502 SDKs

@gjtorikian
Copy link
Copy Markdown
Contributor

Curious, was the pr autogenerated by the sdk generator?

No, I'm waiting for #1535 and #1536 to be approved first.

@gjtorikian gjtorikian merged commit 36fb14a into main Apr 13, 2026
8 of 9 checks passed
@gjtorikian gjtorikian deleted the at-add-custom-fga-role-support branch April 13, 2026 16:38
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.

3 participants