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 reverts the const keyword changes introduced in PR #126 back to single-value enum arrays for better compatibility with OpenAPI code generators. The change affects 43 files across the OpenAPI schema definitions.

Changes made:

  • Replaced all const: VALUE with enum: [VALUE] (single-value enum arrays)
  • Updated HTTP status codes in error response schemas (400, 401, 403, 404, 409, 412, 424, 500, 501)
  • Updated discriminator fields (accountType, customerType, beneficiaryType) across common schemas and external account schemas
  • Updated asset type fields in payment wallet schemas (USDC, USDT, LIGHTNING)
  • Updated webhook event type in InvitationClaimedWebhook
  • Rebuilt bundled openapi.yaml and mintlify/openapi.yaml files

Context:
This PR completes a three-step evolution:

  1. PR feat: convert single-value enums to const for base types #126: Changed enum: [VALUE] to const: VALUE for clarity
  2. PR fix: adding type:string to const discriminators #139: Added type: string to fix discriminator validation issues with OpenAPI generators
  3. PR fix: reverting back to using enums instead of const for openapi generator #140 (this PR): Reverted back to enum: [VALUE] format for full generator compatibility

The changes are mechanically consistent across all 43 files, using inline array notation for single values and maintaining proper YAML formatting. All discriminator mappings remain intact and functional.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The changes are purely syntactic, mechanically consistent across all 43 files, and revert to a previously working pattern. The transformation from const: VALUE to enum: [VALUE] is semantically equivalent in OpenAPI 3.x and improves tooling compatibility. No logic changes, no breaking changes to API behavior, and the bundled files were properly regenerated.
  • No files require special attention

Important Files Changed

Filename Overview
openapi/components/schemas/errors/Error401.yaml Replaced const: 401 with enum: [401] for status code
openapi/components/schemas/common/BaseWalletInfo.yaml Replaced const: BASE_WALLET with enum: [BASE_WALLET] for accountType discriminator
openapi/components/schemas/webhooks/InvitationClaimedWebhook.yaml Replaced const: INVITATION_CLAIMED with enum: [INVITATION_CLAIMED] for webhook event type
openapi.yaml Built/bundled OpenAPI spec with all const to enum changes applied
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 Generator as OpenAPI Generator
    participant Output as Generated Code

    Note over Dev,Output: Previous State (PR #126)
    Dev->>Schema: Changed enum: [VALUE] to const: VALUE
    Schema->>Build: npm run build:openapi
    Build->>Generator: Bundles and validates schema
    Generator->>Output: ❌ Missing field validators for discriminators

    Note over Dev,Output: Fix Attempt (PR #139)
    Dev->>Schema: Added type: string to const fields
    Schema->>Generator: Validates with type + const
    Generator->>Output: ⚠️ Still incompatible with some generators

    Note over Dev,Output: Current PR #140 (Revert)
    Dev->>Schema: Changed const: VALUE back to enum: [VALUE]
    Schema->>Build: npm run build:openapi
    Build->>Output: Bundles openapi.yaml + mintlify/openapi.yaml
    Generator->>Output: ✅ Generates correct validators and discriminators
Loading

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