Skip to content

Conversation

@pengying
Copy link
Contributor

@pengying pengying commented Jan 24, 2026

TL;DR

Refactored payment account schemas to simplify the inheritance structure and added platform account identification.

What changed?

  • Removed the PaymentAccountOrWalletInfo base schema and its discriminator pattern
  • Simplified inheritance by having payment account types directly reference their base account info
  • Replaced enum with const for account types and asset types to improve type safety
  • Relocated the ClabeAccountInfo schema to a more logical position in the schema hierarchy
  • Added isPlatformAccount boolean field to PaymentInstructions to distinguish between platform and customer accounts
  • Moved NgnAccountInfo schema to maintain better organization

@greptile-apps
Copy link

greptile-apps bot commented Jan 24, 2026

Greptile Overview

Greptile Summary

This PR successfully refactors the payment account schema architecture by removing the PaymentAccountOrWalletInfo base schema and its discriminator pattern. The changes simplify the inheritance structure by having payment account types directly reference their base account info schemas (e.g., ClabeAccountInfo, UsAccountInfo) instead of going through an intermediate polymorphic base type.

Key changes:

  • Removed PaymentAccountOrWalletInfo.yaml base schema and BankAccountOrWalletType enum that were used for discriminator-based polymorphism
  • Simplified all Payment* schemas to use single-level allOf inheritance from their respective base schemas
  • Replaced single-value enum declarations with const for accountType and assetType fields, improving type safety and clarity
  • Added isPlatformAccount boolean field to PaymentInstructions to distinguish platform vs customer accounts
  • Removed PaymentFboAccountInfo schema entirely (FBO account type no longer supported in payment instructions)
  • Moved ClabeAccountInfo and NgnAccountInfo schemas to better locations in the bundled output

The refactoring maintains backward compatibility for the discriminator pattern in PaymentInstructions.accountOrWalletInfo while simplifying the underlying schema definitions. The use of const instead of enum for single-value fields is a best practice that provides better OpenAPI tooling support.

Confidence Score: 5/5

  • This PR is safe to merge with no issues found
  • The refactoring is well-executed with consistent changes across all affected schemas. The removal of the intermediate base schema simplifies the architecture without breaking the discriminator pattern in PaymentInstructions. All Payment* schemas follow the same pattern, enum-to-const conversions are syntactically correct, and the addition of isPlatformAccount is a clean additive change.
  • No files require special attention

Important Files Changed

Filename Overview
openapi/components/schemas/common/PaymentInstructions.yaml Added isPlatformAccount boolean field to distinguish between platform and customer accounts. Removed FBO Account from oneOf and discriminator mapping.
openapi/components/schemas/common/PaymentAccountOrWalletInfo.yaml File deleted - removed base schema with discriminator pattern that was previously used for polymorphic account/wallet types.
openapi/components/schemas/common/PaymentLightningInvoiceInfo.yaml Changed from allOf inheritance to standalone type: object, replaced enum with const for accountType, added missing type: string declaration.
openapi/components/schemas/common/PaymentFboAccountInfo.yaml File deleted - FBO account type removed from payment instructions schema.
openapi/components/schemas/common/PaymentTronWalletInfo.yaml Removed reference to PaymentAccountOrWalletInfo, replaced enum with const for assetType (USDT).
openapi/components/schemas/common/PaymentPolygonWalletInfo.yaml Removed reference to PaymentAccountOrWalletInfo, replaced enum with const for assetType (USDC).
openapi/components/schemas/common/PaymentBaseWalletInfo.yaml Removed reference to PaymentAccountOrWalletInfo, replaced enum with const for assetType (USDC).

Sequence Diagram

sequenceDiagram
    participant Client
    participant API as Grid API
    participant Schema as Payment Schema
    
    Note over Client,Schema: Before: PaymentAccountOrWalletInfo Pattern
    Client->>API: Request Payment Instructions
    API->>Schema: Resolve PaymentAccountOrWalletInfo discriminator
    Schema->>Schema: Check accountType discriminator
    Schema->>Schema: Map to specific Payment* schema via allOf
    Schema-->>API: Return polymorphic account info
    API-->>Client: Payment instructions with account details
    
    Note over Client,Schema: After: Simplified Inheritance Pattern
    Client->>API: Request Payment Instructions
    API->>Schema: Access PaymentInstructions with isPlatformAccount
    Schema->>Schema: Resolve oneOf based on accountType
    Schema->>Schema: Direct reference to base *Info schema
    Schema-->>API: Return account info with const accountType
    API-->>Client: Payment instructions with isPlatformAccount flag
