Skip to content

feat: adding country code to external account response#262

Open
pengying wants to merge 2 commits intomainfrom
03-11-feat_adding_country_code_to_external_account_response
Open

feat: adding country code to external account response#262
pengying wants to merge 2 commits intomainfrom
03-11-feat_adding_country_code_to_external_account_response

Conversation

@pengying
Copy link
Contributor

@pengying pengying commented Mar 11, 2026

TL;DR

Added countryCode field to the ExternalAccount schema to capture the ISO 3166-1 alpha-2 country code for receiving external accounts.

What changed?

Added a new countryCode property to the ExternalAccount schema with the following specifications:

  • Type: string
  • Description: ISO 3166-1 alpha-2 country code for the receiving external account, derived from the provided rail and account information
  • Validation: minLength and maxLength of 2 characters
  • Example value: "IN"

How to test?

  1. Create or retrieve an external account and verify the countryCode field is present in the response
  2. Validate that the country code follows ISO 3166-1 alpha-2 format (2-character codes)
  3. Test with different rails and account types to ensure the country code is properly derived from the provided information

Why make this change?

This enhancement provides better geographical context for external accounts, enabling improved compliance, routing decisions, and user experience by clearly identifying the country associated with each receiving account.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2026

✱ Stainless preview builds

This PR will update the grid SDKs with the following commit messages.

kotlin

feat(api): add countryCode field to ExternalAccount model

openapi

feat(api): add countryCode field to ExternalAccount

python

feat(api): add country_code field to customers external_account

typescript

feat(api): add country_code field to ExternalAccount

Edit this comment to update them. They will appear in their respective SDK's changelogs.

grid-typescript studio · code · diff

generate ✅build ⏳lint ⏳test ⏳

grid-openapi studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅

grid-python studio · code · diff

generate ✅build ⏳lint ⏳test ⏳

grid-kotlin studio

⏳ These are partial results; builds are still running.


This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
If you push custom code to the preview branch, re-run this workflow to update the comment.
Last updated: 2026-03-13 14:20:32 UTC

@pengying pengying marked this pull request as ready for review March 11, 2026 21:46
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 11, 2026

Greptile Summary

This PR adds an optional countryCode field (ISO 3166-1 alpha-2) to the ExternalAccount response schema across all three OpenAPI spec files, providing geographical context derived from the account's rail and account information.

  • The source component file (ExternalAccount.yaml) is correctly updated with full validation: minLength: 2, maxLength: 2, and pattern: '^[A-Z]{2}$'.
  • The two bundled files (openapi.yaml and mintlify/openapi.yaml) are missing the pattern: '^[A-Z]{2}$' constraint, creating a validation gap between the source schema and the files distributed to consumers.
  • The field is correctly left optional (not added to required), which is appropriate given that country code derivation may not always be possible for all rails.

Confidence Score: 3/5

  • Safe to merge functionally, but openapi.yaml and mintlify/openapi.yaml are missing the pattern constraint present in the source schema.
  • The change is a straightforward additive schema update. The source component YAML is correct. However, the two bundled/flattened files are inconsistently missing the pattern: '^[A-Z]{2}$' validation, which means API consumers validating against those files would accept non-uppercase or non-alpha two-character strings. This is a correctness gap, not a runtime breakage.
  • openapi.yaml and mintlify/openapi.yaml both need the pattern: '^[A-Z]{2}$' constraint added to match the source schema.

Important Files Changed

Filename Overview
openapi/components/schemas/external_accounts/ExternalAccount.yaml Adds optional countryCode field with correct type, description, length constraints, and pattern: '^[A-Z]{2}$' for ISO 3166-1 alpha-2 enforcement.
openapi.yaml Adds countryCode field but is missing the pattern: '^[A-Z]{2}$' constraint present in the source component schema, making validation weaker than intended.
mintlify/openapi.yaml Same as openapi.yaml — adds countryCode but is missing the pattern constraint from the source component schema.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[ExternalAccount.yaml\nsource schema] -->|bundled into| B[openapi.yaml]
    A -->|bundled into| C[mintlify/openapi.yaml]

    A -- "countryCode\nminLength: 2\nmaxLength: 2\npattern: '^[A-Z]{2}$'" --> D{Validation}
    B -- "countryCode\nminLength: 2\nmaxLength: 2\n❌ missing pattern" --> E{Weaker Validation}
    C -- "countryCode\nminLength: 2\nmaxLength: 2\n❌ missing pattern" --> E

    D -->|accepts only| F["'IN', 'US', 'GB'"]
    E -->|also accepts| G["'1A', 'ab', '12'"]
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: openapi.yaml
Line: 7417-7422

Comment:
**Missing `pattern` constraint in bundled file**

The source schema (`openapi/components/schemas/external_accounts/ExternalAccount.yaml`) includes `pattern: '^[A-Z]{2}$'` to enforce that the country code contains exactly two uppercase alphabetical characters. However, this `openapi.yaml` (and `mintlify/openapi.yaml`) is missing that constraint — only `minLength`/`maxLength` are present here.

This means validators consuming `openapi.yaml` directly would accept values like `"12"` or `"ab"` as valid country codes, while validators using the component schema would reject them.

```suggestion
            countryCode:
              type: string
              description: ISO 3166-1 alpha-2 country code for the receiving external account, derived from the provided rail and account information.
              minLength: 2
              maxLength: 2
              pattern: '^[A-Z]{2}$'
              example: IN
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: mintlify/openapi.yaml
Line: 7417-7422

Comment:
**Missing `pattern` constraint in bundled file**

Same issue as `openapi.yaml` — the source schema (`ExternalAccount.yaml`) includes `pattern: '^[A-Z]{2}$'`, but this bundled file is missing it. Any consumer validating against `mintlify/openapi.yaml` directly would accept invalid two-character strings like `"1A"` or `"ab"`.

```suggestion
            countryCode:
              type: string
              description: ISO 3166-1 alpha-2 country code for the receiving external account, derived from the provided rail and account information.
              minLength: 2
              maxLength: 2
              pattern: '^[A-Z]{2}$'
              example: IN
```

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: a758bcb

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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.

1 participant