Skip to content

Commit

Permalink
Fixed out of list error
Browse files Browse the repository at this point in the history
  • Loading branch information
kacperpaczos committed Dec 27, 2023
1 parent 7f781d9 commit b00b410
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions python_jsonschema_objects/pattern_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,13 @@ def instantiate(self, name, val):
for k, t in validators.SCHEMA_TYPE_MAPPING
if t is not None and isinstance(val, t)
]
valtype = valtype[0]
return MakeLiteral(name, valtype, val)

if valtype:
valtype = valtype[0]
return MakeLiteral(name, valtype, val)
else:
# Handle the case where valtype is an empty list
raise validators.ValidationError("Unable to determine valtype")

elif isinstance(self._additional_type, (type, cb.TypeProxy)):
return self._make_type(self._additional_type, val)
Expand Down

0 comments on commit b00b410

Please sign in to comment.