Add missing roles field to getUserPermissions types#126
Merged
dshoen619 merged 1 commit intoJun 14, 2026
Conversation
…types The PDP returns a roles array in getUserPermissions responses, but the SDK types did not include it, forcing users to use type assertions. Fixes PER-14323 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the SDK’s getUserPermissions response typing to match what the PDP actually returns, removing the need for consumers to rely on as any when accessing roles.
Changes:
- Adds an optional
roles?: string[]field toTenantPermissions. - Adds an optional
roles?: string[]field toResourcePermissions.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
zeevmoney
approved these changes
Jun 14, 2026
zeevmoney
left a comment
There was a problem hiding this comment.
Verified the roles?: string[] addition end-to-end against the source of truth:
- permit-backend rego emits
{"permissions": [...], "roles": [...]}per entry in user_permissions. - PDP (
/user-permissions) struct:roles: Option<Vec<String>>with serdeskip_serializing_if = "Option::is_none"→ field nameroles, omitted when absent (nevernull), string array when present. - SDK passes the PDP response through untouched as
IUserPermissions.
The type matches on field name, string[] ↔ Vec<String>, and optionality. Adding roles? to both TenantPermissions and ResourcePermissions is required for result[key].roles to type-check on the union; tsconfig has no noUncheckedIndexedAccess, so access works without as any. Well-isolated, correct.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
roles?: string[]toTenantPermissionsandResourcePermissionsinterfaces insrc/enforcement/interfaces.tsrolesarray ingetUserPermissionsresponses, but the SDK types were missing this field, forcing users to useas anytype assertionsFixes PER-14323