Skip to content

fix:adding idempotency to readme#267

Open
pengying wants to merge 1 commit intomainfrom
03-13-fix_adding_idempotency_to_readme
Open

fix:adding idempotency to readme#267
pengying wants to merge 1 commit intomainfrom
03-13-fix_adding_idempotency_to_readme

Conversation

@pengying
Copy link
Contributor

@pengying pengying commented Mar 13, 2026

TL;DR

Added comprehensive idempotency documentation to the OpenAPI README, covering requirements for money movement endpoints, implementation details, and SDK usage examples.

What changed?

Added a new "Idempotency" section to the OpenAPI README that includes:

  • Requirements for endpoints that trigger money movement to support idempotency
  • Reference to the IETF Idempotency-Key HTTP Header Field specification
  • Table listing specific endpoints requiring idempotency (POST /quotes with immediatelyExecute: true, POST /quotes/{quoteId}/execute, POST /transfer-in, POST /transfer-out)
  • Detailed explanation of how idempotency works with different response scenarios (2xx/4xx stored, 5xx retried)
  • Code examples for TypeScript and Kotlin SDKs showing idempotency key usage
  • Design guidelines for adding new money movement endpoints

How to test?

Review the documentation for accuracy and completeness. Verify that the listed endpoints and SDK examples align with the actual API implementation and SDK interfaces.

Why make this change?

This documentation ensures developers understand how to properly implement idempotency for financial operations, preventing duplicate transactions that could occur due to retries, network failures, or client timeouts. Clear guidelines also help maintain consistency when adding new money movement endpoints.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@pengying pengying marked this pull request as ready for review March 13, 2026 14:51
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 13, 2026

Greptile Summary

This PR adds comprehensive idempotency documentation and OpenAPI spec support for the quotes endpoints. It adds an "Idempotency" section to openapi/README.md covering requirements, behavior semantics, and SDK usage, and updates quotes.yaml and quotes_{quoteId}_execute.yaml (as well as both compiled specs) to include the Idempotency-Key header parameter — addressing the gap previously called out for those endpoints.

Key changes:

  • New "Idempotency" section in the README with endpoint table, request/response deduplication semantics (2xx/4xx stored, 5xx retried), and SDK examples for TypeScript and Kotlin
  • Idempotency-Key header added to POST /quotes and POST /quotes/{quoteId}/execute in the source YAML files and both compiled specs (openapi.yaml, mintlify/openapi.yaml)
  • Design guidelines added for future money-movement endpoints

Minor notes:

  • The example value for Idempotency-Key in the new quote specs uses <uuid> (a placeholder string) rather than a real UUID, which is inconsistent with the existing transfer_in.yaml / transfer_out.yaml examples
  • The SDK support section only shows an example for quotes.execute; a parallel example for client.quotes.create(body, { idempotencyKey }) would complete the coverage for the POST /quotes + immediatelyExecute: true case

Confidence Score: 4/5

  • Safe to merge — documentation-only and OpenAPI spec changes with no application logic affected.
  • The PR correctly adds the Idempotency-Key header to the two quotes endpoints that were previously missing it, resolving the prior review comment. The README documentation is accurate. Two minor style issues (placeholder UUID example and an incomplete SDK code example) exist but do not affect correctness or runtime behavior.
  • No files require special attention; the placeholder example: &lt;uuid&gt; value in openapi/paths/quotes/quotes.yaml and openapi/paths/quotes/quotes_{quoteId}_execute.yaml (and the compiled specs) is worth fixing for consistency.

Important Files Changed

Filename Overview
openapi/README.md Adds a new "Idempotency" section with endpoint table, behavior explanation, and SDK examples. Documentation is accurate and well-structured; minor gap in SDK examples for the POST /quotes (create) path.
openapi/paths/quotes/quotes.yaml Adds the Idempotency-Key header parameter to POST /quotes; structurally correct but uses a placeholder <uuid> example value instead of a real UUID.
openapi/paths/quotes/quotes_{quoteId}_execute.yaml Adds the Idempotency-Key header parameter to POST /quotes/{quoteId}/execute; structurally correct, same <uuid> placeholder issue as quotes.yaml.
openapi.yaml Compiled spec updated to add Idempotency-Key to POST /quotes and POST /quotes/{quoteId}/execute; mirrors the individual YAML changes, same placeholder example issue.
mintlify/openapi.yaml Mintlify-specific compiled spec updated identically to openapi.yaml; same changes and same placeholder issue.

Sequence Diagram

