Skip to content

Commit d310cbe

Browse files
authored
Implement an IPv6 address schema (#3)
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent a435e60 commit d310cbe

2 files changed

Lines changed: 732 additions & 0 deletions

File tree

schemas/ietf/ip/v6/address.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "RFC 3986 IPv6 Address",
4+
"description": "An Internet Protocol version 6 address in colon-hexadecimal notation",
5+
"$comment": "https://www.rfc-editor.org/rfc/rfc3986#section-3.2.2",
6+
"examples": [
7+
"2001:db8::8a2e:370:7334",
8+
"::1",
9+
"::",
10+
"::ffff:192.0.2.1",
11+
"2001:db8:85a3::8a2e:370:7334",
12+
"fe80::1"
13+
],
14+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
15+
"type": "string",
16+
"pattern": "^(?:(?:[0-9A-Fa-f]{1,4}:){6}(?:[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))|::(?:[0-9A-Fa-f]{1,4}:){5}(?:[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))|(?:[0-9A-Fa-f]{1,4})?::(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