Loading

@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split branch from a26b5f1 to 8e458b0 Compare January 27, 2026 01:29
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema branch 3 times, most recently from e11522c to 1ccf581 Compare January 27, 2026 05:17
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split branch from 8e458b0 to 8f5820a Compare January 27, 2026 05:17
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.

2 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Jan 27, 2026

Additional Comments (2)

openapi/components/schemas/common/PaymentInstructions.yaml
Missing NGN_ACCOUNT (Nigerian account) from discriminator mapping. The old PaymentAccountOrWalletInfo schema included NGN_ACCOUNT, but it's absent here. Add:

      mapping:
        CLABE: ../common/PaymentClabeAccountInfo.yaml
        US_ACCOUNT: ../common/PaymentUsAccountInfo.yaml
        PIX: ../common/PaymentPixAccountInfo.yaml
        IBAN: ../common/PaymentIbanAccountInfo.yaml
        FBO: ../common/PaymentFboAccountInfo.yaml
        UPI: ../common/PaymentUpiAccountInfo.yaml
        NGN_ACCOUNT: ../common/PaymentNgnAccountInfo.yaml
        SPARK_WALLET: ../common/PaymentSparkWalletInfo.yaml
        LIGHTNING: ../common/PaymentLightningInvoiceInfo.yaml
        SOLANA_WALLET: ../common/PaymentSolanaWalletInfo.yaml
        TRON_WALLET: ../common/PaymentTronWalletInfo.yaml
        POLYGON_WALLET: ../common/PaymentPolygonWalletInfo.yaml
        BASE_WALLET: ../common/PaymentBaseWalletInfo.yaml
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/components/schemas/common/PaymentInstructions.yaml
Line: 41:55

Comment:
Missing `NGN_ACCOUNT` (Nigerian account) from discriminator mapping. The old `PaymentAccountOrWalletInfo` schema included NGN_ACCOUNT, but it's absent here. Add:

```suggestion
      mapping:
        CLABE: ../common/PaymentClabeAccountInfo.yaml
        US_ACCOUNT: ../common/PaymentUsAccountInfo.yaml
        PIX: ../common/PaymentPixAccountInfo.yaml
        IBAN: ../common/PaymentIbanAccountInfo.yaml
        FBO: ../common/PaymentFboAccountInfo.yaml
        UPI: ../common/PaymentUpiAccountInfo.yaml
        NGN_ACCOUNT: ../common/PaymentNgnAccountInfo.yaml
        SPARK_WALLET: ../common/PaymentSparkWalletInfo.yaml
        LIGHTNING: ../common/PaymentLightningInvoiceInfo.yaml
        SOLANA_WALLET: ../common/PaymentSolanaWalletInfo.yaml
        TRON_WALLET: ../common/PaymentTronWalletInfo.yaml
        POLYGON_WALLET: ../common/PaymentPolygonWalletInfo.yaml
        BASE_WALLET: ../common/PaymentBaseWalletInfo.yaml
```

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

openapi/components/schemas/common/PaymentInstructions.yaml
Missing Nigerian Account from oneOf list. Add after UPI Account:

  accountOrWalletInfo:
    oneOf:
      - title: CLABE Account
        $ref: ../common/PaymentClabeAccountInfo.yaml
      - title: US Bank Account
        $ref: ../common/PaymentUsAccountInfo.yaml
      - title: PIX Account
        $ref: ../common/PaymentPixAccountInfo.yaml
      - title: IBAN Account
        $ref: ../common/PaymentIbanAccountInfo.yaml
      - title: FBO Account
        $ref: ../common/PaymentFboAccountInfo.yaml
      - title: UPI Account
        $ref: ../common/PaymentUpiAccountInfo.yaml
      - title: NGN Account
        $ref: ../common/PaymentNgnAccountInfo.yaml
      - title: Spark Wallet
        $ref: ../common/PaymentSparkWalletInfo.yaml
      - title: Lightning Invoice
        $ref: ../common/PaymentLightningInvoiceInfo.yaml
      - title: Solana Wallet
        $ref: ../common/PaymentSolanaWalletInfo.yaml
      - title: Tron Wallet
        $ref: ../common/PaymentTronWalletInfo.yaml
      - title: Polygon Wallet
        $ref: ../common/PaymentPolygonWalletInfo.yaml
      - title: Base Wallet
        $ref: ../common/PaymentBaseWalletInfo.yaml
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/components/schemas/common/PaymentInstructions.yaml
Line: 15:40

