Skip to content

Commit 1325f2f

Browse files
committed
see if this works
1 parent 3f9db87 commit 1325f2f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

st2common/st2common/util/schema/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,16 @@ def validate(
417417
:type use_default: ``bool``
418418
"""
419419
instance = fast_deepcopy_dict(instance)
420-
schema_type = schema.get("type", None)
420+
schema_type = None
421+
if isinstance(schema, dict):
422+
schema_type = schema.get("type", None)
423+
421424
instance_is_dict = isinstance(instance, dict)
422425

426+
if isinstance(schema, dict) and ("type" in schema or "$schema" in schema):
427+
jsonschema.validate(instance=instance, schema=schema, *args, **kwargs)
428+
return instance
429+
423430
if use_default and allow_default_none:
424431
schema = modify_schema_allow_default_none(schema=schema)
425432

0 commit comments

Comments
 (0)