Skip to content

Conversation

@pengying
Copy link
Contributor

@pengying pengying commented Jan 24, 2026

TL;DR

Refactored OpenAPI schema definitions for customer-related endpoints to improve maintainability and consistency.

What changed?

  • Created dedicated schema components for CreateCustomerRequest and UpdateCustomerRequest
  • Moved inline schema definitions from API paths to reusable component schemas
  • Changed enum: [INDIVIDUAL] to const: INDIVIDUAL in the IndividualCustomerUpdate schema for better semantics
  • Added platformCustomerId directly to the IndividualCustomerUpdate schema
  • Removed redundant examples from the API paths as they're now defined in the schema components

@greptile-apps
Copy link

greptile-apps bot commented Jan 24, 2026

Greptile Overview

Greptile Summary

This PR refactors customer-related OpenAPI schemas by extracting inline definitions into reusable components (CreateCustomerRequest and UpdateCustomerRequest), improving maintainability. However, the refactoring introduces a breaking change: platformCustomerId was explicitly required in the old CREATE endpoint but is now optional in the new schema structure.

Key Changes

  • Created CreateCustomerRequest.yaml and UpdateCustomerRequest.yaml wrapper schemas with discriminators
  • Added platformCustomerId to IndividualCustomerUpdate.yaml (now available in UPDATE operations)
  • Changed enum: [INDIVIDUAL] to const: INDIVIDUAL for better semantics
  • Removed kycUrl field from CREATE request body
  • Removed inline examples from API path files

Issues Found

  • Breaking Change: platformCustomerId went from required to optional in CREATE requests, creating a mismatch with the Customer.yaml response schema which requires this field
  • CreateCustomerRequest and UpdateCustomerRequest are identical schemas - no differentiation between create and update requirements
  • platformCustomerId is now updateable (wasn't before) - verify this is intentional

Confidence Score: 2/5

  • This PR contains a breaking API change that will affect existing integrations
  • Score reflects critical breaking change where required field became optional, plus semantic concerns about Create/Update schemas being identical when they should enforce different constraints
  • Pay close attention to openapi/components/schemas/customers/CreateCustomerRequest.yaml and openapi/components/schemas/customers/IndividualCustomerUpdate.yaml - these need platformCustomerId constraint fixes

Important Files Changed

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
Loading

Copy link

@greptile-apps greptile-apps bot left a 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

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Jan 24, 2026

Additional Comments (1)

openapi/components/schemas/customers/BusinessCustomerUpdate.yaml
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.

Prompt To Fix With AI
This 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.

@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split branch from e7d2ae0 to 2793eb3 Compare January 27, 2026 01:29
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from d742b88 to 68ab09c Compare January 27, 2026 01:29
Copy link

@greptile-apps greptile-apps bot left a 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

Edit Code Review Agent Settings | Greptile

Comment on lines +1 to +18
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
Copy link

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.

@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split branch from 2793eb3 to a6d5ea6 Compare January 27, 2026 05:18
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from 68ab09c to 5786fb9 Compare January 27, 2026 05:18
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split branch from a6d5ea6 to ba5b137 Compare January 27, 2026 05:23
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from 5786fb9 to 79467e5 Compare January 27, 2026 05:24
Copy link

@greptile-apps greptile-apps bot left a 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

Edit Code Review Agent Settings | Greptile

required: true
content:
application/json:
schema:
Copy link

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.

@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from 79467e5 to 9f4bbd9 Compare January 27, 2026 20:38
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split branch from ba5b137 to 8e152e4 Compare January 27, 2026 20:38
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from 9f4bbd9 to 4e17d69 Compare January 27, 2026 21:19
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split branch 2 times, most recently from 4db1ea5 to 152d09c Compare January 27, 2026 23:54
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch 2 times, most recently from 5022722 to 03ebf04 Compare January 27, 2026 23:57
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split branch 2 times, most recently from 5adb57b to c88c884 Compare January 28, 2026 00:08
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from 03ebf04 to db286da Compare January 28, 2026 00:08
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split branch from c88c884 to 7fc9ade Compare January 28, 2026 00:15
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from db286da to 493e9f8 Compare January 28, 2026 00:15
Copy link

@greptile-apps greptile-apps bot left a 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

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Jan 28, 2026

Additional Comments (1)

openapi/components/schemas/customers/BusinessCustomerUpdate.yaml
Check that BusinessCustomerUpdate intentionally lacks platformCustomerId field while IndividualCustomerUpdate now has it - creates inconsistency between customer types

Prompt To Fix With AI
This 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.

@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from 493e9f8 to 34de965 Compare January 28, 2026 00:27
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split branch from 7fc9ade to 36f295c Compare January 28, 2026 00:27
Copy link

@greptile-apps greptile-apps bot left a 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

Edit Code Review Agent Settings | Greptile

Comment on lines +1 to +18
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
Copy link

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.

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