sequenceDiagram
    participant Client
    participant Server

    Note over Client,Server: First request (with idempotency header)
    Client->>Server: POST /quotes/{quoteId}/execute
    Server->>Server: Process and store response
    Server-->>Client: 200 OK

    Note over Client,Server: Retry with same header value
    Client->>Server: POST /quotes/{quoteId}/execute
    Server-->>Client: Cached 200 OK (no reprocessing)

    Note over Client,Server: 5xx responses are not cached
    Client->>Server: POST /quotes/{quoteId}/execute
    Server->>Server: Re-process request
    Server-->>Client: Fresh response
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: openapi/paths/quotes/quotes.yaml
Line: 43

Comment:
**`<uuid>` placeholder vs actual UUID example**

The `example` value `<uuid>` is a descriptive placeholder, not a valid UUID string. The existing `transfer_in.yaml` and `transfer_out.yaml` both use a real UUID string as the example value. Using an actual UUID here would be more consistent and produce better documentation and SDK snippets via Stainless.

The same issue is present in `openapi/paths/quotes/quotes_{quoteId}_execute.yaml` (line 32), as well as both copies of the compiled spec (`openapi.yaml` and `mintlify/openapi.yaml`).

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: openapi/README.md
Line: 603-607

Comment:
**TypeScript example only covers `execute`, not `POST /quotes`**

The README table lists `POST /quotes` (with `immediatelyExecute: true`) as one of the endpoints that *requires* idempotency, but the "SDK Support" section only shows a code example for `quotes.execute`. Since `POST /quotes` has a request body, the idempotency key belongs in the separate request-options argument (second parameter for Stainless-generated SDKs when there is a body), so the usage pattern differs meaningfully from `execute`.

A developer following only these examples may not know how to pass the key for the `create` call. Consider adding a complementary TypeScript snippet alongside the existing one showing the pattern for `client.quotes.create(...body, { idempotencyKey: ... })`.

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: 57e1179

@pengying pengying force-pushed the 03-13-fix_adding_idempotency_to_readme branch from b5b7078 to 57e1179 Compare March 16, 2026 16:44
@github-actions
Copy link
Contributor

github-actions bot commented Mar 16, 2026

✱ Stainless preview builds

This PR will update the grid SDKs with the following commit messages.

kotlin

feat(api): add idempotencyKey param to quotes create/execute methods

openapi

feat(api): add Idempotency-Key header to transfers and quotes methods

python

feat(api): add idempotency_key to quotes create and execute methods

typescript

feat(api): add Idempotency-Key parameter to quotes create/execute methods

Edit this comment to update them. They will appear in their respective SDK's changelogs.

grid-openapi studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅

grid-python studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅build ✅lint ❗test ✅

pip install https://pkg.stainless.com/s/grid-python/6a6963afd278950b3d6fa796d662df3f1f36f5f7/grid-0.0.1-py3-none-any.whl
grid-kotlin studio · code · diff

generate ✅build ⏳lint ✅test ✅

grid-typescript studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅build ✅lint ❗test ✅

npm install https://pkg.stainless.com/s/grid-typescript/914c47c452cf3e6deedfb6860c3ad7f1044ddbb4/dist.tar.gz

⏳ These are partial results; builds are still running.


This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
If you push custom code to the preview branch, re-run this workflow to update the comment.
Last updated: 2026-03-16 16:55:08 UTC

Comment on lines +603 to +607
```typescript
// TypeScript
await client.quotes.execute('Quote:123', {
idempotencyKey: '550e8400-e29b-41d4-a716-446655440000',
});
Copy link
Contributor

Choose a reason for hiding this comment

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

TypeScript example only covers execute, not POST /quotes

The README table lists POST /quotes (with immediatelyExecute: true) as one of the endpoints that requires idempotency, but the "SDK Support" section only shows a code example for quotes.execute. Since POST /quotes has a request body, the idempotency key belongs in the separate request-options argument (second parameter for Stainless-generated SDKs when there is a body), so the usage pattern differs meaningfully from execute.

A developer following only these examples may not know how to pass the key for the create call. Consider adding a complementary TypeScript snippet alongside the existing one showing the pattern for client.quotes.create(...body, { idempotencyKey: ... }).

Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/README.md
Line: 603-607

Comment:
**TypeScript example only covers `execute`, not `POST /quotes`**

The README table lists `POST /quotes` (with `immediatelyExecute: true`) as one of the endpoints that *requires* idempotency, but the "SDK Support" section only shows a code example for `quotes.execute`. Since `POST /quotes` has a request body, the idempotency key belongs in the separate request-options argument (second parameter for Stainless-generated SDKs when there is a body), so the usage pattern differs meaningfully from `execute`.

A developer following only these examples may not know how to pass the key for the `create` call. Consider adding a complementary TypeScript snippet alongside the existing one showing the pattern for `client.quotes.create(...body, { idempotencyKey: ... })`.

How can I resolve this? If you propose a fix, please make it concise.

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.

1 participant