Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions templates/webofthings/node.js.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,8 @@ module.exports = function (RED) {
const urivars = prop.hasOwnProperty("uriVariables") ? msg.payload : {};
if (prop.uriVariables) {
const ajv = new Ajv({allErrors: true, strict: false, validateFormats: false});
if (!ajv.validate(prop.uriVariables, urivars)) {
const uvschema = { type: "object", properties: prop.uriVariables };
if (!ajv.validate(uvschema, urivars)) {
node.warn(`input schema validation error: ${ajv.errorsText()}`, msg);
}
}
Expand Down Expand Up @@ -512,7 +513,8 @@ module.exports = function (RED) {
const urivars = prop.hasOwnProperty("uriVariables") ? msg.payload : {};
if (prop.uriVariables) {
const ajv = new Ajv({allErrors: true, strict: false, validateFormats: false});
if (!ajv.validate(prop.uriVariables, urivars)) {
const uvschema = { type: "object", properties: prop.uriVariables };
if (!ajv.validate(uvschema, urivars)) {
node.warn(`input schema validation error: ${ajv.errorsText()}`, msg);
}
}
Expand All @@ -533,7 +535,8 @@ module.exports = function (RED) {
const urivars = act.hasOwnProperty("uriVariables") ? msg.payload : {};
if (act.uriVariables) {
const ajv = new Ajv({allErrors: true, strict: false, validateFormats: false});
if (!ajv.validate(act.uriVariables, urivars)) {
const uvschema = { type: "object", properties: act.uriVariables };
if (!ajv.validate(uvschema, urivars)) {
node.warn(`input schema validation error: ${ajv.errorsText()}`, msg);
}
}
Expand All @@ -556,7 +559,8 @@ module.exports = function (RED) {
const urivars = ev.hasOwnProperty("uriVariables") ? msg.payload : {};
if (ev.uriVariables) {
const ajv = new Ajv({allErrors: true, strict: false, validateFormats: false});
if (!ajv.validate(ev.uriVariables, urivars)) {
const uvschema = { type: "object", properties: ev.uriVariables };
if (!ajv.validate(uvschema, urivars)) {
node.warn(`input schema validation error: ${ajv.errorsText()}`, msg);
}
}
Expand Down
2 changes: 1 addition & 1 deletion templates/webofthings/package.json.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"https-proxy-agent": "5.0.0",
"request": "2.88.2",
"ws": "8.5.0",
"url-template": "3.0.0",
"url-template": "2.0.8",
"ajv": "8.10.0",
"coap": "1.0.3"
},
Expand Down