summaryrefslogtreecommitdiff
path: root/tests/draft-future/optional/format/hostname.json
blob: 8a67fda8807c2b54aee71cb9f72c4b5976c014bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
[
    {
        "description": "validation of host names",
        "schema": { "format": "hostname" },
        "tests": [
            {
                "description": "all string formats ignore integers",
                "data": 12,
                "valid": true
            },
            {
                "description": "all string formats ignore floats",
                "data": 13.7,
                "valid": true
            },
            {
                "description": "all string formats ignore objects",
                "data": {},
                "valid": true
            },
            {
                "description": "all string formats ignore arrays",
                "data": [],
                "valid": true
            },
            {
                "description": "all string formats ignore booleans",
                "data": false,
                "valid": true
            },
            {
                "description": "all string formats ignore nulls",
                "data": null,
                "valid": true
            },
            {
                "description": "a valid host name",
                "data": "www.example.com",
                "valid": true
            },
            {
                "description": "a valid punycoded IDN hostname",
                "data": "xn--4gbwdl.xn--wgbh1c",
                "valid": true
            },
            {
                "description": "a host name starting with an illegal character",
                "data": "-a-host-name-that-starts-with--",
                "valid": false
            },
            {
                "description": "a host name containing illegal characters",
                "data": "not_a_valid_host_name",
                "valid": false
            },
            {
                "description": "a host name with a component too long",
                "data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
                "valid": false
            },
            {
                "description": "starts with hyphen",
                "data": "-hostname",
                "valid": false
            },
            {
                "description": "ends with hyphen",
                "data": "hostname-",
                "valid": false
            },
            {
                "description": "starts with underscore",
                "data": "_hostname",
                "valid": false
            },
            {
                "description": "ends with underscore",
                "data": "hostname_",
                "valid": false
            },
            {
                "description": "contains underscore",
                "data": "host_name",
                "valid": false
            },
            {
                "description": "maximum label length",
                "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com",
                "valid": true
            },
            {
                "description": "exceeds maximum label length",
                "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
                "valid": false
            }
        ]
    }
]