github.com/kaptinlin/jsonschema@v0.4.6/testdata/JSON-Schema-Test-Suite/tests/draft-next/optional/format/hostname.json (about) 1 [ 2 { 3 "description": "validation of host names", 4 "schema": { 5 "$schema": "https://json-schema.org/draft/next/schema", 6 "format": "hostname" 7 }, 8 "tests": [ 9 { 10 "description": "all string formats ignore integers", 11 "data": 12, 12 "valid": true 13 }, 14 { 15 "description": "all string formats ignore floats", 16 "data": 13.7, 17 "valid": true 18 }, 19 { 20 "description": "all string formats ignore objects", 21 "data": {}, 22 "valid": true 23 }, 24 { 25 "description": "all string formats ignore arrays", 26 "data": [], 27 "valid": true 28 }, 29 { 30 "description": "all string formats ignore booleans", 31 "data": false, 32 "valid": true 33 }, 34 { 35 "description": "all string formats ignore nulls", 36 "data": null, 37 "valid": true 38 }, 39 { 40 "description": "a valid host name", 41 "data": "www.example.com", 42 "valid": true 43 }, 44 { 45 "description": "a valid punycoded IDN hostname", 46 "data": "xn--4gbwdl.xn--wgbh1c", 47 "valid": true 48 }, 49 { 50 "description": "a host name starting with an illegal character", 51 "data": "-a-host-name-that-starts-with--", 52 "valid": false 53 }, 54 { 55 "description": "a host name containing illegal characters", 56 "data": "not_a_valid_host_name", 57 "valid": false 58 }, 59 { 60 "description": "a host name with a component too long", 61 "data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component", 62 "valid": false 63 }, 64 { 65 "description": "starts with hyphen", 66 "data": "-hostname", 67 "valid": false 68 }, 69 { 70 "description": "ends with hyphen", 71 "data": "hostname-", 72 "valid": false 73 }, 74 { 75 "description": "starts with underscore", 76 "data": "_hostname", 77 "valid": false 78 }, 79 { 80 "description": "ends with underscore", 81 "data": "hostname_", 82 "valid": false 83 }, 84 { 85 "description": "contains underscore", 86 "data": "host_name", 87 "valid": false 88 }, 89 { 90 "description": "maximum label length", 91 "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com", 92 "valid": true 93 }, 94 { 95 "description": "exceeds maximum label length", 96 "data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com", 97 "valid": false 98 }, 99 { 100 "description": "single label", 101 "data": "hostname", 102 "valid": true 103 }, 104 { 105 "description": "single label with hyphen", 106 "data": "host-name", 107 "valid": true 108 }, 109 { 110 "description": "single label with digits", 111 "data": "h0stn4me", 112 "valid": true 113 }, 114 { 115 "description": "single label starting with digit", 116 "data": "1host", 117 "valid": true 118 }, 119 { 120 "description": "single label ending with digit", 121 "data": "hostnam3", 122 "valid": true 123 } 124 ] 125 } 126 ]