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

Function validate_response

st2common/st2common/services/inquiry.py:102–120  ·  view source on GitHub ↗
(inquiry, response)

Source from the content-addressed store, hash-verified

100
101
102def validate_response(inquiry, response):
103 schema = inquiry.schema
104
105 LOG.debug("Validating inquiry response: %s against schema: %s" % (response, schema))
106
107 try:
108 schema_utils.validate(
109 instance=response,
110 schema=schema,
111 cls=schema_utils.CustomValidator,
112 use_default=True,
113 allow_default_none=True,
114 )
115 except Exception as e:
116 msg = 'Response for inquiry "%s" did not pass schema validation.'
117 LOG.exception(msg % str(inquiry.id))
118 raise inquiry_exceptions.InvalidInquiryResponse(
119 str(inquiry.id), six.text_type(e)
120 )
121
122
123def respond(inquiry, response, requester=None):

Callers

nothing calls this directly

Calls 1

validateMethod · 0.45

Tested by

no test coverage detected