-
Notifications
You must be signed in to change notification settings - Fork 3
fix: adding type:string to const discriminators #139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: adding type:string to const discriminators #139
Conversation
Greptile OverviewGreptile SummaryThis PR fixes an OpenAPI generator issue by adding explicit Key Changes:
Context: Impact: Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| openapi/components/schemas/common/UsAccountInfo.yaml | added explicit type: string to accountType const field for OpenAPI generator compatibility |
| openapi/components/schemas/common/PixAccountInfo.yaml | added explicit type: string to accountType const field for OpenAPI generator compatibility |
| openapi/components/schemas/external_accounts/UsAccountExternalAccountInfo.yaml | added explicit type: string to accountType const field for OpenAPI generator compatibility |
| openapi/components/schemas/external_accounts/LightningExternalAccountInfo.yaml | added explicit type: string to accountType const field for OpenAPI generator compatibility |
| openapi.yaml | bundled schema with type: string added to all accountType const discriminators |
| mintlify/openapi.yaml | bundled schema copy with type: string added to all accountType const discriminators |
Sequence Diagram
sequenceDiagram
participant Client as API Client
participant Generator as OpenAPI Generator
participant Schema as OpenAPI Schema
participant Validator as Field Validator
Note over Client,Validator: Schema Generation Process
Client->>Generator: Request to generate SDK code
Generator->>Schema: Parse schema with discriminator
alt Before Fix (without type: string)
Schema-->>Generator: accountType: { const: "US_ACCOUNT" }
Generator->>Validator: Check if validator needed
Validator-->>Generator: ❌ No type specified, skip validator
Generator-->>Client: Generated code missing field validator
end
alt After Fix (with type: string)
Schema-->>Generator: accountType: { type: string, const: "US_ACCOUNT" }
Generator->>Validator: Check if validator needed
Validator-->>Generator: ✓ Type specified, create validator
Generator-->>Client: Generated code with proper field validator
end
Note over Client,Validator: Runtime Validation
Client->>Validator: Validate accountType discriminator field
Validator->>Validator: Check type is string
Validator->>Validator: Check value matches const
Validator-->>Client: ✓ Valid account type

TL;DR
Added explicit
type: stringproperty to allaccountTypefields in the OpenAPI schema. This fixes an issue where openapi generator didn't create the field validator for the discriminator.What changed?
Added the
type: stringproperty to allaccountTypefields across various account information schemas in the OpenAPI specification. This change affects multiple account types including:The change ensures that all
accountTypefields are properly typed as strings in the schema.