Skip to content

Conversation

@JasonCWang
Copy link
Contributor

@JasonCWang JasonCWang commented Jan 13, 2026

Summary by CodeRabbit

Release Notes

  • New Features
    • Added Swift account support for both payment transactions and external account management, enabling users to seamlessly register and use Swift-based bank accounts in their workflows.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 13, 2026

📝 Walkthrough

Walkthrough

The pull request adds comprehensive Swift account support across OpenAPI schemas by introducing three new schema definitions (SwiftAccountInfo, PaymentSwiftAccountInfo, SwiftAccountExternalAccountInfo) and updating existing discriminators and enums to recognize SWIFT_ACCOUNT as a valid account type in both payment and external account flows.

Changes

Cohort / File(s) Summary
New Swift Schema Definitions
openapi/components/schemas/common/SwiftAccountInfo.yaml, openapi/components/schemas/common/PaymentSwiftAccountInfo.yaml, openapi/components/schemas/external_accounts/SwiftAccountExternalAccountInfo.yaml
Three new schema files introduced to define Swift account structures: SwiftAccountInfo with required fields (accountType, accountNumber, bankName) and optional swiftBic; PaymentSwiftAccountInfo as a composition of payment info and Swift details with required reference field; SwiftAccountExternalAccountInfo as a composite of SwiftAccountInfo with beneficiary handling and discriminator mappings.
Enum & Discriminator Updates
openapi/components/schemas/common/BankAccountOrWalletType.yaml, openapi/components/schemas/common/PaymentAccountOrWalletInfo.yaml, openapi/components/schemas/external_accounts/ExternalAccountInfo.yaml
Updated to recognize SWIFT_ACCOUNT: added to BankAccountOrWalletType enum; added discriminator mapping in PaymentAccountOrWalletInfo and ExternalAccountInfo to route SWIFT_ACCOUNT to corresponding PaymentSwiftAccountInfo and SwiftAccountExternalAccountInfo schemas respectively.
Schema Composition Updates
openapi/components/schemas/external_accounts/ExternalAccountCreateRequest.yaml
Minor indentation adjustment to allOf structure; no semantic change to schema composition.
Consolidated OpenAPI Specs
mintlify/openapi.yaml, openapi.yaml
Root-level OpenAPI specification files reflecting all Swift account schema additions and discriminator updates across payment and external account variants.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main change: adding a new Swift account type to the Grid API schema.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor Author

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

@JasonCWang JasonCWang marked this pull request as ready for review January 14, 2026 18:33
@greptile-apps
Copy link

greptile-apps bot commented Jan 14, 2026

Greptile Summary

This PR adds support for SWIFT bank accounts as a new payment and external account type in the Grid API. The implementation follows the existing pattern for other account types (IBAN, NGN, UPI, etc.) by creating three schema files: SwiftAccountInfo (base schema with account number, optional SWIFT/BIC code, and bank name), PaymentSwiftAccountInfo (for incoming payments with reference field), and SwiftAccountExternalAccountInfo (for external accounts with optional beneficiary). The SWIFT_ACCOUNT type has been properly integrated into all discriminator mappings and enum types.

Key changes:

  • Added SwiftAccountInfo.yaml with required fields: accountType, accountNumber, bankName, and optional swiftBic (8-11 characters)
  • Added PaymentSwiftAccountInfo.yaml for payment flows with required reference field
  • Added SwiftAccountExternalAccountInfo.yaml with optional beneficiary support (individual or business)
  • Updated BankAccountOrWalletType.yaml enum to include SWIFT_ACCOUNT
  • Updated discriminator mappings in PaymentAccountOrWalletInfo.yaml and ExternalAccountInfo.yaml
  • Rebuilt openapi.yaml and mintlify/openapi.yaml with the new schemas

Issue found: ExternalAccountCreateRequest.yaml has incorrect YAML indentation on line 1 that will cause parsing errors.

Confidence Score: 3/5

  • This PR has a critical YAML syntax error that must be fixed before merging
  • The SWIFT account implementation follows established patterns and is well-structured, but the indentation error in ExternalAccountCreateRequest.yaml will cause YAML parsing failures and break the OpenAPI schema bundling process
  • openapi/components/schemas/external_accounts/ExternalAccountCreateRequest.yaml requires immediate attention due to syntax error

Important Files Changed

