Skip to content

Conversation

@pengying
Copy link
Contributor

@pengying pengying commented Jan 28, 2026

TL;DR

Replace const with enum arrays in OpenAPI schema definitions for better compatibility with OpenAPI tooling.

What changed?

This PR replaces all instances of the const keyword with enum arrays containing a single value throughout the OpenAPI schema definitions. For example:

- const: 401
+ type: integer
+ enum:
+   - 401

The change affects various schema components including:

  • HTTP status codes in error responses
  • Account type identifiers
  • Customer types
  • Asset types
  • Webhook event types

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 28, 2026 19:25
@greptile-apps
Copy link

greptile-apps bot commented Jan 28, 2026

Greptile Overview

Greptile Summary

This PR systematically replaces const with single-value enum arrays throughout the OpenAPI schema definitions to improve compatibility with OpenAPI code generators and tooling.

Changes Made

  • HTTP status codes: Error schemas now use enum: [401] instead of const: 401
  • Discriminator fields: All polymorphic schemas (customers, beneficiaries, accounts) now explicitly define discriminator properties with enum values
  • Account types: Created centralized enum type definitions (PaymentAccountType.yaml and ExternalAccountType.yaml)
  • Webhook types: Updated webhook event type definitions to use enum arrays
  • Built files: Both openapi.yaml and mintlify/openapi.yaml correctly reflect all changes

Benefits

  • Resolves compatibility issues with OpenAPI generators that don't properly support the const keyword
  • Maintains identical semantic meaning (single-value enums are functionally equivalent to const)
  • Improves code generation reliability across different OpenAPI tooling
  • Adds explicit discriminator fields that were previously implicit, improving clarity

Consistency

All 100 changed files follow the same transformation pattern consistently. The bundled OpenAPI specs have been properly regenerated with no const keywords remaining.

Confidence Score: 5/5

  • This PR is safe to merge with no risk - it's a mechanical refactoring that improves tooling compatibility
  • The changes are purely syntactic transformations that maintain identical semantic meaning. Single-value enums are functionally equivalent to const in OpenAPI. The transformation was applied consistently across 100 files following a clear pattern. No logic changes, no API behavior changes, and the built schemas correctly reflect the updates.
  • No files require special attention - all changes follow the same safe, mechanical pattern

Important Files Changed

Filename Overview
openapi/components/schemas/errors/Error401.yaml Changed HTTP status code from const: 401 to enum: [401] for OpenAPI tooling compatibility
openapi/components/schemas/customers/BusinessCustomer.yaml Added explicit customerType discriminator field with enum: [BUSINESS] for proper oneOf discrimination
openapi/components/schemas/customers/IndividualCustomer.yaml Added explicit customerType discriminator field with enum: [INDIVIDUAL] for proper oneOf discrimination
openapi/components/schemas/external_accounts/ExternalAccountType.yaml New enum type definition consolidating all external account types in one location
openapi/components/schemas/common/PaymentAccountType.yaml New enum type definition consolidating all payment account types in one location
openapi.yaml Bundled OpenAPI spec reflecting all const-to-enum changes across all schemas
mintlify/openapi.yaml Copy of bundled OpenAPI spec for Mintlify documentation with all const-to-enum changes

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant Schema as OpenAPI Schema Files
    participant Build as Build Process
    participant Tools as OpenAPI Generators/Tools
    
    Note over Dev,Tools: Before: Using const keyword
    Dev->>Schema: Define schema with const: "VALUE"
    Schema->>Build: Bundle schemas
    Build->>Tools: Generate code/docs
    Tools-->>Dev: ❌ Compatibility issues
    
    Note over Dev,Tools: After: Using enum arrays
    Dev->>Schema: Define schema with enum: ["VALUE"]
    Schema->>Build: Bundle schemas (npm run build:openapi)
    Build->>Tools: Generate code/docs
    Tools-->>Dev: ✅ Works correctly
Loading

@pengying pengying force-pushed the 01-28-fix_reverting_back_to_using_enums_instead_of_const_for_openapi_generator branch 5 times, most recently from 6f3dca0 to d1f51d7 Compare January 29, 2026 21:59
@pengying pengying force-pushed the 01-28-fix_reverting_back_to_using_enums_instead_of_const_for_openapi_generator branch from d1f51d7 to 3a34b56 Compare January 30, 2026 00:01
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.

2 participants