Skip to content

Conversation

@pengying
Copy link
Contributor

@pengying pengying commented Jan 27, 2026

TL;DR

Added explicit type: string property to all accountType fields 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: string property to all accountType fields across various account information schemas in the OpenAPI specification. This change affects multiple account types including:

  • US_ACCOUNT
  • PIX
  • IBAN
  • UPI
  • NGN_ACCOUNT
  • SPARK_WALLET
  • SOLANA_WALLET
  • TRON_WALLET
  • POLYGON_WALLET
  • CLABE
  • BASE_WALLET
  • LIGHTNING
  • FBO

The change ensures that all accountType fields are properly typed as strings in the schema.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@pengying pengying marked this pull request as ready for review January 27, 2026 19:53
@greptile-apps
Copy link

greptile-apps bot commented Jan 27, 2026

Greptile Overview

Greptile Summary

This PR fixes an OpenAPI generator issue by adding explicit type: string declarations to all accountType const discriminator fields across 26 schema files.

Key Changes:

  • Added type: string property above all const declarations for accountType fields
  • Affected schemas include all account types (US_ACCOUNT, PIX, IBAN, UPI, NGN_ACCOUNT, etc.) and wallet types (SPARK_WALLET, SOLANA_WALLET, TRON_WALLET, POLYGON_WALLET, BASE_WALLET, LIGHTNING, CLABE, FBO)
  • Changes applied consistently to both common/ schemas and external_accounts/ schemas
  • Built files (openapi.yaml and mintlify/openapi.yaml) properly reflect source changes

Context:
This resolves a regression from PR #126, which converted single-value enums to const but removed the type: string property. Without the explicit type, OpenAPI generators don't create field validators for discriminator properties, which can cause validation issues in generated SDKs.

Impact:
Generated SDKs will now properly validate the accountType discriminator field, ensuring type safety when deserializing polymorphic account and wallet schemas.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The changes are minimal, mechanical, and highly consistent across all 26 files. Each change adds a single type: string line above existing const declarations for discriminator fields. The pattern is identical everywhere, the built schemas reflect the source changes correctly, and this fixes a real OpenAPI generator issue without altering any business logic or introducing breaking changes.
  • No files require special attention

Important Files Changed

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
Loading

Copy link
Contributor Author

pengying commented Jan 27, 2026

Merge activity

  • Jan 27, 8:30 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jan 27, 8:30 PM UTC: @pengying merged this pull request with Graphite.

@pengying pengying merged commit fe683e6 into main Jan 27, 2026
7 checks passed
@pengying pengying deleted the 01-27-fix_adding_type_string_to_const_discriminators branch January 27, 2026 20:30
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