go-playground / validator

:100:Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving
MIT License
16.44k stars 1.31k forks source link

Country Specific Validators #629

Open bzip2-9 opened 4 years ago

bzip2-9 commented 4 years ago

Package version eg. v8, v9:

Probably, v11

Issue, Question or Enhancement:

How do you feel about creating a directory structure for country specific validations, similar to the translations ? It's a great library, full of generic validators, but almost every system has to validate country specific data (specially documents for person, company, vehicle, bank account, zip codes, cities, states, etc.) and this is generic (for each particular country, of course).

Maybe, the validator tag should have a two letter prefix, identifying the country (if the system is used by more than one country at the same time, it could differenciate between the validators).

As the translations, it can't be compiled for every one, just when imported. Different from translations, not all validators make sense in all countries.

Using the library since last week (using v10), I already created some validators for my country (Brazil).

Thanks.

deankarn commented 4 years ago

Hey @bzip2-9 yes I think that would be useful. there already exists a non-standard validator directory here I think we can add a country sub-directory and as you suggested add sub-directories per country code or prefix.