diff --git a/netjsonconfig/schema.py b/netjsonconfig/schema.py index 5f57a210e..077f03676 100644 --- a/netjsonconfig/schema.py +++ b/netjsonconfig/schema.py @@ -699,7 +699,8 @@ "propertyOrder": 5, "items": { "title": "Domain", - "type": "string" + "type": "string", + "format": "hostname" } }, "routes": { diff --git a/tests/openwrt/test_formats.py b/tests/openwrt/test_formats.py index 92047d413..2b1be57f4 100644 --- a/tests/openwrt/test_formats.py +++ b/tests/openwrt/test_formats.py @@ -73,3 +73,13 @@ def test_ntp_servers_hostname(self): o.config['ntp']['server'][0] = 'totally/wrong' with self.assertRaises(ValidationError): o.validate() + + def test_dns_search_hostname(self): + o = OpenWrt({ + "dns_search": ['openwisp.org', 'test.netjson.org'] + }) + o.validate() + # invalid hostname + o.config['dns_search'].append('very/wrong') + with self.assertRaises(ValidationError): + o.validate()