Filename Overview
openapi/components/schemas/common/SwiftAccountInfo.yaml Adds new SWIFT account schema with account number, BIC code, and bank name fields
openapi/components/schemas/common/PaymentSwiftAccountInfo.yaml Adds payment schema for SWIFT accounts with reference field for payment crediting
openapi/components/schemas/external_accounts/SwiftAccountExternalAccountInfo.yaml Adds external account schema for SWIFT with optional beneficiary information
openapi/components/schemas/external_accounts/ExternalAccountCreateRequest.yaml Introduced incorrect indentation that breaks YAML syntax

Sequence Diagram

sequenceDiagram
    participant Client
    participant GridAPI
    participant ExternalAccount as External SWIFT Account
    
    Note over Client,ExternalAccount: Creating SWIFT External Account
    Client->>GridAPI: POST /external-accounts<br/>{currency, accountInfo: {accountType: SWIFT_ACCOUNT, ...}}
    GridAPI->>GridAPI: Validate SWIFT account info<br/>(accountNumber, bankName, optional swiftBic)
    GridAPI->>GridAPI: Store beneficiary info (optional)
    GridAPI-->>Client: Return external account ID
    
    Note over Client,ExternalAccount: Receiving Payment to SWIFT Account
    Client->>GridAPI: Create quote for outgoing transaction
    GridAPI-->>Client: Return payment instructions with reference
    Client->>ExternalAccount: Initiate SWIFT transfer<br/>with reference code
    ExternalAccount->>GridAPI: Process incoming payment
    GridAPI->>GridAPI: Match payment using reference
    GridAPI-->>Client: Webhook: payment received
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

9 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@@ -1,4 +1,4 @@
allOf:
allOf:
Copy link

Choose a reason for hiding this comment

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

syntax: incorrect indentation - this line should start at column 0, not with 2 spaces

Suggested change
allOf:
allOf:

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/components/schemas/external_accounts/ExternalAccountCreateRequest.yaml
Line: 1:1

Comment:
**syntax:** incorrect indentation - this line should start at column 0, not with 2 spaces

```suggestion
allOf:
```

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
mintlify/openapi.yaml (1)

4684-4699: Add PaymentSwiftAccountInfo to PaymentInstructions.accountOrWalletInfo or remove SWIFT_ACCOUNT from the discriminator.

The PaymentAccountOrWalletInfo discriminator includes SWIFT_ACCOUNT, but PaymentInstructions.accountOrWalletInfo uses a oneOf that does not reference PaymentSwiftAccountInfo. This means SWIFT payment instructions cannot be returned through the API, creating an inconsistency between the two schemas.

openapi.yaml (1)

5106-5155: Blocker: PaymentInstructions.accountOrWalletInfo doesn’t allow SWIFT_ACCOUNT.
You added SWIFT_ACCOUNT to PaymentAccountOrWalletInfo + BankAccountOrWalletType, but PaymentInstructions can’t represent it (missing in oneOf + discriminator mapping). This will cause schema validation/codegen issues for any endpoint returning Swift payment instructions.

Proposed fix (add SWIFT_ACCOUNT to PaymentInstructions)
       accountOrWalletInfo:
         oneOf:
@@
             - title: Base Wallet
               $ref: '#/components/schemas/PaymentBaseWalletInfo'
+            - title: SWIFT Account
+              $ref: '#/components/schemas/PaymentSwiftAccountInfo'
         discriminator:
           propertyName: accountType
           mapping:
@@
               POLYGON_WALLET: '#/components/schemas/PaymentPolygonWalletInfo'
               BASE_WALLET: '#/components/schemas/PaymentBaseWalletInfo'
+              SWIFT_ACCOUNT: '#/components/schemas/PaymentSwiftAccountInfo'
🤖 Fix all issues with AI agents
In `@openapi/components/schemas/common/PaymentSwiftAccountInfo.yaml`:
- Around line 1-12: The PaymentSwiftAccountInfo schema places required and
properties alongside allOf instead of merging them; move the required and
properties into a third object inside allOf so the composed schemas (the $refs
to PaymentAccountOrWalletInfo and SwiftAccountInfo) are extended properly by an
object that declares the reference property and its requirement; update the
allOf array in PaymentSwiftAccountInfo.yaml to include that new object
containing the reference property and required:["reference"].

