Validate
Summary
Validate that received events conform to the JSON schema specified in Settings -> Parameters.
For example, it is best practice to validate input before processing it. E.g. we can check that a HTTP request body is an object with the property foo
before accessing that property while processing by passing the received request through this function, with the corresponding JSON schema.
{
type: "object",
properties: {
body: {
type: "object",
properties: {
foo
}
}
}
}
Ports
Events passed to the in
port will be validated. If the passed event conform to the specified JSON schema, then it is routed to the out
port.
Input/Output Format
There is no assumptions made about the format of the received event.
For the most parts, events are passed through as-is.
Some options in Settings -> Parameters may result in the event being modified. Please consult the documentation of each setting.
Events
When a received event does not conform to the specified schema, this functions emitts a response
event, with the following object as argument.
{
status: 422,
body: validation_errors
}
422 refers to the 422 UNPROCESSABLE ENTITY HTTP status code.
Other
Other than emitting a response
event, events that do not conform to the specified schema are simply dropped.
Updated about 2 years ago