-
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 refactors customer-related OpenAPI 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 wrapper schema for customer creation that references IndividualCustomerUpdate/BusinessCustomerUpdate with discriminator, but doesn't enforce platformCustomerId as required (breaking change) |
| openapi/components/schemas/customers/IndividualCustomerUpdate.yaml | Changed enum to const for customerType, added platformCustomerId field (now available in UPDATE operations when it wasn't before) |
| openapi/paths/customers/customers.yaml | Replaced inline schema with CreateCustomerRequest reference, removed kycUrl field from request and all inline examples |
Sequence Diagram
sequenceDiagram
participant Client
participant API
participant Schema as CreateCustomerRequest
participant Discriminator
participant Individual as IndividualCustomerUpdate
participant Business as BusinessCustomerUpdate
Note over Client,Business: Customer Creation Flow
Client->>API: POST /customers
API->>Schema: Validate request body
Schema->>Discriminator: Check customerType field
alt customerType: INDIVIDUAL
Discriminator->>Individual: Route to IndividualCustomerUpdate
Note over Individual: ❌ platformCustomerId optional<br/>(was required in old schema)
Individual-->>Schema: Validation result
else customerType: BUSINESS
Discriminator->>Business: Route to BusinessCustomerUpdate
Business-->>Schema: Validation result
end
Schema-->>API: Request validated
API-->>Client: 201 Customer created
Note over API,Client: Response includes required<br/>platformCustomerId per Customer.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.
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.
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