Skip to content

Commit e868bfe

Browse files
committed
Durations without trailing units aren't valid durations.
Refs: json-schema-org/JSON-Schema-Test-Suite#606
1 parent 24d1328 commit e868bfe

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CHANGELOG.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
v4.17.2
2+
=======
3+
4+
* Empty strings are not valid relative JSON Pointers (aren't valid under the
5+
RJP format).
6+
* Durations without (trailing) units are not valid durations (aren't
7+
valid under the duration format). This involves changing the dependency
8+
used for validating durations (from ``isoduration`` to ``isodate``).
9+
110
v4.17.1
211
=======
312

jsonschema/_format.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,9 @@ def is_uri_template(instance: object) -> bool:
501501
def is_duration(instance: object) -> bool:
502502
if not isinstance(instance, str):
503503
return True
504-
return bool(isoduration.parse_duration(instance))
504+
isoduration.parse_duration(instance)
505+
# FIXME: See bolsote/isoduration#25 and bolsote/isoduration#21
506+
return instance.endswith(tuple("DMYWHMS"))
505507

506508

507509
@_checks_drafts(

0 commit comments

Comments
 (0)