Skip to content

feat(IGO-34): MAC address validation (Symfony MacAddress)#101

Merged
strider2038 merged 4 commits into
mainfrom
cursor/igo-34-work-item-011c
Apr 12, 2026
Merged

feat(IGO-34): MAC address validation (Symfony MacAddress)#101
strider2038 merged 4 commits into
mainfrom
cursor/igo-34-work-item-011c

Conversation

@strider2038
Copy link
Copy Markdown
Contributor

Summary

Implements MAC address validation aligned with Symfony MacAddress / MacAddressValidator: same default message, same type string values, and the same unicast/multicast, local/universal, and broadcast rules on the first octet and ff:ff:ff:ff:ff:ff.

API

  • validate.MacAddress with validate.MacAddressType(...) and constants validate.MacAddressTypeAll, MacAddressTypeBroadcast, etc.
  • it.IsMacAddress() with WithType, WithError, WithMessage, When, WhenGroups
  • is.MACAddress (Go initialism per Code Review Comments)
  • validation.ErrInvalidMAC / message.InvalidMAC with English and Russian translations

Behavior notes

  • Uses net.ParseMAC only for 48-bit (6-octet) hardware addresses; colon, hyphen, and dot forms accepted by ParseMAC are supported. EUI-64 and longer addresses parse in Go but are rejected here so behavior stays aligned with Symfony’s FILTER_VALIDATE_MAC scope for typical MAC strings.
  • Unknown type strings return the same invalid error as a bad address (Symfony throws at constraint construction; we validate at runtime).

Testing

  • go test -race ./...
  • golangci-lint run (v2.11.4)

Closes IGO-34.

Open in Web Open in Cursor 

cursoragent and others added 3 commits April 7, 2026 16:59
- validate.MacAddress with net.ParseMAC (48-bit only) and Symfony type names
- it.IsMacAddress with WithType; is.MACAddress; ErrInvalidMAC and translations
- Tests and examples for validate, is, it, and shared constraint suite

Co-authored-by: Igor Lazarev <strider2038@yandex.ru>
Made-with: Cursor

# Conflicts:
#	CHANGELOG.md
@strider2038 strider2038 marked this pull request as ready for review April 12, 2026 19:14
@strider2038 strider2038 merged commit 8bd2d49 into main Apr 12, 2026
2 checks passed
@strider2038 strider2038 deleted the cursor/igo-34-work-item-011c branch April 12, 2026 19:17
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