Proposal
min-len/max-len exist but there's no single-tag way to require an exact length (phone numbers, fixed-width codes, postal codes). Add len:
- Tag syntax:
checkers:"len:10"
- Applies to strings, slices, and maps, matching how
min-len/max-len already handle those kinds
- Register a
schema_maker.go mapping: len:N → minLength/maxLength both set to N (or minItems/maxItems, minProperties/maxProperties depending on kind, mirroring how min-len/max-len already branch)
- Add error code + message to all 23 locale files
- 100% test coverage;
CHANGELOG.md entry
Follow the established checker file pattern (see min_len.go, max_len.go).
Proposal
min-len/max-lenexist but there's no single-tag way to require an exact length (phone numbers, fixed-width codes, postal codes). Addlen:checkers:"len:10"min-len/max-lenalready handle those kindsschema_maker.gomapping:len:N→minLength/maxLengthboth set toN(orminItems/maxItems,minProperties/maxPropertiesdepending on kind, mirroring howmin-len/max-lenalready branch)CHANGELOG.mdentryFollow the established checker file pattern (see
min_len.go,max_len.go).