| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
WorkItemDetail typed `assignees: list[UserLite]` and `labels: list[Label]`,
but the Plane API returns these relations as bare UUID strings unless the
request expands them (`expand=assignees,labels`). Retrieving any assigned or
labelled work item without that expand therefore raised:
pydantic_core.ValidationError: ... validation errors for WorkItemDetail
assignees.0 Input should be a valid dictionary or instance of UserLite
labels.0 Input should be a valid dictionary or instance of Label
Widen both to `list[str] | list[UserLite]` / `list[str] | list[Label]`,
matching the tolerance `WorkItemDetail.state` (`str | StateLite`) and the
whole `WorkItemExpand` model already grant. Adds pure model-validation unit
tests covering the unexpanded, expanded, and default-empty shapes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: c116c208-4d37-4a50-98c6-7ddb750b9208 📥 CommitsReviewing files that changed from the base of the PR and between a105871 and 2832bd3. 📒 Files selected for processing (2)
📝 Walkthrough WalkthroughThe PR updates WorkItemDetail in the Plane Python SDK to accept both unexpanded (raw UUID strings) and expanded (nested model objects) forms for assignees and labels fields, reflecting the actual API response behavior depending on query expansion parameters. Comprehensive validation tests ensure both input shapes and defaults function correctly. ChangesWorkItemDetail flexible relations schema and validation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem🚥 Pre-merge checks | ✅ 5 ✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches 🧪 Generate unit tests (beta)
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. ❤️ ShareComment @coderabbitai help to get the list of available commands and usage tips. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Problem
WorkItemDetail types its relations strictly:
But the Plane API returns assignees and labels as bare UUID strings unless the request explicitly expands them (expand=assignees,labels). So retrieving any assigned or labelled work item without that expand raises:
pydantic_core.ValidationError: 2 validation errors for WorkItemDetail assignees.0 Input should be a valid dictionary or instance of UserLite [input_value='00000000-...', input_type=str] labels.0 Input should be a valid dictionary or instance of Label [input_value='00000000-...', input_type=str]This makes a plain work_items.retrieve(...) (no expand) fail on real data — e.g. it surfaces through plane-mcp-server's retrieve_work_item_* tools against a self-hosted (CE) instance, where the default serializer returns the unexpanded shape.
Fix
Widen both relations to accept either shape:
This mirrors the tolerance the same model already grants state (str | StateLite) and that the sibling WorkItemExpand model already uses for assignees/labels. No behavior change for callers who do expand — those still validate into UserLite/Label objects.
Tests
Adds tests/unit/test_work_item_models.py — pure model-validation tests (no HTTP) covering the unexpanded (bare-ID), expanded (nested-object), and default-empty shapes. The unexpanded case fails on main and passes with this change; the full unit suite stays green.
Summary by CodeRabbit
Refactor
Tests