feat(openapi): Update openapi specs for v2 pool balances#487
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (2)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the WalkthroughThe changes introduce a new Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant V1SDK
participant API
participant DB
Client->>V1SDK: GetPoolBalancesLatest()
V1SDK->>API: GET /pool/balances/latest
API->>DB: Query latest balances
DB-->>API: Return balances
API-->>V1SDK: Respond with PoolBalancesLatestResponse
V1SDK-->>Client: Return PoolBalancesLatestResponse.Data
Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches🧪 Generate unit tests
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: 0
🧹 Nitpick comments (1)
pkg/client/docs/models/components/poolbalanceslatestresponse.md (1)
1-10: Documentation structure looks good with minor formatting suggestion.The documentation accurately describes the
PoolBalancesLatestResponsemodel and its requiredDatafield.Consider improving the formatting around the "OK" status indicator for better readability:
# PoolBalancesLatestResponse -OK +**Status:** OK
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
openapi.yamlis excluded by!**/*.yamlopenapi/v1-2/v1-2.yamlis excluded by!**/*.yamlpkg/client/.speakeasy/gen.lockis excluded by!**/*.lock,!**/*.lock
📒 Files selected for processing (7)
pkg/client/docs/models/components/poolbalanceslatestresponse.md(1 hunks)pkg/client/docs/models/operations/getpoolbalanceslatestresponse.md(1 hunks)pkg/client/docs/sdks/v1/README.md(1 hunks)pkg/client/models/components/poolbalanceslatestresponse.go(1 hunks)pkg/client/models/operations/getpoolbalanceslatest.go(2 hunks)pkg/client/v1.go(1 hunks)test/e2e/api_pools_test.go(2 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: laouji
PR: formancehq/payments#193
File: internal/connectors/plugins/public/dummypay/client/client.go:104-131
Timestamp: 2024-12-12T12:45:27.164Z
Learning: The `Balance` struct in `internal/connectors/plugins/public/dummypay/client/client.go` is only used in tests, so changing `AmountInMinors` from `int64` to `*big.Int` is not necessary.
test/e2e/api_pools_test.go (4)
Learnt from: fguery
PR: formancehq/payments#427
File: internal/connectors/plugins/public/qonto/balances.go:20-55
Timestamp: 2025-05-15T16:35:29.660Z
Learning: The Qonto connector plugin has unit tests for fetchNextBalances in internal/connectors/plugins/public/qonto/balances_test.go, covering success cases, missing FromPayload, invalid JSON handling, and other error conditions.
Learnt from: laouji
PR: formancehq/payments#193
File: internal/connectors/plugins/public/dummypay/client/client.go:104-131
Timestamp: 2024-12-12T12:45:27.164Z
Learning: The `Balance` struct in `internal/connectors/plugins/public/dummypay/client/client.go` is only used in tests, so changing `AmountInMinors` from `int64` to `*big.Int` is not necessary.
Learnt from: laouji
PR: formancehq/payments#193
File: test/e2e/api_accounts_test.go:97-106
Timestamp: 2024-12-12T11:00:02.458Z
Learning: In `test/e2e/api_accounts_test.go`, the `Subscribe` function already includes error handling, so it's unnecessary to add additional error handling when calling it in tests.
Learnt from: laouji
PR: formancehq/payments#317
File: internal/api/v2/handler_bank_accounts_forward_to_connector.go:17-17
Timestamp: 2025-02-07T15:47:17.240Z
Learning: In the bank accounts forward to connector handler, the connectorID validator tag is deliberately omitted to maintain error code consistency (ErrMissingOrInvalidBody for missing connectorID). The validation is instead performed manually later in the handler using models.ConnectorIDFromString.
pkg/client/models/components/poolbalanceslatestresponse.go (1)
Learnt from: laouji
PR: formancehq/payments#193
File: internal/connectors/plugins/public/dummypay/client/client.go:104-131
Timestamp: 2024-12-12T12:45:27.164Z
Learning: The `Balance` struct in `internal/connectors/plugins/public/dummypay/client/client.go` is only used in tests, so changing `AmountInMinors` from `int64` to `*big.Int` is not necessary.
pkg/client/models/operations/getpoolbalanceslatest.go (1)
Learnt from: laouji
PR: formancehq/payments#193
File: internal/connectors/plugins/public/dummypay/client/client.go:104-131
Timestamp: 2024-12-12T12:45:27.164Z
Learning: The `Balance` struct in `internal/connectors/plugins/public/dummypay/client/client.go` is only used in tests, so changing `AmountInMinors` from `int64` to `*big.Int` is not necessary.
pkg/client/v1.go (1)
undefined
<retrieved_learning>
Learnt from: laouji
PR: #193
File: internal/connectors/plugins/public/dummypay/client/client.go:104-131
Timestamp: 2024-12-12T12:45:27.164Z
Learning: The Balance struct in internal/connectors/plugins/public/dummypay/client/client.go is only used in tests, so changing AmountInMinors from int64 to *big.Int is not necessary.
</retrieved_learning>
🧬 Code Graph Analysis (3)
test/e2e/api_pools_test.go (3)
pkg/client/v3.go (1)
V3(20-22)pkg/client/v1.go (1)
V1(20-22)pkg/client/models/operations/getpoolbalanceslatest.go (1)
GetPoolBalancesLatestResponse(21-27)
pkg/client/models/operations/getpoolbalanceslatest.go (1)
pkg/client/models/components/poolbalanceslatestresponse.go (1)
PoolBalancesLatestResponse(6-8)
pkg/client/v1.go (1)
pkg/client/models/components/poolbalanceslatestresponse.go (1)
PoolBalancesLatestResponse(6-8)
🪛 LanguageTool
pkg/client/docs/models/components/poolbalanceslatestresponse.md
[grammar] ~1-~1: There might be a problem here.
Context: # PoolBalancesLatestResponse OK ## Fields | Field ...
(QB_NEW_EN_MERGED_MATCH)
🔇 Additional comments (10)
pkg/client/docs/sdks/v1/README.md (1)
1141-1147: Field rename propagated correctly – looks goodThe example now checks
res.PoolBalancesLatestResponse, in line with the new model introduced in the PR. No other adjustments are required in this snippet.test/e2e/api_pools_test.go (3)
323-323: Good generalization of test description.The updated test description better reflects that this test context now covers both v1 and v3 API endpoints for fetching pool balances.
376-382: Existing v3 test looks correct.The v3 test properly validates the response structure and data, checking that the returned balance matches the expected asset and amount.
384-390: Excellent addition of v1 API test coverage.This new test ensures that the v1 API endpoint works correctly with the new
PoolBalancesLatestResponsemodel. The test logic is consistent with the v3 test and properly validates the response structure and data.pkg/client/v1.go (1)
4292-4297: All references to the newPoolBalancesLatestResponseare correct; historicalPoolBalancesResponseremains only in the v1 historical endpointI verified that:
- The
GetPoolBalancesLatestmethod inpkg/client/v1.go(and its operation/model inmodels/operations/getpoolbalanceslatest.go) consistently usescomponents.PoolBalancesLatestResponse.- E2E tests for V1’s latest balances (
GetPoolBalancesLatest) call and assert againstGetPoolBalancesLatestResponse().- The only remaining uses of the old
components.PoolBalancesResponseare in the historicalGetPoolBalancesmethod and its models—which is intentional and should not be changed.The refactoring is complete and consistent.
pkg/client/docs/models/operations/getpoolbalanceslatestresponse.md (1)
6-10: Documentation correctly reflects the updated API model.The field name and type reference changes are consistent with the new
PoolBalancesLatestResponsemodel. The documentation accurately documents the updated response structure.pkg/client/models/components/poolbalanceslatestresponse.go (2)
6-8: Well-structured response model.The
PoolBalancesLatestResponsestruct is properly defined with appropriate JSON tags for theDatafield containing pool balance information.
10-15: Good nil-safety implementation.The
GetData()method correctly handles nil receivers by returning an empty slice, which prevents potential nil pointer dereferences and provides a safe default behavior.pkg/client/models/operations/getpoolbalanceslatest.go (2)
24-24: Note: This is a breaking change for client code.The field name change from
PoolBalancesResponsetoPoolBalancesLatestResponsewill require updates to any client code that accesses this field directly. Since this is generated code, ensure that the OpenAPI specification change is intentional and properly versioned.
36-41: Getter method correctly updated.The getter method has been properly renamed and updated to return the new
PoolBalancesLatestResponsetype, with appropriate nil-safety checks consistent with the other getter methods in the struct.
fguery
left a comment
There was a problem hiding this comment.
I don't really follow what I'm looking at if I"m being honest, but it's just a speakeasy run right?
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #487 +/- ##
=======================================
Coverage 69.65% 69.65%
=======================================
Files 627 627
Lines 32208 32208
=======================================
Hits 22436 22436
Misses 8558 8558
Partials 1214 1214 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixes: PMNT-91