Skip to content

dev: Implemented workspace roles endpoint and pagination support#54

Merged
Prashant-Surya merged 1 commit into
mainfrom
role-pagination
Jun 24, 2026
Merged

dev: Implemented workspace roles endpoint and pagination support#54
Prashant-Surya merged 1 commit into
mainfrom
role-pagination

Conversation

@gurusainath

@gurusainath gurusainath commented Jun 24, 2026

Copy link
Copy Markdown
Member

Description

Implemented support for workspace roles APIs and added pagination handling in the Plane SDK.

Changes

  • Added support for workspace roles endpoints.
  • Implemented SDK methods for fetching workspace roles.
  • Added pagination support for paginated API responses.
  • Improved SDK handling of paginated resources for a more consistent developer experience.
  • Maintained backward compatibility with existing SDK usage patterns.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Test Scenarios

  • Verified workspace roles can be retrieved through the SDK.
  • Tested paginated responses across supported endpoints.
  • Verified pagination parameters and navigation work correctly.
  • Confirmed existing SDK functionality remains unaffected.
  • Validated response serialization and type handling.

Summary by CodeRabbit

  • New Features

    • Added role management support in the client, including listing roles with pagination and retrieving individual roles.
    • Added filtering by role type for workspace-level and project-level roles.
    • Expanded the README with examples and guidance for working with roles and role identifiers.
  • Tests

    • Added coverage for listing roles, filtering by role type, and fetching a single role.

@gurusainath gurusainath self-assigned this Jun 24, 2026
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a Roles API resource to the Plane Python SDK. New Pydantic models Role and PaginatedRoleResponse define the response shapes. A Roles client class provides list() (with namespace, per_page, cursor filtering) and retrieve() methods. PlaneClient gains a self.roles attribute. Smoke tests and README examples are included.

Changes

Roles API Resource

Layer / File(s) Summary
Role and PaginatedRoleResponse models
plane/models/roles.py
Role Pydantic model with optional name, slug, namespace fields (extra="allow"); PaginatedRoleResponse extends PaginatedResponse with results: list[Role].
Roles API client and PlaneClient wiring
plane/api/roles.py, plane/client/plane_client.py
Roles(BaseResource) with list() (optional namespace/per_page/cursor params, returns PaginatedRoleResponse) and retrieve() (returns Role); PlaneClient imports Roles and assigns self.roles = Roles(self.config).
Smoke tests and README examples
tests/unit/test_roles.py, README.md
Four smoke tests covering list, namespace-filtered list (workspace and project), and retrieve-by-id; README adds a Roles subsection with code snippets and a (namespace, slug) uniqueness note.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • Prashant-Surya

Poem

🐇 Hop, hop — a new role to define,
With namespace and slug in a line,
Paginated results flow neat,
Workspace or project — complete!
This rabbit approves the design. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding workspace roles API support with pagination.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch role-pagination

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plane/models/roles.py`:
- Around line 9-11: Update the docstring in roles.py for the role model (the
class that defines id/label/slug) so it says the extra API fields are accepted
and preserved for forward compatibility, not ignored. Keep the note that slug is
the stable identifier to use in code, and make the wording consistent with the
model’s behavior and any typed extras handling in the Role class.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d6f65329-685a-417d-a680-484cf6bc8d2c

📥 Commits

Reviewing files that changed from the base of the PR and between ce9c0b3 and 7650c53.

📒 Files selected for processing (5)
  • README.md
  • plane/api/roles.py
  • plane/client/plane_client.py
  • plane/models/roles.py
  • tests/unit/test_roles.py

Comment thread plane/models/roles.py
Comment on lines +9 to +11
The API returns additional fields (``id``, ``permissions``, ``level``,
``member_count``, ...); only the three below are modeled and the rest are
ignored. ``slug`` is the stable identifier to use in code, but it is **not**

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

In Pydantic v2.4, when model_config uses ConfigDict(extra="allow"), are unknown fields preserved and included in model_dump by default?

💡 Result:

Yes, in Pydantic v2.4 (and throughout the v2 series), when a model is configured with ConfigDict(extra="allow"), unknown fields are preserved and included in the output of model_dump by default [1][2][3]. When extra="allow" is set, any data provided to the model that does not correspond to a defined field is stored in a special dictionary attribute called pydantic_extra [1][2]. During serialization, Pydantic's model_dump method automatically includes the contents of pydantic_extra alongside the standard fields [1][2][3]. Example behavior: from pydantic import BaseModel, ConfigDict class Model(BaseModel): x: int model_config = ConfigDict(extra='allow') m = Model(x=1, y='a') assert m.model_dump == {'x': 1, 'y': 'a'} # Unknown field 'y' is included [1][3] assert m.pydantic_extra == {'y': 'a'} # Extra data is stored here [1][2] Note that while this is the standard behavior for model_dump, recent discussions in the Pydantic ecosystem have highlighted that this integration can sometimes be complex when using model_construct or specific serialization overrides [4][5]. However, under normal instantiation and serialization, these extra fields are included [1][2][3].

Citations:


Docstring should say extras are accepted, not ignored
plane/models/roles.py:9-11 — The API returns additional fields (id, permissions, level, member_count, ...); only the three below are explicitly typed, and the rest are accepted and preserved for forward compatibility. slug is the stable identifier to use in code, but it is not ...

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plane/models/roles.py` around lines 9 - 11, Update the docstring in roles.py
for the role model (the class that defines id/label/slug) so it says the extra
API fields are accepted and preserved for forward compatibility, not ignored.
Keep the note that slug is the stable identifier to use in code, and make the
wording consistent with the model’s behavior and any typed extras handling in
the Role class.

@Prashant-Surya Prashant-Surya merged commit b07b7e5 into main Jun 24, 2026
4 checks passed
@Prashant-Surya Prashant-Surya deleted the role-pagination branch June 24, 2026 16:44
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.

3 participants