-
Notifications
You must be signed in to change notification settings - Fork 3
feat: adding idempotency to transfers #138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Greptile OverviewGreptile SummaryAdded optional Key changes:
Observations:
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| openapi/paths/transfers/transfer_in.yaml | Added optional Idempotency-Key header for safe request retries |
| openapi/paths/transfers/transfer_out.yaml | Added optional Idempotency-Key header for safe request retries |
| openapi.yaml | Built file correctly includes idempotency key changes |
| mintlify/openapi.yaml | Built file correctly includes idempotency key changes |
Sequence Diagram
sequenceDiagram
participant Client
participant API as Grid API
participant DB as Database
Note over Client,DB: First Request with Idempotency-Key
Client->>API: POST /transfer-in<br/>Idempotency-Key: abc123
API->>DB: Check if key exists
DB-->>API: Key not found
API->>DB: Store key and initiate transfer
API-->>Client: 201 Created + Transaction
Note over Client,DB: Retry with Same Idempotency-Key
Client->>API: POST /transfer-in<br/>Idempotency-Key: abc123
API->>DB: Check if key exists
DB-->>API: Key found with stored response
API-->>Client: 201 Created + Original Transaction<br/>(no duplicate transfer)
Note over Client,DB: New Request with Different Key
Client->>API: POST /transfer-out<br/>Idempotency-Key: xyz789
API->>DB: Check if key exists
DB-->>API: Key not found
API->>DB: Store key and initiate transfer
API-->>Client: 201 Created + Transaction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 2 comments
| - name: Idempotency-Key | ||
| in: header | ||
| required: false | ||
| description: > | ||
| A unique identifier for the request. If the same key is sent multiple times, | ||
| the server will return the same response as the first request. | ||
| schema: | ||
| type: string | ||
| example: 550e8400-e29b-41d4-a716-446655440000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing format constraint and maxLength. Consider adding validation to prevent abuse.
| - name: Idempotency-Key | |
| in: header | |
| required: false | |
| description: > | |
| A unique identifier for the request. If the same key is sent multiple times, | |
| the server will return the same response as the first request. | |
| schema: | |
| type: string | |
| example: 550e8400-e29b-41d4-a716-446655440000 | |
| parameters: | |
| - name: Idempotency-Key | |
| in: header | |
| required: false | |
| description: > | |
| A unique identifier for the request. If the same key is sent multiple times, | |
| the server will return the same response as the first request. | |
| schema: | |
| type: string | |
| maxLength: 255 |
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/paths/transfers/transfer_in.yaml
Line: 13:21
Comment:
Missing format constraint and maxLength. Consider adding validation to prevent abuse.
```suggestion
parameters:
- name: Idempotency-Key
in: header
required: false
description: >
A unique identifier for the request. If the same key is sent multiple times,
the server will return the same response as the first request.
schema:
type: string
maxLength: 255
```
How can I resolve this? If you propose a fix, please make it concise.| - name: Idempotency-Key | ||
| in: header | ||
| required: false | ||
| description: > | ||
| A unique identifier for the request. If the same key is sent multiple times, | ||
| the server will return the same response as the first request. | ||
| schema: | ||
| type: string | ||
| example: 550e8400-e29b-41d4-a716-446655440000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing format constraint and maxLength. Consider adding validation to prevent abuse.
| - name: Idempotency-Key | |
| in: header | |
| required: false | |
| description: > | |
| A unique identifier for the request. If the same key is sent multiple times, | |
| the server will return the same response as the first request. | |
| schema: | |
| type: string | |
| example: 550e8400-e29b-41d4-a716-446655440000 | |
| parameters: | |
| - name: Idempotency-Key | |
| in: header | |
| required: false | |
| description: > | |
| A unique identifier for the request. If the same key is sent multiple times, | |
| the server will return the same response as the first request. | |
| schema: | |
| type: string | |
| maxLength: 255 |
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/paths/transfers/transfer_out.yaml
Line: 11:19
Comment:
Missing format constraint and maxLength. Consider adding validation to prevent abuse.
```suggestion
parameters:
- name: Idempotency-Key
in: header
required: false
description: >
A unique identifier for the request. If the same key is sent multiple times,
the server will return the same response as the first request.
schema:
type: string
maxLength: 255
```
How can I resolve this? If you propose a fix, please make it concise.
TL;DR
Added Idempotency-Key header support to transfer endpoints.
What changed?
Idempotency-Keyheader parameter to the transfer-in and transfer-out API endpoints550e8400-e29b-41d4-a716-446655440000