#%RAML 1.0
title: multi-validation
types:
dateValidation:
type: object
properties:
information:
type: array
items:
properties:
date1:
type: date-only
/testing:
post:
body:
application/json:
type: dateValidation
responses:
200:
body:
application/json:
example: {"test":"response"}
{
"information": [
{
"date1": "20193-10-10"
}
]
}
{
"code": "REQUEST_VALIDATION_ERROR",
"message": "Invalid schema for content type application/json. Errors: /information/0/date1 [20193-10-10] is not a valid date. Expected [yyyy-MM-dd]. "
}
{
"information": [
{
"date1": "20193-10-10"
},
{
"date1": "20192-10-10"
}
]
}
{
"code": "REQUEST_VALIDATION_ERROR",
"message": "Invalid schema for content type application/json. Errors: /information/1/date1 [20192-10-10] is not a valid date. Expected [yyyy-MM-dd]. /information/0/date1 [20193-10-10] is not a valid date. Expected [yyyy-MM-dd]. "
}
[{
"code": "REQUEST_VALIDATION_ERROR",
"message": "/information/1/date1 [20192-10-10] is not a valid date.
},
{
"code": "REQUEST_VALIDATION_ERROR",
"message": "/information/0/date1 [20193-10-10] is not a valid date."
}]
%dw 2.0
output application/json
---
{message: "Bad request"}
This is the component that will be triggered when a data validation error is thrown in your Mule application. The APIKit router will validate your request payload against your RAML specification, and if it fails data validation, it will throw an APIKIT:BAD_REQUEST and route to this error handler.%dw 2.0
output application/json
---
{
"code":"REQUEST_VALIDATION_ERROR",
"message":error.description
}
%dw 2.0
output application/json
var splitload = error.description splitBy("\n")
---
[
splitload map (value, key) -> {
"code": "REQUEST_VALIDATION_ERROR",
"message": value
}
]
[{
"code": "REQUEST_VALIDATION_ERROR",
"message": "/information/1/date1 [20192-10-10] is not a valid date.
},
{
"code": "REQUEST_VALIDATION_ERROR",
"message": "/information/0/date1 [20193-10-10] is not a valid date."
}]001115709

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.