-
Notifications
You must be signed in to change notification settings - Fork 3
feat: convert single-value enums to const for base types #126
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
feat: convert single-value enums to const for base types #126
Conversation
Greptile OverviewGreptile SummaryThis PR converts single-value enums to Enum to const conversions - The majority of changes (38 files) replace single-value LightningExternalAccountInfo flattening - The schema was restructured from an Confidence Score: 2/5
|
| Filename | Overview |
|---|---|
| openapi/components/schemas/external_accounts/LightningExternalAccountInfo.yaml | Flattened schema from allOf/oneOf structure to simple object, removing mutual exclusion validation for payment destination fields |
| openapi/components/schemas/errors/Error400.yaml | Converted single-value status enum to const (400) |
| openapi/components/schemas/errors/Error412.yaml | Converted single-value status and code enums to const (412, UNSUPPORTED_UMA_VERSION) |
| openapi/components/schemas/common/BaseWalletInfo.yaml | Converted single-value accountType enum to const (BASE_WALLET) |
| openapi.yaml | Built OpenAPI spec with all enum to const conversions and LightningExternalAccountInfo flattening |
Sequence Diagram
sequenceDiagram
participant Client
participant API
participant Validator
participant Schema
Note over Client,Schema: Enum to Const Conversion Flow (38 files)
Client->>API: POST request with accountType
API->>Validator: Validate request body
Validator->>Schema: Check accountType value
alt Before: enum with single value
Schema-->>Validator: Must be one of [LIGHTNING]
else After: const value
Schema-->>Validator: Must equal LIGHTNING
end
Validator-->>API: ✓ Same validation result
API-->>Client: Response
Note over Client,Schema: LightningExternalAccountInfo Flow
Client->>API: POST /external-accounts (Lightning)
API->>Validator: Validate Lightning account
Validator->>Schema: Check payment destination
alt Before: oneOf constraint
Schema-->>Validator: Require exactly one of: invoice, bolt12, lightningAddress
alt Invalid: zero fields
Validator-->>API: ✗ Validation error
end
alt Invalid: multiple fields
Validator-->>API: ✗ Validation error
end
alt Valid: exactly one field
Validator-->>API: ✓ Valid
end
else After: flattened optional fields
Schema-->>Validator: All fields optional (no mutual exclusion)
alt Zero fields set
Validator-->>API: ✓ Passes schema validation
Note right of API: Runtime error likely
end
alt Multiple fields set
Validator-->>API: ✓ Passes schema validation
Note right of API: Undefined behavior
end
end
API-->>Client: Response or error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 1 comment
openapi/components/schemas/external_accounts/LightningExternalAccountInfo.yaml
Show resolved
Hide resolved
openapi/components/schemas/external_accounts/LightningExternalAccountInfo.yaml
Show resolved
Hide resolved
836aded to
b4541c7
Compare

Convert single-value enums to const for base types
This PR replaces single-value enums with
constproperties throughout the OpenAPI schema. This change improves schema clarity and validation behavior.Additionally, the PR flattens the
LightningExternalAccountInfoschema structure, converting it from a complex nested structure withallOfandoneOfcombinations to a simpler flat object with optional properties.