Skip to content

Commit 37671ac

Browse files
committed
And now add the Draft7 time format, even though it don't work.
Because FormatChecker is bad and I should feel bad :/ This is currently being overriden by the older Draft3 time format. Probably time to deprecate cls_checks, and pass format checkers in on validator creation. The changes in #425 are likely also relevant.
1 parent 6245c16 commit 37671ac

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

jsonschema/_format.py

+7
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,13 @@ def is_datetime(instance):
278278
return strict_rfc3339.validate_rfc3339(instance)
279279

280280

281+
@_checks_drafts(draft7="time")
282+
def is_time(instance):
283+
if not isinstance(instance, str_types):
284+
return True
285+
return is_datetime("1970-01-01T" + instance)
286+
287+
281288
@_checks_drafts(name="regex", raises=re.error)
282289
def is_regex(instance):
283290
if not isinstance(instance, str_types):

0 commit comments

Comments
 (0)