Skip to content

Commit 8b03221

Browse files
committed
Fix for jsonschema==4.19.1
1 parent c843950 commit 8b03221

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

python/tskit/metadata.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22
#
3-
# Copyright (c) 2020-2022 Tskit Developers
3+
# Copyright (c) 2020-2023 Tskit Developers
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal
@@ -193,7 +193,11 @@ def binary_format_validator(validator, types, instance, schema):
193193
# generators of exceptions, hence the yielding
194194

195195
# Make sure the normal type validation gets done
196-
yield from jsonschema._validators.type(validator, types, instance, schema)
196+
try:
197+
yield from jsonschema._validators.type(validator, types, instance, schema)
198+
except AttributeError:
199+
# Needed since jsonschema==4.19.1
200+
yield from jsonschema._keywords.type(validator, types, instance, schema)
197201

198202
# Non-composite types must have a binaryFormat
199203
if validator.is_type(instance, "object"):
@@ -222,7 +226,13 @@ def binary_format_validator(validator, types, instance, schema):
222226

223227
def required_validator(validator, required, instance, schema):
224228
# Do the normal validation
225-
yield from jsonschema._validators.required(validator, required, instance, schema)
229+
try:
230+
yield from jsonschema._validators.required(
231+
validator, required, instance, schema
232+
)
233+
except AttributeError:
234+
# Needed since jsonschema==4.19.1
235+
yield from jsonschema._keywords.required(validator, required, instance, schema)
226236

227237
# For struct codec if a property is not required, then it must have a default
228238
for prop, sub_schema in instance["properties"].items():

0 commit comments

Comments
 (0)