JSON Schema validator for Node Red
npm install node-red-contrib-full-msg-json-schema-validationJSON Schema:
{
"title": "Person",
"type": "object",
"required":["lastName"],
"properties": {
"firstName": {
"type": "string",
"description": "The person's first name."
},
"lastName": {
"type": "string",
"description": "The person's last name."
},
"age": {
"description": "Age in years which must be equal to or greater than zero.",
"type": "integer",
"minimum": 0
}
}
}
Examples:
- OK
msg.payload=
{
"firstName": "John",
"lastName": "Doe",
"age": 1
};
- KO
msg.payload=
{
"firstName": "John",
"age": 1
};