-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add Customer API discriminators and consolidate customer changes #130
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
base: 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split
Are you sure you want to change the base?
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Greptile OverviewGreptile SummaryRefactored customer API schemas by extracting inline definitions into reusable components ( Key Changes
Issues Found
Confidence Score: 2/5
|
| Filename | Overview |
|---|---|
| openapi/components/schemas/customers/CreateCustomerRequest.yaml | New schema component created, but missing required platformCustomerId field and kycUrl field from original CREATE endpoint |
| openapi/components/schemas/customers/IndividualCustomerUpdate.yaml | Changed enum to const for customerType, added platformCustomerId field but not marked as required |
| openapi/paths/customers/customers.yaml | Simplified to use CreateCustomerRequest schema, but removed inline examples and lost kycUrl field and platformCustomerId requirement |
| openapi/components/schemas/customers/BusinessCustomerUpdate.yaml | Missing platformCustomerId field that was required in the previous CREATE endpoint |
Sequence Diagram
sequenceDiagram
participant Client
participant API as Grid API
participant Schema as CreateCustomerRequest Schema
participant Individual as IndividualCustomerUpdate
participant Business as BusinessCustomerUpdate
Note over Client,Business: Create Customer Flow (POST /customers)
Client->>API: POST /customers with customerType
API->>Schema: Validate request body
alt customerType = INDIVIDUAL
Schema->>Individual: Validate against IndividualCustomerUpdate
Individual-->>Schema: Validation result
Note over Individual: customerType: const INDIVIDUAL<br/>platformCustomerId: optional<br/>fullName, birthDate, etc.
else customerType = BUSINESS
Schema->>Business: Validate against BusinessCustomerUpdate
Business-->>Schema: Validation result
Note over Business: customerType: const BUSINESS<br/>businessInfo, address, etc.<br/>Missing: platformCustomerId
end
Schema-->>API: Schema validation complete
API-->>Client: 201 Created with Customer object
Note over Client,Business: Update Customer Flow (PATCH /customers/{customerId})
Client->>API: PATCH /customers/{id} with customerType
API->>Schema: Validate against UpdateCustomerRequest
alt customerType = INDIVIDUAL
Schema->>Individual: Same schema as CREATE
Individual-->>Schema: Validation result
else customerType = BUSINESS
Schema->>Business: Same schema as CREATE
Business-->>Schema: Validation result
end
Schema-->>API: Schema validation complete
API-->>Client: 200 OK with updated Customer
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.
4 files reviewed, 4 comments
Additional Comments (1)
Prompt To Fix With AIThis is a comment left during a code review.
Path: openapi/components/schemas/customers/BusinessCustomerUpdate.yaml
Line: 1:33
Comment:
Missing `platformCustomerId` field. The previous CREATE endpoint required this for business customers via `allOf`. Either add it to this schema (like `IndividualCustomerUpdate.yaml`) or handle it differently in `CreateCustomerRequest.yaml`.
How can I resolve this? If you propose a fix, please make it concise. |

TL;DR
Refactored OpenAPI schema definitions for customer-related endpoints to improve maintainability and consistency.
What changed?
CreateCustomerRequestandUpdateCustomerRequestenum: [INDIVIDUAL]toconst: INDIVIDUALin the IndividualCustomerUpdate schema for better semanticsplatformCustomerIddirectly to the IndividualCustomerUpdate schema