feat/ add API contract for get impersonation requests#240
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Summary by CodeRabbit
WalkthroughA new API contract document for the Impersonation API has been introduced, detailing the GET /impersonation/requests endpoint. The documentation specifies authentication, query parameters for filtering and pagination, response formats, and error handling for retrieving impersonation requests. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API_Server
Client->>API_Server: GET /impersonation/requests (with JWT cookie, query params)
API_Server-->>Client: 200 OK (JSON list of requests with pagination) / 204 No Content / 500 Internal Server Error
Possibly related issues
Poem
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 6
🔭 Outside diff range comments (1)
impersonation/README.md (1)
96-109: Fix typos and heading punctuation
- Remove trailing colons in
#### Authentication and Authorization:and#### Additional Notes:.- Correct typo “reson” → “reason.”
- Add missing comma after
statusin the notes list.-#### Authentication and Authorization: +#### Authentication and Authorization -#### Additional Notes: +#### Additional Notes - - The provided response includes details of each request, such as ID, timestamps, username, userId, reson, status, etc. + - The provided response includes details of each request, such as ID, timestamps, username, userId, reason, status, etc.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
impersonation/README.md(1 hunks)
🧰 Additional context used
🪛 LanguageTool
impersonation/README.md
[uncategorized] ~23-~23: Loose punctuation mark.
Context: ... GET - Query Parameters: - dev: Required boolean to fetch requests. -...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~24-~24: Loose punctuation mark.
Context: ...ired boolean to fetch requests. - id: Optional string to fetch the request by...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~25-~25: Loose punctuation mark.
Context: ... fetch the request by its id. - page: Optional integer to specify the page nu...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~26-~26: Loose punctuation mark.
Context: ...r to specify the page number. - size: Optional integer to specify the number ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~26-~26: A determiner appears to be missing. Consider inserting it.
Context: ...pecify the number of requests per page. Default is 5. - createdBy: Optional string ...
(AI_EN_LECTOR_MISSING_DETERMINER)
[uncategorized] ~27-~27: Loose punctuation mark.
Context: ... per page. Default is 5. - createdBy: Optional string to filter requests by u...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~27-~27: “of” seems less likely than “or” (‘either … or’).
Context: ...l string to filter requests by username of super-user who created the request. -...
(AI_HYDRA_LEO_CP_OF_OR)
[uncategorized] ~27-~27: You might be missing the article “the” here.
Context: ...tring to filter requests by username of super-user who created the request. - `crea...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
[uncategorized] ~28-~28: Loose punctuation mark.
Context: ...ho created the request. - createdFor: Optional string to filter requests by u...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~29-~29: Loose punctuation mark.
Context: ...hom the request is created. - status: Optional string to filter requests by s...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~30-~30: Loose punctuation mark.
Context: ...APPROVED, REJECTED, PENDING). - prev: Optional string to filter requests by t...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~30-~30: This expression is usually spelled with a hyphen.
Context: ...er requests by the next cursor, used in cursor based pagination. - next: Optional string...
(BASED_HYPHEN)
[uncategorized] ~31-~31: Loose punctuation mark.
Context: ...d in cursor based pagination. - next: Optional string to filter requests by t...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~31-~31: This expression is usually spelled with a hyphen.
Context: ...er requests by the prev curosr, used in cursor based pagination. - Headers: - Conten...
(BASED_HYPHEN)
[uncategorized] ~104-~104: A comma might be missing here.
Context: ...ons are available using parameters like createdBy,createdFor,status,etc. - ...
(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
🪛 markdownlint-cli2 (0.17.2)
impersonation/README.md
9-9: Multiple consecutive blank lines
Expected: 1; Actual: 2
(MD012, no-multiple-blanks)
10-10: Multiple consecutive blank lines
Expected: 1; Actual: 3
(MD012, no-multiple-blanks)
11-11: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
45-45: Fenced code blocks should be surrounded by blank lines
null
(MD031, blanks-around-fences)
95-95: Multiple consecutive blank lines
Expected: 1; Actual: 2
(MD012, no-multiple-blanks)
96-96: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
100-100: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
🔇 Additional comments (1)
impersonation/README.md (1)
5-8: Verify table link anchor
The table references[GET /impersonation/requests](#get-impersonationrequests)but GitHub’s auto-generated anchor for the headingGET /impersonation/requestsis typically#get--impersonation-requests. Ensure the link resolves correctly or adjust the anchor text to match.
…contracts into feat/api_contract_for_get_impersonation_requests
570afeb to
a0549d1
Compare
| #### Additional Notes | ||
|
|
||
| - The provided response includes details of each request, such as ID, timestamps, username, userId, reason, status, etc. | ||
| - Pagination functionality is implemented using `next` and `prev` parameters in the response. | ||
| - Filtering options are available using parameters like `createdBy`, `createdFor`, `status`, etc. | ||
| - The response includes a list of request objects with their respective properties. | ||
| - Error handling is provided for internal server errors (status code 500). |
There was a problem hiding this comment.
Here would want Specific details, Since this is a API contract
Please avoid ambiguity here
Specify only the allowed filters, be specific with the response etc please
There was a problem hiding this comment.
i have updated this with this to remove any ambiguous details
| - **Query Parameters:** | ||
|
|
||
| - `dev`: Required boolean to fetch requests. | ||
| - `id`: Optional string to fetch the request by its id. |
There was a problem hiding this comment.
So, from this, what I understand is that to get a single request, you are passing id in query param
Why are we doing this, why not. requests/:id?
There was a problem hiding this comment.
if I use id as a path param instead of a query param, i would need to create another route which handles this specifically else in the same route I cannot send both the request by id and filter the requests also I have tried keeping this route consistent with the existing requests endpoint which handles this similarly
7552ba8 to
dd98ac7
Compare
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
|
|
||
| #### Additional Notes | ||
|
|
||
|
|
There was a problem hiding this comment.
There's a typo in the documentation - createdAT should be createdAt to maintain consistent casing with the response example shown above in the API contract.
| - The provided response includes details of each request, such as its id, createdAt, updatedAt, startedAt, endedAt, createdBy, createdFor, reason, status, userId, impersonatedUserId, isImpersonationFinished and message. | |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
Date: 21/06/2025
Developer Name: Suvidh Kaushik
Issue Ticket Number
Description
Documentation Updated?
Under Feature Flag
Database Changes
Breaking Changes
Development Tested?
Screenshots
Screenshot 1
Test Coverage
Screenshot 1
Additional Notes
Description by Korbit AI
What change is being made?
Add the API contract documentation for the
GET /impersonation/requestsendpoint to provide information on how to fetch impersonation requests with options for pagination and filtering.Why are these changes being made?
These changes are being made to document the newly introduced
GET /impersonation/requestsendpoint, ensuring developers have the necessary guidance to utilize this functionality. This endpoint allows retrieving impersonation requests, which is essential for managing and reviewing such actions, and the documentation includes important details on allowed query parameters, response structure, error handling, and authentication requirements.