In
`@openapi/components/schemas/external_accounts/ExternalAccountCreateRequest.yaml`:
- Line 1: The YAML schema file ExternalAccountCreateRequest.yaml has leading
whitespace before the root key "allOf", causing it to be nested instead of a
top-level declaration; update the file so "allOf:" starts at column 0 (no
leading spaces) and re-indent the subsequent lines accordingly to maintain valid
YAML/OpenAPI structure, then run a YAML/OpenAPI validator to confirm the schema
parses correctly.
🧹 Nitpick comments (4)
openapi/components/schemas/common/SwiftAccountInfo.yaml (1)

1-24: Consider validating swiftBic with a pattern (and confirm whether it should be required).
Length-only checks allow many invalid values; if your system expects ISO 9362 BIC formatting, add a regex. Also confirm whether SWIFT routing requires BIC in practice (if yes, make it required).

Proposed schema tightening (optional)
 properties:
   swiftBic:
     type: string
     description: SWIFT/BIC code (8 or 11 characters). Recommended for international transfers.
     example: DBSASG2X
     minLength: 8
     maxLength: 11
+    # ISO 9362 (common validation): 4 letters bank + 2 letters country + 2 alnum location + optional 3 alnum branch
+    pattern: '^[A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?$'
mintlify/openapi.yaml (2)

4883-4920: Swift payment/account schemas look consistent with existing allOf composition.
Small drift risk: these inline schema definitions need to stay in sync with openapi/components/schemas/common/SwiftAccountInfo.yaml. If mintlify/openapi.yaml is not generated, consider referencing shared components instead of duplicating.


5396-5416: SwiftAccountExternalAccountInfo wiring is consistent with other external account schemas.
Same note as above: avoid drift between this inline version and the componentized SwiftAccountExternalAccountInfo.yaml used elsewhere.

openapi.yaml (1)

4883-4920: Tighten validation for SwiftAccountInfo.swiftBic (optional but high-signal).
Right now it’s only length-bounded; consider adding a BIC/SWIFT format regex (and optionally minLength: 1 for accountNumber to prevent empty strings).

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d425416 and 7aa07c6.

📒 Files selected for processing (9)
  • mintlify/openapi.yaml
  • openapi.yaml
  • openapi/components/schemas/common/BankAccountOrWalletType.yaml
  • openapi/components/schemas/common/PaymentAccountOrWalletInfo.yaml
  • openapi/components/schemas/common/PaymentSwiftAccountInfo.yaml
  • openapi/components/schemas/common/SwiftAccountInfo.yaml
  • openapi/components/schemas/external_accounts/ExternalAccountCreateRequest.yaml
  • openapi/components/schemas/external_accounts/ExternalAccountInfo.yaml
  • openapi/components/schemas/external_accounts/SwiftAccountExternalAccountInfo.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Greptile Review
🔇 Additional comments (10)
openapi/components/schemas/common/BankAccountOrWalletType.yaml (1)

10-10: LGTM!

The SWIFT_ACCOUNT enum value follows the established naming convention and integrates correctly with the existing account type enumeration.

openapi/components/schemas/common/PaymentAccountOrWalletInfo.yaml (1)

17-17: LGTM!

The discriminator mapping for SWIFT_ACCOUNT is correctly added and references the new PaymentSwiftAccountInfo.yaml schema introduced in this PR.

openapi/components/schemas/external_accounts/SwiftAccountExternalAccountInfo.yaml (1)

1-19: Schema structure is correct and follows external account patterns.

The composition with SwiftAccountInfo and the accountType enum constraint properly define the discriminator value. The beneficiary field with oneOf discriminator is properly configured for the two beneficiary types.

The reference field present in PaymentSwiftAccountInfo is not needed here—it's specific to payment flows. External account schemas (IbanAccountExternalAccountInfo, UsAccountExternalAccountInfo) intentionally omit it, and this schema correctly follows that pattern.

mintlify/openapi.yaml (2)

5054-5055: Enum expansion looks good; verify downstream validators/SDK generators handle the new value.
Adding a new enum value can break strict client-side decoders if they don’t allow unknown values.


5530-5533: ExternalAccountInfo includes SWIFT in both oneOf and discriminator mapping—LGTM.
This should make SWIFT accounts round-trip correctly through polymorphic decoding.

openapi/components/schemas/external_accounts/ExternalAccountInfo.yaml (1)

14-15: SWIFT Account integration verified: schema file exists and is properly bundled.

The referenced SwiftAccountExternalAccountInfo.yaml file exists at the expected location and is correctly integrated into both the oneOf array (line 15) and the discriminator mapping (line 37) with consistent relative paths. This follows the established pattern used for other account types.

