Skip to content

Commit 24d1328

Browse files
committed
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
1 parent bd12369 commit 24d1328

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

jsonschema/_format.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,9 @@ def is_relative_json_pointer(instance: object) -> bool:
454454
# https://tools.ietf.org/html/draft-handrews-relative-json-pointer-01#section-3
455455
if not isinstance(instance, str):
456456
return True
457+
if not instance:
458+
return False
459+
457460
non_negative_integer, rest = [], ""
458461
for i, character in enumerate(instance):
459462
if character.isdigit():

0 commit comments

Comments
 (0)