Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
✱ Stainless preview buildsThis PR will update the kotlin openapi python typescript ✅ grid-python studio · code
✅ grid-kotlin studio · code
✅ grid-typescript studio · code
This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push. |
Greptile SummaryThis PR fixes transaction schema inheritance by implementing proper polymorphic type handling using the Key Changes:
Impact: Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| openapi/components/schemas/transactions/TransactionOneOf.yaml | New schema using oneOf discriminator for proper polymorphic transaction handling |
| openapi/components/schemas/transactions/IncomingTransaction.yaml | Added required type field with INCOMING enum for proper discriminated union |
| openapi/components/schemas/transactions/OutgoingTransaction.yaml | Added type field with OUTGOING enum, removed paymentInstructions from required (flagged in previous review) |
| .stainless/stainless.yml | Added transformation to remove type from base Transaction schema to prevent allOf conflicts |
| openapi/paths/transactions/transactions.yaml | Updated list endpoint to return TransactionOneOf instead of Transaction schema |
| openapi/components/schemas/transactions/RealtimeFundingTransactionSource.yaml | New transaction source schema for real-time funding (RTP, SEPA Instant, etc.) |
| openapi/components/schemas/transactions/ExternalAccountDetailsTransactionDestination.yaml | New destination schema for inline external account details at quote creation |
Class Diagram
%%{init: {'theme': 'neutral'}}%%
classDiagram
class Transaction {
+string id
+TransactionStatus status
+TransactionType type
+TransactionDestinationOneOf destination
+string customerId
+string platformCustomerId
+datetime settledAt
+datetime createdAt
+datetime updatedAt
+string description
+CounterpartyInformation counterpartyInformation
}
class TransactionOneOf {
<<oneOf>>
discriminator: type
}
class IncomingTransaction {
+type: "INCOMING"
+CurrencyAmount receivedAmount
+TransactionSourceOneOf source
+ReconciliationInstructions reconciliationInstructions
+IncomingRateDetails rateDetails
+IncomingTransactionFailureReason failureReason
}
class OutgoingTransaction {
+type: "OUTGOING"
+CurrencyAmount sentAmount
+CurrencyAmount receivedAmount
+TransactionSourceOneOf source
+number exchangeRate
+integer fees
+string quoteId
+PaymentInstructions[] paymentInstructions
+Refund refund
+OutgoingRateDetails rateDetails
+OutgoingTransactionFailureReason failureReason
}
class TransactionSourceOneOf {
<<oneOf>>
discriminator: sourceType
}
class AccountTransactionSource {
+sourceType: "ACCOUNT"
}
class UmaAddressTransactionSource {
+sourceType: "UMA_ADDRESS"
}
class RealtimeFundingTransactionSource {
+sourceType: "REALTIME_FUNDING"
+string currency
+string customerId
}
TransactionOneOf <|-- IncomingTransaction
TransactionOneOf <|-- OutgoingTransaction
IncomingTransaction --|> Transaction
OutgoingTransaction --|> Transaction
IncomingTransaction --> TransactionSourceOneOf
OutgoingTransaction --> TransactionSourceOneOf
TransactionSourceOneOf <|-- AccountTransactionSource
TransactionSourceOneOf <|-- UmaAddressTransactionSource
TransactionSourceOneOf <|-- RealtimeFundingTransactionSource
Last reviewed commit: 33406c9
2e13aea to
36ee105
Compare
36ee105 to
c774ff0
Compare
| - $ref: ./Transaction.yaml | ||
| - type: object | ||
| required: | ||
| - type |
There was a problem hiding this comment.
Check that removing paymentInstructions from required fields is intentional and won't break existing clients
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/components/schemas/transactions/OutgoingTransaction.yaml
Line: 5
Comment:
Check that removing `paymentInstructions` from required fields is intentional and won't break existing clients
How can I resolve this? If you propose a fix, please make it concise.c774ff0 to
eb98c72
Compare
.stainless/stainless.yml
Outdated
| @@ -429,6 +430,20 @@ openapi: | |||
| # - "$.components.schemas.BusinessBeneficiary.allOf[1].properties" | |||
| # keys: [ "beneficiaryType" ] | |||
| # ── customerType: remove from base schemas ── | |||
| ======= | |||
| # ── type: transaction base schema ── | |||
| - command: remove | |||
| reason: >- | |||
| Remove inline type enum from Transaction base schema to avoid | |||
| conflicting types when allOf merges with IncomingTransaction and | |||
| OutgoingTransaction which define type as single-value enums | |||
| args: | |||
| target: | |||
| - "$.components.schemas.Transaction.properties" | |||
| keys: [ "type" ] | |||
|
|
|||
| # ── beneficiaryType: beneficiary schemas ── | |||
| >>>>>>> c774ff0 (feat: fixing transaction schema) | |||
There was a problem hiding this comment.
Unresolved merge conflict will break the build
| # ── type: transaction base schema ── | |
| - command: remove | |
| reason: >- | |
| Remove inline type enum from Transaction base schema to avoid | |
| conflicting types when allOf merges with IncomingTransaction and | |
| OutgoingTransaction which define type as single-value enums | |
| args: | |
| target: | |
| - "$.components.schemas.Transaction.properties" | |
| keys: [ "type" ] | |
| # ── beneficiaryType: beneficiary schemas ── |
Prompt To Fix With AI
This is a comment left during a code review.
Path: .stainless/stainless.yml
Line: 420-446
Comment:
Unresolved merge conflict will break the build
```suggestion
# ── type: transaction base schema ──
- command: remove
reason: >-
Remove inline type enum from Transaction base schema to avoid
conflicting types when allOf merges with IncomingTransaction and
OutgoingTransaction which define type as single-value enums
args:
target:
- "$.components.schemas.Transaction.properties"
keys: [ "type" ]
# ── beneficiaryType: beneficiary schemas ──
```
How can I resolve this? If you propose a fix, please make it concise.eb98c72 to
8ad3ce8
Compare
8ad3ce8 to
33406c9
Compare

TL;DR
Fixed transaction schema inheritance by implementing proper polymorphic type handling for transactions.
What changed?
typeproperty from the baseTransactionschema to avoid conflicts when merging with child schemastypeproperty with specific enum values to bothIncomingTransactionandOutgoingTransactionschemasTransactionOneOfschema that uses proper polymorphic discrimination between transaction typesTransactionOneOfinstead of the baseTransactionschemaHow to test?
Why make this change?
The previous schema structure had conflicting type definitions when the base
Transactionschema was merged with specific transaction type schemas throughallOf. This change implements proper polymorphic inheritance using theoneOfdiscriminator pattern, ensuring that transaction types are correctly differentiated and validated. This prevents potential issues with schema validation and improves API documentation clarity.