From 24d13287b4ee0b3764440e9268ebec120c8e827e Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Mon, 28 Nov 2022 11:24:41 -0500 Subject: [PATCH] Empty strings are not valid relative JSON pointers. (This is unlike non-relative pointers, where empty strings are indeed valid.) Refs: json-schema-org/JSON-Schema-Test-Suite#605 --- jsonschema/_format.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jsonschema/_format.py b/jsonschema/_format.py index 2c07719bc..5e4832698 100644 --- a/jsonschema/_format.py +++ b/jsonschema/_format.py @@ -454,6 +454,9 @@ def is_relative_json_pointer(instance: object) -> bool: # https://tools.ietf.org/html/draft-handrews-relative-json-pointer-01#section-3 if not isinstance(instance, str): return True + if not instance: + return False + non_negative_integer, rest = [], "" for i, character in enumerate(instance): if character.isdigit():