diff --git a/json/tests/draft7/optional/format/hostname.json b/json/tests/draft7/optional/format/hostname.json index a8ecd194..866a6178 100644 --- a/json/tests/draft7/optional/format/hostname.json +++ b/json/tests/draft7/optional/format/hostname.json @@ -112,6 +112,16 @@ "description": "single label ending with digit", "data": "hostnam3", "valid": true + }, + { + "description": "empty string", + "data": "", + "valid": false + }, + { + "description": "single dot", + "data": ".", + "valid": false } ] } diff --git a/jsonschema/_format.py b/jsonschema/_format.py index 789fe4f2..9b4e67b6 100644 --- a/jsonschema/_format.py +++ b/jsonschema/_format.py @@ -272,6 +272,10 @@ def is_ipv6(instance: object) -> bool: draft7="hostname", draft201909="hostname", draft202012="hostname", + # fqdn.FQDN("") raises a ValueError due to a bug + # however, it's not clear when or if that will be fixed, so catch it + # here for now + raises=ValueError, ) def is_host_name(instance: object) -> bool: if not isinstance(instance, str):