MCPcopy Create free account
hub / github.com/StackStorm/st2 / validate_criteria

Function validate_criteria

st2common/st2common/validators/api/reactor.py:43–68  ·  view source on GitHub ↗
(criteria)

Source from the content-addressed store, hash-verified

41
42
43def validate_criteria(criteria):
44 if not isinstance(criteria, dict):
45 raise ValueValidationException("Criteria should be a dict.")
46
47 for key, value in six.iteritems(criteria):
48 operator = value.get("type", None)
49 if operator is None:
50 raise ValueValidationException("Operator not specified for field: " + key)
51 if operator not in allowed_operators:
52 raise ValueValidationException(
53 "For field: "
54 + key
55 + ", operator "
56 + operator
57 + " not in list of allowed operators: "
58 + str(list(allowed_operators.keys()))
59 )
60 pattern = value.get("pattern", None)
61 if pattern is None:
62 raise ValueValidationException(
63 "For field: "
64 + key
65 + ", no pattern specified "
66 + "for operator "
67 + operator
68 )
69
70
71def validate_trigger_parameters(trigger_type_ref, parameters):

Callers

nothing calls this directly

Calls 3

keysMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected