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 Edit this comment to update them. They will appear in their respective SDK's changelogs. ✅ grid-python studio · code · diff
✅ grid-typescript studio · code · diff
✅ grid-kotlin studio · code · diff
This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push. |
Greptile SummaryThis PR refactors the transaction schema to implement proper polymorphic type handling using the OpenAPI Key changes:
Impact: Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| .stainless/stainless.yml | Added removal rule for type property in Transaction base schema to prevent conflicts during SDK generation |
| openapi/components/schemas/transactions/IncomingTransaction.yaml | Added required type field with INCOMING enum value for proper polymorphic discrimination |
| openapi/components/schemas/transactions/OutgoingTransaction.yaml | Added required type field with OUTGOING enum, removed paymentInstructions from required fields |
| openapi/components/schemas/transactions/TransactionOneOf.yaml | New schema implementing proper oneOf polymorphic pattern with discriminator for transaction types |
| openapi/components/schemas/transactions/TransactionStatus.yaml | Enhanced documentation with descriptive table for each transaction status value |
Class Diagram
%%{init: {'theme': 'neutral'}}%%
classDiagram
class Transaction {
+string id
+TransactionStatus status
+string type
+TransactionDestination destination
+string customerId
+string platformCustomerId
+datetime settledAt
+datetime createdAt
+datetime updatedAt
+string description
+CounterpartyInformation counterpartyInformation
}
class TransactionOneOf {
<<oneOf>>
discriminator: type
}
class IncomingTransaction {
+string type = "INCOMING"
+TransactionSource source
+CurrencyAmount receivedAmount
+ReconciliationInstructions reconciliationInstructions
+IncomingRateDetails rateDetails
+IncomingTransactionFailureReason failureReason
}
class OutgoingTransaction {
+string type = "OUTGOING"
+TransactionSource source
+CurrencyAmount sentAmount
+CurrencyAmount receivedAmount
+number exchangeRate
+integer fees
+string quoteId
+PaymentInstructions[] paymentInstructions
+Refund refund
+OutgoingRateDetails rateDetails
+OutgoingTransactionFailureReason failureReason
}
Transaction <|-- IncomingTransaction : extends via allOf
Transaction <|-- OutgoingTransaction : extends via allOf
TransactionOneOf o-- IncomingTransaction : discriminates
TransactionOneOf o-- OutgoingTransaction : discriminates
note for TransactionOneOf "API endpoints now reference TransactionOneOf instead of Transaction for proper polymorphic type handling"
note for IncomingTransaction "Type field added with INCOMING enum for discrimination"
note for OutgoingTransaction "Type field added with OUTGOING enum for discrimination"
Last reviewed commit: 36ee105
2e13aea to
36ee105
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.