-
Notifications
You must be signed in to change notification settings - Fork 5
chore: Sync account schemas #435
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: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,3 +10,4 @@ allOf: | |
| type: string | ||
| enum: | ||
| - BANK_TRANSFER | ||
| - MOBILE_MONEY | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,29 @@ | ||
| type: object | ||
| required: | ||
| - accountType | ||
| - bankName | ||
| - accountNumber | ||
| - bankAccountType | ||
| description: 'Required fields depend on the selected paymentRails: | ||
|
|
||
| - BANK_TRANSFER: accountNumber | ||
|
|
||
| - MOBILE_MONEY: phoneNumber' | ||
| properties: | ||
| accountType: | ||
| type: string | ||
| enum: | ||
| - COP_ACCOUNT | ||
| bankName: | ||
| type: string | ||
| description: The name of the bank | ||
| minLength: 1 | ||
| maxLength: 255 | ||
| accountNumber: | ||
| type: string | ||
| description: The account number of the bank | ||
| minLength: 1 | ||
| maxLength: 34 | ||
| bankAccountType: | ||
| phoneNumber: | ||
| type: string | ||
| description: The bank account type | ||
| enum: | ||
| - CHECKING | ||
| - SAVINGS | ||
| description: The phone number in international format | ||
| example: '+1234567890' | ||
| minLength: 7 | ||
| maxLength: 15 | ||
| pattern: ^\+[0-9]{6,14}$ | ||
| example: | ||
| accountType: COP_ACCOUNT | ||
| bankName: Example Bank | ||
| accountNumber: '1234567890' | ||
| bankAccountType: CHECKING | ||
| phoneNumber: '+1234567890' | ||
|
Comment on lines
26
to
+29
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The Consider splitting into two separate examples, or picking one canonical example (e.g., the Prompt To Fix With AIThis is a comment left during a code review.
Path: openapi/components/schemas/common/CopAccountInfoBase.yaml
Line: 26-29
Comment:
**Misleading example combines mutually exclusive fields**
The `example` object includes both `accountNumber` and `phoneNumber` simultaneously, but these fields are mutually exclusive by payment rail (`BANK_TRANSFER` uses `accountNumber`, `MOBILE_MONEY` uses `phoneNumber`). An API consumer following this example would supply both fields regardless of their chosen payment rail, which is confusing and doesn't model the actual expected usage.
Consider splitting into two separate examples, or picking one canonical example (e.g., the `BANK_TRANSFER` case).
How can I resolve this? If you propose a fix, please make it concise. |
||
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.
The description documents that
accountNumberis required forBANK_TRANSFERandphoneNumberforMOBILE_MONEY, but neither field appears in therequiredarray — onlyaccountTypedoes. Schema validators (clients, linters, request-validation middleware) will not enforce these conditional requirements. OpenAPI 3.1 supportsif/then/elseoroneOfdiscrimination to formally encode this constraint; OpenAPI 3.0 can useoneOfto model the two variants. As-is, missing a required payment-rail-specific field will silently pass schema validation and only fail at runtime.Prompt To Fix With AI