Skip to content

Commit

Permalink
Durations without trailing units aren't valid durations.
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian committed Nov 28, 2022
1 parent 24d1328 commit e868bfe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
v4.17.2
=======

* Empty strings are not valid relative JSON Pointers (aren't valid under the
RJP format).
* Durations without (trailing) units are not valid durations (aren't
valid under the duration format). This involves changing the dependency
used for validating durations (from ``isoduration`` to ``isodate``).

v4.17.1
=======

Expand Down
4 changes: 3 additions & 1 deletion jsonschema/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,9 @@ def is_uri_template(instance: object) -> bool:
def is_duration(instance: object) -> bool:
if not isinstance(instance, str):
return True
return bool(isoduration.parse_duration(instance))
isoduration.parse_duration(instance)
# FIXME: See bolsote/isoduration#25 and bolsote/isoduration#21
return instance.endswith(tuple("DMYWHMS"))


@_checks_drafts(
Expand Down

0 comments on commit e868bfe

Please sign in to comment.