Skip to content

Commit

Permalink
Empty strings are not valid relative JSON pointers.
Browse files Browse the repository at this point in the history
(This is unlike non-relative pointers, where empty strings are indeed
valid.)

Refs: json-schema-org/JSON-Schema-Test-Suite#605
  • Loading branch information
Julian committed Nov 28, 2022
1 parent bd12369 commit 24d1328
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions jsonschema/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 24d1328

Please sign in to comment.