-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
Problem
The built-in bic
validator currently appears to reject some valid BICs introduced under the ISO 9362:2022 revision — specifically those where the first four characters of the party prefix can include digits (e.g. E097AEXX
).
This pattern is valid per ISO 9362:2022, section 6.3.1, which allows the party prefix to be alphanumeric, not just letters.
Example
type Bank struct {
SwiftCode string `validate:"bic"`
}
bank := Bank{SwiftCode: "E097AEXX"} // Valid under ISO 9362:2022
err := validate.Struct(bank)
Currently, this fails validation with the built-in bic tag.
Expected behavior
The bic tag should validate codes conforming to both:
ISO 9362:2014 (legacy 8- or 11-char codes), and
ISO 9362:2022 (new alphanumeric party prefix).
References
ISO 9362:2022 (Business Identifier Code)
Example real-world BIC: E097AEXX
Related discussion: Symfony issue 51975
I'm willing to contribute here.
Metadata
Metadata
Assignees
Labels
No labels