The Perl Toolchain Summit 2025 Needs You: You can help 🙏 Learn more

[
{
"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
},
{
"description": "single label",
"data": "hostname",
"valid": true
},
{
"description": "single label with hyphen",
"data": "host-name",
"valid": true
},
{
"description": "single label with digits",
"data": "h0stn4me",
"valid": true
},
{
"description": "single label starting with digit",
"data": "1host",
"valid": true
},
{
"description": "single label ending with digit",
"data": "hostnam3",
"valid": true
},
{
"description": "empty string",
"data": "",
"valid": false
},
{
"description": "single dot",
"data": ".",
"valid": false
}
]
}
]