Comment:
Missing Nigerian Account from oneOf list. Add after UPI Account:

```suggestion
  accountOrWalletInfo:
    oneOf:
      - title: CLABE Account
        $ref: ../common/PaymentClabeAccountInfo.yaml
      - title: US Bank Account
        $ref: ../common/PaymentUsAccountInfo.yaml
      - title: PIX Account
        $ref: ../common/PaymentPixAccountInfo.yaml
      - title: IBAN Account
        $ref: ../common/PaymentIbanAccountInfo.yaml
      - title: FBO Account
        $ref: ../common/PaymentFboAccountInfo.yaml
      - title: UPI Account
        $ref: ../common/PaymentUpiAccountInfo.yaml
      - title: NGN Account
        $ref: ../common/PaymentNgnAccountInfo.yaml
      - title: Spark Wallet
        $ref: ../common/PaymentSparkWalletInfo.yaml
      - title: Lightning Invoice
        $ref: ../common/PaymentLightningInvoiceInfo.yaml
      - title: Solana Wallet
        $ref: ../common/PaymentSolanaWalletInfo.yaml
      - title: Tron Wallet
        $ref: ../common/PaymentTronWalletInfo.yaml
      - title: Polygon Wallet
        $ref: ../common/PaymentPolygonWalletInfo.yaml
      - title: Base Wallet
        $ref: ../common/PaymentBaseWalletInfo.yaml
```

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

@pengying pengying changed the base branch from 01-24-feat_flatten_lightningexternalaccountinfo_schema to graphite-base/128 January 27, 2026 05:23
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split branch from 8f5820a to 941bc27 Compare January 27, 2026 05:23
@graphite-app graphite-app bot changed the base branch from graphite-base/128 to main January 27, 2026 05:23
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split branch 2 times, most recently from b9e7d56 to 13de662 Compare January 27, 2026 20:38
Comment on lines 8 to 10
accountType:
const: FBO
example: FBO
Copy link

Choose a reason for hiding this comment

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

why do we need this? wouldn't it serve the same purpose as the isPlatformAccount boolean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah good catch. I'll remove PaymentFboAccount info from paymentInstructions and remove this file

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.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Jan 27, 2026

Additional Comments (1)

openapi/components/schemas/common/PaymentInstructions.yaml
PaymentNgnAccountInfo is missing from the oneOf list and discriminator mapping. While PaymentNgnAccountInfo.yaml was updated to remove the PaymentAccountOrWalletInfo inheritance, it was not added to the PaymentInstructions schema's accountOrWalletInfo field.

