We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3f9db87 commit 1325f2fCopy full SHA for 1325f2f
st2common/st2common/util/schema/__init__.py
@@ -417,9 +417,16 @@ def validate(
417
:type use_default: ``bool``
418
"""
419
instance = fast_deepcopy_dict(instance)
420
- schema_type = schema.get("type", None)
+ schema_type = None
421
+ if isinstance(schema, dict):
422
+ schema_type = schema.get("type", None)
423
+
424
instance_is_dict = isinstance(instance, dict)
425
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
430
if use_default and allow_default_none:
431
schema = modify_schema_allow_default_none(schema=schema)
432
0 commit comments