openapi.yaml (4)

4676-4699: Good: PaymentAccountOrWalletInfo discriminator mapping extended for SWIFT_ACCOUNT.
This is the right place to wire in PaymentSwiftAccountInfo.


5044-5061: Adding SWIFT_ACCOUNT to BankAccountOrWalletType may break strict clients—verify versioning expectations.
If clients codegen enums and fail on unknown values, you may want to bump the API version/date (or clearly document “enums are extensible”).


5396-5417: SwiftAccountExternalAccountInfo looks consistent with other external-account variants.
Minor: you’re redundantly re-declaring accountType (already constrained by SwiftAccountInfo); that’s fine for consistency with other *ExternalAccountInfo schemas.


5517-5560: Good: ExternalAccountInfo oneOf + discriminator mapping updated for SWIFT_ACCOUNT.
This completes the external-account polymorphism wiring.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines +1 to +12
allOf:
- $ref: ./PaymentAccountOrWalletInfo.yaml
- $ref: ./SwiftAccountInfo.yaml
required:
- reference
properties:
reference:
type: string
description: >-
Unique reference code that must be included with the payment to properly
credit it
example: UMA-Q12345-REF
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Schema structure issue: required and properties should be inside allOf.

The required and properties blocks are siblings of allOf rather than part of the composition. In OpenAPI 3.x, this structure may not correctly merge the additional reference field with the composed schemas. To properly extend the composed schemas with additional fields, wrap them in a third object within allOf.

Proposed fix
 allOf:
   - $ref: ./PaymentAccountOrWalletInfo.yaml
   - $ref: ./SwiftAccountInfo.yaml
-required:
-  - reference
-properties:
-  reference:
-    type: string
-    description: >-
-      Unique reference code that must be included with the payment to properly
-      credit it
-    example: UMA-Q12345-REF
+  - type: object
+    required:
+      - reference
+    properties:
+      reference:
+        type: string
+        description: >-
+          Unique reference code that must be included with the payment to properly
+          credit it
+        example: UMA-Q12345-REF
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
allOf:
- $ref: ./PaymentAccountOrWalletInfo.yaml
- $ref: ./SwiftAccountInfo.yaml
required:
- reference
properties:
reference:
type: string
description: >-
Unique reference code that must be included with the payment to properly
credit it
example: UMA-Q12345-REF
allOf:
- $ref: ./PaymentAccountOrWalletInfo.yaml
- $ref: ./SwiftAccountInfo.yaml
- type: object
required:
- reference
properties:
reference:
type: string
description: >-
Unique reference code that must be included with the payment to properly
credit it
example: UMA-Q12345-REF
🤖 Prompt for AI Agents
In `@openapi/components/schemas/common/PaymentSwiftAccountInfo.yaml` around lines
1 - 12, The PaymentSwiftAccountInfo schema places required and properties
alongside allOf instead of merging them; move the required and properties into a
third object inside allOf so the composed schemas (the $refs to
PaymentAccountOrWalletInfo and SwiftAccountInfo) are extended properly by an
object that declares the reference property and its requirement; update the
allOf array in PaymentSwiftAccountInfo.yaml to include that new object
containing the reference property and required:["reference"].

@@ -1,4 +1,4 @@
allOf:
allOf:
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Invalid YAML structure: root-level indentation.

The allOf: directive at line 1 has leading whitespace, which makes it a nested element rather than a root-level declaration. This will likely cause YAML parsing errors or unexpected schema behavior since OpenAPI expects the schema definition to start at column 0.

Proposed fix
-  allOf:
+allOf:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
allOf:
allOf:
🤖 Prompt for AI Agents
In
`@openapi/components/schemas/external_accounts/ExternalAccountCreateRequest.yaml`
at line 1, The YAML schema file ExternalAccountCreateRequest.yaml has leading
whitespace before the root key "allOf", causing it to be nested instead of a
top-level declaration; update the file so "allOf:" starts at column 0 (no
leading spaces) and re-indent the subsequent lines accordingly to maintain valid
YAML/OpenAPI structure, then run a YAML/OpenAPI validator to confirm the schema
parses correctly.

@JasonCWang JasonCWang marked this pull request as draft January 14, 2026 19:01
@JasonCWang JasonCWang closed this Jan 14, 2026
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.

2 participants