Skip to content

feat: BIC (SWIFT) validation constraint (IGO-32)#96

Closed
strider2038 wants to merge 1 commit into
mainfrom
cursor/igo-32-275e
Closed

feat: BIC (SWIFT) validation constraint (IGO-32)#96
strider2038 wants to merge 1 commit into
mainfrom
cursor/igo-32-275e

Conversation

@strider2038
Copy link
Copy Markdown
Contributor

Summary

Adds BIC / SWIFT validation aligned with Symfony Bic / BicValidator: length 8 or 11, alphanumeric ASCII, optional strict vs case-insensitive mode, country/territory check via golang.org/x/text/language.ParseRegion (country, not group) plus Symfony’s BIC→IBAN territory map, optional cross-check with an IBAN string.

API

  • validate.BIC, validate.BICCaseInsensitive, validate.BICWithIBAN; errors validate.ErrInvalidBIC, validate.ErrBICIBANCountryMismatch
  • it.IsBIC() with CaseInsensitive(), WithIBAN(), WithIBANError(), WithIBANMessage()
  • is.BIC
  • validation.ErrInvalidBIC, validation.ErrBICIBANCountryMismatch, message.InvalidBIC, message.BICNotAssociatedWithIBAN (EN + RU)

Notes

  • Spaces (U+0020) are stripped from the BIC before checks, matching Symfony.
  • Empty BIC is valid (use NotBlank if needed), matching Symfony.
  • Symfony’s ibanPropertyPath is not implemented (object property paths are out of scope for this library’s string constraint).

Closes IGO-32.

Open in Web Open in Cursor 

- validate.BIC with strict/case-insensitive modes and optional IBAN country check
- it.IsBIC with CaseInsensitive, WithIBAN, and mismatch messages
- is.BIC, messages, EN/RU translations, tests and examples
- Aligned with Symfony BicValidator; regions via golang.org/x/text/language

Co-authored-by: Igor Lazarev <strider2038@yandex.ru>
@strider2038 strider2038 closed this Apr 6, 2026
@strider2038 strider2038 deleted the cursor/igo-32-275e branch April 6, 2026 17:55
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