feat: add Quote/Transaction discriminators and remove inline examples#129
Open
feat: add Quote/Transaction discriminators and remove inline examples#129
Conversation
Contributor
Author
This was referenced Jan 24, 2026
Merged
Contributor
Greptile OverviewGreptile SummaryThis PR refactors the OpenAPI schema to implement proper discriminator patterns for polymorphic types across quotes and transactions. Key Changes:
Impact:
Note on Lint Ignores: Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| openapi/components/schemas/common/AccountSource.yaml | New reusable schema for account funding source with ACCOUNT discriminator - clean extraction |
| openapi/components/schemas/common/AccountDestination.yaml | New reusable schema for account destination with ACCOUNT discriminator - clean extraction |
| openapi/components/schemas/quotes/QuoteSource.yaml | Refactored to use discriminator pattern with proper $refs instead of inline schemas |
| openapi/components/schemas/quotes/Quote.yaml | Added discriminator for destination oneOf - references extracted schemas |
| openapi/components/schemas/transactions/Transaction.yaml | Added discriminator for destination oneOf - references extracted schemas |
| .redocly.lint-ignore.yaml | Added lint ignores for required at oneOf level per OpenAPI spec recommendation |
Sequence Diagram
sequenceDiagram
participant Client
participant API as Grid API
participant Validator as Schema Validator
participant CodeGen as Code Generator
Note over Client,CodeGen: Quote Creation with Discriminated Source Types
Client->>API: POST /quotes<br/>{source: {sourceType: "ACCOUNT", accountId: "..."},<br/>destination: {...}}
API->>Validator: Validate request against QuoteRequest schema
Validator->>Validator: Check source.sourceType discriminator
alt sourceType == "ACCOUNT"
Validator->>Validator: Validate against AccountSource.yaml
else sourceType == "REALTIME_FUNDING"
Validator->>Validator: Validate against QuoteRealtimeFundingSource.yaml
end
Validator->>API: Valid ✓
API->>Client: 201 Quote Created
Note over Client,CodeGen: Transaction Response with Discriminated Types
Client->>API: GET /transactions/{id}
API->>Client: 200 Transaction Response<br/>{type: "OUTGOING",<br/>source: {sourceType: "ACCOUNT", ...},<br/>destination: {destinationType: "UMA_ADDRESS", ...}}
Client->>CodeGen: Deserialize response
CodeGen->>CodeGen: Read type discriminator = "OUTGOING"
CodeGen->>CodeGen: Map to OutgoingTransaction class
CodeGen->>CodeGen: Read source.sourceType = "ACCOUNT"
CodeGen->>CodeGen: Map to AccountSource class
CodeGen->>CodeGen: Read destination.destinationType = "UMA_ADDRESS"
CodeGen->>CodeGen: Map to UmaAddressDestination class
CodeGen->>Client: Strongly-typed Transaction object
a26b5f1 to
8e458b0
Compare
e7d2ae0 to
2793eb3
Compare
8e458b0 to
8f5820a
Compare
2793eb3 to
a6d5ea6
Compare
941bc27 to
b9e7d56
Compare
a6d5ea6 to
ba5b137
Compare
b9e7d56 to
13de662
Compare
ba5b137 to
8e152e4
Compare
gcamata
reviewed
Jan 27, 2026
openapi/components/schemas/quotes/QuoteRequestAccountDestination.yaml
Outdated
Show resolved
Hide resolved
openapi/components/schemas/quotes/QuoteUmaAddressDestination.yaml
Outdated
Show resolved
Hide resolved
gcamata
reviewed
Jan 27, 2026
13de662 to
98da0bf
Compare
8e152e4 to
4db1ea5
Compare
98da0bf to
f05d11f
Compare
4db1ea5 to
152d09c
Compare
152d09c to
5adb57b
Compare
c88c884 to
7fc9ade
Compare
7fc9ade to
36f295c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

TL;DR
Refactored OpenAPI schema to use proper discriminators for polymorphic types in transaction and quote models.
What changed?
sourceTypeanddestinationType) to polymorphic types in the API schema/quotesendpoint request body