JSON schema validation example
Validate input with a JSON schema to verify that the JSON messages are properly formed.
In the example purchase order system, the company wants to use input validation to verify that
only properly formed purchase orders enter processing. They can use the following JSON schema in a
validation processing action.
{
"type": "object",
"properties": {
"name": { "type": "string" },
"sku": { "type": "string" },
"price": { "type": "number", "minimum": 0 },
"shipTo": {
"type": "object",
"properties": {
"name": { "type": "string" },
"address": { "type": "string" },
"city": { "type": "string" },
"state": { "type": "string" },
"zip": { "type": "string" }
}
},
"billTo": {
"type": "object",
"properties": {
"name": { "type": "string" },
"address": { "type": "string" },
"city": { "type": "string" },
"state": { "type": "string" },
"zip": { "type": "string" }
}
}
}
}