Skip to content

fix: add missing extends field to Role types#121

Open
Kyzgor wants to merge 2 commits intopermitio:mainfrom
Kyzgor:fix/add-extends-field-to-role-types
Open

fix: add missing extends field to Role types#121
Kyzgor wants to merge 2 commits intopermitio:mainfrom
Kyzgor:fix/add-extends-field-to-role-types

Conversation

@Kyzgor
Copy link

@Kyzgor Kyzgor commented Mar 8, 2026

Problem

The extends field (Array<string>) is present in the Permit.io API OpenAPI spec and returned by the API, but is missing from the RoleRead, RoleCreate, and RoleUpdate TypeScript interfaces in the SDK.

This means SDK users cannot:

  • Create roles with inheritance: permit.api.roles.create({ key: 'editor', name: 'Editor', extends: ['viewer'] })
  • Update role hierarchy: permit.api.roles.update('editor', { extends: ['viewer'] })
  • Read the extends field from role objects (TypeScript reports it as unknown)

Fix

Added the extends?: Array<string> field to all three role type interfaces:

  • src/openapi/types/role-read.tsRoleRead
  • src/openapi/types/role-create.tsRoleCreate
  • src/openapi/types/role-update.tsRoleUpdate

The field definition matches the OpenAPI spec and follows the existing JSDoc style in the generated types.

Verification

Tested against the live Permit.io API — all operations work correctly:

Test Result
RoleRead.extends field present on get()
RoleRead.extends field present on list()
RoleCreate with extends (create role with inheritance)
RoleUpdate with extends (add parent role)
RoleUpdate with extends: [] (remove parent role)
yarn build passes

Kyzgor added 2 commits March 8, 2026 14:33
…ate types

The `extends` field (Array<string>) is present in the Permit.io API response
and documented in the OpenAPI spec at https://api.permit.io/v2/openapi.json,
but was missing from the generated TypeScript interfaces. This prevented SDK
users from:

- Creating roles with inheritance via `permit.api.roles.create({ extends: [...] })`
- Updating role hierarchy via `permit.api.roles.update(key, { extends: [...] })`
- Reading the `extends` field from role objects returned by get/list/create/update

Verified against the live Permit.io API — all CRUD operations with the
`extends` field work correctly.
Production dependency updates:
- axios: ^1.7.4 -> ^1.13.5 (CVE DoS + form-data unsafe random)
- pino: 8.11.0 -> ^8.21.0
- pino-pretty: 10.2.0 -> ^10.3.1 (minimatch ReDoS x3, brace-expansion ReDoS)
- path-to-regexp: ^6.2.1 -> ^6.3.0 (backtracking regex)
- lodash: ^4.17.21 -> ^4.17.23 (prototype pollution in unset/omit)

Also migrated logger.ts from deprecated prettyPrint option to
pino.transport() API for pino 8.21 compatibility.

Resolves all 9 production audit vulnerabilities (0 remaining).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant