-
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 SummaryThis PR consolidates customer-related OpenAPI schemas by extracting inline definitions into reusable components ( Key Changes
Critical IssueThe previous CREATE endpoint used Additional Concerns
Confidence Score: 2/5
|
| Filename | Overview |
|---|---|
| openapi/components/schemas/customers/CreateCustomerRequest.yaml | New schema that's identical to UpdateCustomerRequest but doesn't enforce platformCustomerId as required (breaking change from previous inline schema) |
| openapi/components/schemas/customers/IndividualCustomerUpdate.yaml | Changed enum: [INDIVIDUAL] to const: INDIVIDUAL and added platformCustomerId field (now available in both create and update) |
| openapi/components/schemas/customers/Customer.yaml | Removed platformCustomerId and umaAddress from required fields, moved kycStatus to specific customer type schemas |
| openapi/paths/customers/customers.yaml | Replaced inline schema with CreateCustomerRequest ref, removed all examples and kycUrl field from previous schema |
| openapi.yaml | Bundled OpenAPI spec reflecting all customer schema changes (breaking change: platformCustomerId no longer required for creation) |
| mintlify/openapi.yaml | Copy of bundled OpenAPI spec for Mintlify docs (identical changes to openapi.yaml) |
Sequence Diagram
sequenceDiagram
participant Client
participant API as Grid API
participant DB as Database
Note over Client,DB: Create Customer Flow
Client->>API: POST /customers<br/>(CreateCustomerRequest)
Note over API: Validates customerType discriminator<br/>(INDIVIDUAL or BUSINESS)
API->>API: Route to IndividualCustomerUpdate<br/>or BusinessCustomerUpdate schema
API->>DB: Create customer record
DB-->>API: Customer created
API-->>Client: 201 Created<br/>(Customer response with kycStatus/kybStatus)
Note over Client,DB: Update Customer Flow
Client->>API: PATCH /customers/{customerId}<br/>(UpdateCustomerRequest)
Note over API: Validates customerType discriminator<br/>(INDIVIDUAL or BUSINESS)
API->>API: Route to IndividualCustomerUpdate<br/>or BusinessCustomerUpdate schema
API->>DB: Update customer record
DB-->>API: Customer updated
API-->>Client: 200 OK<br/>(Customer response with kycStatus/kybStatus)
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. |
e7d2ae0 to
2793eb3
Compare
d742b88 to
68ab09c
Compare
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
| type: object | ||
| required: | ||
| - customerType | ||
| properties: | ||
| customerType: | ||
| type: string | ||
| enum: | ||
| - INDIVIDUAL | ||
| - BUSINESS | ||
| description: Customer type discriminator | ||
| oneOf: | ||
| - $ref: ./IndividualCustomerUpdate.yaml | ||
| - $ref: ./BusinessCustomerUpdate.yaml | ||
| discriminator: | ||
| propertyName: customerType | ||
| mapping: | ||
| INDIVIDUAL: ./IndividualCustomerUpdate.yaml | ||
| BUSINESS: ./BusinessCustomerUpdate.yaml |
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.
CreateCustomerRequest and UpdateCustomerRequest are completely identical. The old CREATE endpoint required platformCustomerId via allOf constraints, but this new schema doesn't enforce that requirement. This is a breaking change that makes platformCustomerId optional for creation when it was previously required.
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/components/schemas/customers/CreateCustomerRequest.yaml
Line: 1:18
Comment:
`CreateCustomerRequest` and `UpdateCustomerRequest` are completely identical. The old CREATE endpoint required `platformCustomerId` via `allOf` constraints, but this new schema doesn't enforce that requirement. This is a breaking change that makes `platformCustomerId` optional for creation when it was previously required.
How can I resolve this? If you propose a fix, please make it concise.2793eb3 to
a6d5ea6
Compare
68ab09c to
5786fb9
Compare
a6d5ea6 to
ba5b137
Compare
5786fb9 to
79467e5
Compare
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
| required: true | ||
| content: | ||
| application/json: | ||
| schema: |
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.
Check that removing the kycUrl response field from the CREATE endpoint won't break existing API consumers expecting this field in responses.
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/paths/customers/customers.yaml
Line: 15:15
Comment:
Check that removing the `kycUrl` response field from the CREATE endpoint won't break existing API consumers expecting this field in responses.
How can I resolve this? If you propose a fix, please make it concise.79467e5 to
9f4bbd9
Compare
ba5b137 to
8e152e4
Compare
9f4bbd9 to
4e17d69
Compare
4db1ea5 to
152d09c
Compare
5022722 to
03ebf04
Compare
5adb57b to
c88c884
Compare
03ebf04 to
db286da
Compare
c88c884 to
7fc9ade
Compare
db286da to
493e9f8
Compare
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
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:13
Comment:
Check that `BusinessCustomerUpdate` intentionally lacks `platformCustomerId` field while `IndividualCustomerUpdate` now has it - creates inconsistency between customer types
How can I resolve this? If you propose a fix, please make it concise. |
493e9f8 to
34de965
Compare
7fc9ade to
36f295c
Compare
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
| type: object | ||
| required: | ||
| - customerType | ||
| properties: | ||
| customerType: | ||
| type: string | ||
| enum: | ||
| - INDIVIDUAL | ||
| - BUSINESS | ||
| description: Customer type discriminator | ||
| oneOf: | ||
| - $ref: ./IndividualCustomerUpdate.yaml | ||
| - $ref: ./BusinessCustomerUpdate.yaml | ||
| discriminator: | ||
| propertyName: customerType | ||
| mapping: | ||
| INDIVIDUAL: ./IndividualCustomerUpdate.yaml | ||
| BUSINESS: ./BusinessCustomerUpdate.yaml |
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.
This schema references IndividualCustomerUpdate.yaml which doesn't mark platformCustomerId as required. The old CREATE endpoint explicitly required this field via allOf constraints. Since Customer.yaml response schema requires platformCustomerId, the API likely expects this field during creation. This mismatch between request schema (optional) and what the API actually requires (mandatory) will cause validation confusion.
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/components/schemas/customers/CreateCustomerRequest.yaml
Line: 1:18
Comment:
This schema references `IndividualCustomerUpdate.yaml` which doesn't mark `platformCustomerId` as required. The old CREATE endpoint explicitly required this field via `allOf` constraints. Since `Customer.yaml` response schema requires `platformCustomerId`, the API likely expects this field during creation. This mismatch between request schema (optional) and what the API actually requires (mandatory) will cause validation confusion.
How can I resolve this? If you propose a fix, please make it concise.34de965 to
e2eb0c0
Compare

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