Skip to content

feat: add resourceTypeSlug to permissions, environment and organization roles#1502

Merged
csrbarber merged 1 commit intomainfrom
resource-type-slug-support
Feb 26, 2026
Merged

feat: add resourceTypeSlug to permissions, environment and organization roles#1502
csrbarber merged 1 commit intomainfrom
resource-type-slug-support

Conversation

@csrbarber
Copy link
Contributor

Description

  • Add resourceTypeSlug to permission, environment role, and organization role response deserialization
  • Add optional resourceTypeSlug to permission and environment role creation serialization

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[X] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

@csrbarber csrbarber requested a review from a team as a code owner February 26, 2026 20:23
@csrbarber csrbarber requested a review from gcarvelli February 26, 2026 20:23
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 26, 2026

Greptile Summary

This PR adds resourceTypeSlug field support across permissions, environment roles, and organization roles. The field is now included in API responses (deserialization) and can be optionally provided when creating permissions and environment roles (serialization).

  • Added resourceTypeSlug to Permission, EnvironmentRole, and OrganizationRole interfaces
  • Added optional resourceTypeSlug to CreatePermissionOptions and CreateEnvironmentRoleOptions
  • Updated all serializers to properly map between camelCase (resourceTypeSlug) and snake_case (resource_type_slug)
  • Comprehensive test coverage added, including new tests for creating resources with the optional field
  • All test fixtures consistently updated with resource_type_slug: "organization"

The implementation follows existing codebase patterns for optional field serialization and maintains consistency across all entity types.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are straightforward field additions with consistent implementation across all affected entity types, comprehensive test coverage, and proper serialization/deserialization handling that follows established codebase patterns
  • No files require special attention

Important Files Changed

Filename Overview
src/authorization/interfaces/permission.interface.ts Adds resourceTypeSlug field to Permission and PermissionResponse interfaces
src/authorization/interfaces/environment-role.interface.ts Adds resourceTypeSlug field to EnvironmentRole and EnvironmentRoleResponse interfaces
src/authorization/interfaces/organization-role.interface.ts Adds resourceTypeSlug field to OrganizationRole interface
src/authorization/serializers/permission.serializer.ts Deserializes resource_type_slug from API response to resourceTypeSlug
src/authorization/serializers/environment-role.serializer.ts Deserializes resource_type_slug from API response to resourceTypeSlug
src/authorization/serializers/organization-role.serializer.ts Deserializes resource_type_slug in both deserializeRole and deserializeOrganizationRole functions
src/authorization/authorization.spec.ts Adds comprehensive test coverage for resourceTypeSlug in create operations and response deserialization

Last reviewed commit: 5006e80

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

19 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

@atainter atainter left a comment

Choose a reason for hiding this comment

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

Should we give slug the default value of organization? We decided to make it optional at the API level right? Maybe we keep it optional here too

@csrbarber csrbarber merged commit 74dadc6 into main Feb 26, 2026
9 checks passed
@csrbarber csrbarber deleted the resource-type-slug-support branch February 26, 2026 20:36
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.

2 participants