Skip to content

Commit

Permalink
Add support for eui-64 mac addresses for MacAddress scalar type (#3664)
Browse files Browse the repository at this point in the history
  • Loading branch information
oising authored May 14, 2021
1 parent d6aef6e commit cddbc4f
Show file tree
Hide file tree
Showing 6 changed files with 417 additions and 136 deletions.
8 changes: 5 additions & 3 deletions src/HotChocolate/Core/src/Types.Scalars/MacAddressType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
namespace HotChocolate.Types
{
/// <summary>
/// The `MacAddress` scalar type represents a IEEE 802 48-bit Mac address, represented as UTF-8
/// The `MacAddress` scalar type represents IEEE 802 48-bit (MAC-48/EUI-48)
/// and 64-bit (EUI-64) Mac addresses, represented as UTF-8
/// character sequences. The scalar follows the specification defined in
/// <a href="https://tools.ietf.org/html/rfc7042#page-19">RFC7042</a>
/// <a href="https://tools.ietf.org/html/rfc7042#page-19">RFC7042</a> and
/// <a href="https://tools.ietf.org/html/rfc7043">RFC 7043</a> respectively.
/// </summary>
public class MacAddressType : RegexType
{
private const string _validationPattern =
@"^(?:[0-9A-Fa-f]{2}([:-]?)[0-9A-Fa-f]{2})(?:(?:\1|\.)(?:[0-9A-Fa-f]{2}([:-]?)" +
"[0-9A-Fa-f]{2})){2}$";
"[0-9A-Fa-f]{2})){2,3}$";

/// <summary>
/// Initializes a new instance of the <see cref="MacAddressType"/> class.
Expand Down
Loading

0 comments on commit cddbc4f

Please sign in to comment.