[CSM Portal] Align GET /cases/{id} OpenAPI spec with entity-service - #819
Conversation
|
Warning Review limit reached
More reviews will be available in 41 minutes and 18 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe ChangesCases Endpoint API Contract
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@apps/csm-portal/backend/openapi.yaml`:
- Around line 86-90: The path parameter "id" in the POST endpoints
/cases/{id}/comments and /cases/{id}/comments/search is missing the UUID format;
update the parameter schema for the path parameter named id in both handler
definitions to include format: uuid (matching the GET /cases/{id} parameter) so
all case ID parameters consistently declare type: string and format: uuid for
validation and codegen.
- Around line 86-90: GetCase currently only checks for empty caseID and relies
on OpenAPI docs for UUID validity; add explicit UUID parsing/validation in
internal/handler/cases.go (e.g., in GetCase or a shared helper used by GetCase)
using a UUID parser (uuid.Parse/ParseUUID) and return a 400 with a clear
malformed-UUID error when parsing fails; update internal/handler/response.go to
ensure that malformed-UUID returns the intended ErrMsgBadRequest (or add a
specific error message constant) and extend internal/handler/cases_test.go with
a test case for a malformed UUID to assert the handler returns 400 and the
expected error message.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 97cdfca6-d77a-4e91-bafb-9edb86dc665d
📒 Files selected for processing (1)
apps/csm-portal/backend/openapi.yaml
c65af89 to
6f3d461
Compare
- Add format: uuid to path parameter
- Add 200 response body referencing the Case schema
- Add 400 (malformed UUID), 403, 404, 500 responses with ErrorPayload
- Matches the GET /cases/{id} contract introduced in entity-service PR wso2-open-operations#818
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add format: uuid to /cases/{id}/comments and /cases/{id}/comments/search
path parameters for consistency
- Add explicit UUID validation in GetCase handler to fail-fast with 400
before forwarding a malformed ID to the entity service
- Update TestGetCase to use valid UUIDs; add malformed UUID subtest
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6f3d461 to
b9aac29
Compare
Summary
GET /cases/{id}OpenAPI spec with the entity-service contract introduced in [Customer Entity] Add GET /cases/{id} endpoint #818format: uuidto the path parameter (entity-service validates UUID format server-side → 400)CaseschemaErrorPayloadschema referencesnext_statesinjection continues to workTest plan
TestGetCasesubtests continue to pass (auth, empty ID, happy path, upstream errors, next_states injection)🤖 Generated with Claude Code
Summary by CodeRabbit