Add the following to the oneOf list:

  accountOrWalletInfo:
    oneOf:
      - title: CLABE Account
        $ref: ../common/PaymentClabeAccountInfo.yaml
      - title: US Bank Account
        $ref: ../common/PaymentUsAccountInfo.yaml
      - title: PIX Account
        $ref: ../common/PaymentPixAccountInfo.yaml
      - title: IBAN Account
        $ref: ../common/PaymentIbanAccountInfo.yaml
      - title: FBO Account
        $ref: ../common/PaymentFboAccountInfo.yaml
      - title: UPI Account
        $ref: ../common/PaymentUpiAccountInfo.yaml
      - title: NGN Account
        $ref: ../common/PaymentNgnAccountInfo.yaml
      - title: Spark Wallet
        $ref: ../common/PaymentSparkWalletInfo.yaml
      - title: Lightning Invoice
        $ref: ../common/PaymentLightningInvoiceInfo.yaml
      - title: Solana Wallet
        $ref: ../common/PaymentSolanaWalletInfo.yaml
      - title: Tron Wallet
        $ref: ../common/PaymentTronWalletInfo.yaml
      - title: Polygon Wallet
        $ref: ../common/PaymentPolygonWalletInfo.yaml
      - title: Base Wallet
        $ref: ../common/PaymentBaseWalletInfo.yaml
    discriminator:
      propertyName: accountType
      mapping:
        CLABE: ../common/PaymentClabeAccountInfo.yaml
        US_ACCOUNT: ../common/PaymentUsAccountInfo.yaml
        PIX: ../common/PaymentPixAccountInfo.yaml
        IBAN: ../common/PaymentIbanAccountInfo.yaml
        FBO: ../common/PaymentFboAccountInfo.yaml
        UPI: ../common/PaymentUpiAccountInfo.yaml
        NGN_ACCOUNT: ../common/PaymentNgnAccountInfo.yaml
        SPARK_WALLET: ../common/PaymentSparkWalletInfo.yaml
        LIGHTNING: ../common/PaymentLightningInvoiceInfo.yaml
        SOLANA_WALLET: ../common/PaymentSolanaWalletInfo.yaml
        TRON_WALLET: ../common/PaymentTronWalletInfo.yaml
        POLYGON_WALLET: ../common/PaymentPolygonWalletInfo.yaml
        BASE_WALLET: ../common/PaymentBaseWalletInfo.yaml
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/components/schemas/common/PaymentInstructions.yaml
Line: 15:55

Comment:
`PaymentNgnAccountInfo` is missing from the `oneOf` list and discriminator mapping. While `PaymentNgnAccountInfo.yaml` was updated to remove the `PaymentAccountOrWalletInfo` inheritance, it was not added to the `PaymentInstructions` schema's `accountOrWalletInfo` field.

Add the following to the `oneOf` list:
```suggestion
  accountOrWalletInfo:
    oneOf:
      - title: CLABE Account
        $ref: ../common/PaymentClabeAccountInfo.yaml
      - title: US Bank Account
        $ref: ../common/PaymentUsAccountInfo.yaml
      - title: PIX Account
        $ref: ../common/PaymentPixAccountInfo.yaml
      - title: IBAN Account
        $ref: ../common/PaymentIbanAccountInfo.yaml
      - title: FBO Account
        $ref: ../common/PaymentFboAccountInfo.yaml
      - title: UPI Account
        $ref: ../common/PaymentUpiAccountInfo.yaml
      - title: NGN Account
        $ref: ../common/PaymentNgnAccountInfo.yaml
      - title: Spark Wallet
        $ref: ../common/PaymentSparkWalletInfo.yaml
      - title: Lightning Invoice
        $ref: ../common/PaymentLightningInvoiceInfo.yaml
      - title: Solana Wallet
        $ref: ../common/PaymentSolanaWalletInfo.yaml
      - title: Tron Wallet
        $ref: ../common/PaymentTronWalletInfo.yaml
      - title: Polygon Wallet
        $ref: ../common/PaymentPolygonWalletInfo.yaml
      - title: Base Wallet
        $ref: ../common/PaymentBaseWalletInfo.yaml
    discriminator:
      propertyName: accountType
      mapping:
        CLABE: ../common/PaymentClabeAccountInfo.yaml
        US_ACCOUNT: ../common/PaymentUsAccountInfo.yaml
        PIX: ../common/PaymentPixAccountInfo.yaml
        IBAN: ../common/PaymentIbanAccountInfo.yaml
        FBO: ../common/PaymentFboAccountInfo.yaml
        UPI: ../common/PaymentUpiAccountInfo.yaml
        NGN_ACCOUNT: ../common/PaymentNgnAccountInfo.yaml
        SPARK_WALLET: ../common/PaymentSparkWalletInfo.yaml
        LIGHTNING: ../common/PaymentLightningInvoiceInfo.yaml
        SOLANA_WALLET: ../common/PaymentSolanaWalletInfo.yaml
        TRON_WALLET: ../common/PaymentTronWalletInfo.yaml
        POLYGON_WALLET: ../common/PaymentPolygonWalletInfo.yaml
        BASE_WALLET: ../common/PaymentBaseWalletInfo.yaml
```

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

@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split branch from 13de662 to 98da0bf Compare January 27, 2026 21:19
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.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@pengying pengying merged commit f05d11f into main Jan 27, 2026
7 checks passed
@pengying pengying deleted the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split branch January 27, 2026 22:31
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.

3 participants