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 b584131 commit 9b4bf7eCopy full SHA for 9b4bf7e
st2common/st2common/util/schema/__init__.py
@@ -419,9 +419,16 @@ def validate(
419
:type use_default: ``bool``
420
"""
421
instance = fast_deepcopy_dict(instance)
422
- schema_type = schema.get("type", None)
+ schema_type = None
423
+ if isinstance(schema, dict):
424
+ schema_type = schema.get("type", None)
425
+
426
instance_is_dict = isinstance(instance, dict)
427
428
+ if isinstance(schema, dict) and ("type" in schema or "$schema" in schema):
429
+ jsonschema.validate(instance=instance, schema=schema, *args, **kwargs)
430
+ return instance
431
432
if use_default and allow_default_none:
433
schema = modify_schema_allow_default_none(schema=schema)
434
0 commit comments