Skip to content

Commit 040926b

Browse files
committed
suppress format validation error
1 parent 6b492a0 commit 040926b

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

templates/webofthings/node.js.mustache

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ module.exports = function (RED) {
122122
try {
123123
msg.payload = JSON.parse(response.payload.toString());
124124
if (options.outschema) {
125-
const ajv = new Ajv({allErrors: true, strict: false});
125+
const ajv = new Ajv({allErrors: true, strict: false, validateFormats: false});
126126
if (!ajv.validate(options.outschema, msg.payload)) {
127127
node.warn(`output schema validation error: ${ajv.errorsText()}`, msg);
128128
}
@@ -175,7 +175,7 @@ module.exports = function (RED) {
175175
try {
176176
msg.payload = JSON.parse(chunk.toString());
177177
if (options.outschema) {
178-
const ajv = new Ajv({allErrors: true, strict: false});
178+
const ajv = new Ajv({allErrors: true, strict: false, validateFormats: false});
179179
if (!ajv.validate(options.outschema, msg.payload)) {
180180
node.warn(`output schema validation error: ${ajv.errorsText()}`, msg);
181181
}
@@ -262,7 +262,7 @@ module.exports = function (RED) {
262262
msg.payload = data;
263263
}
264264
if (options.outschema) {
265-
const ajv = new Ajv({allErrors: true, strict: false});
265+
const ajv = new Ajv({allErrors: true, strict: false, validateFormats: false});
266266
if (!ajv.validate(options.outschema, msg.payload)) {
267267
node.warn(`output schema validation error: ${ajv.errorsText()}`, msg);
268268
}
@@ -329,7 +329,7 @@ module.exports = function (RED) {
329329
}
330330
// TODO: validation of return value
331331
if (options.outschema) {
332-
const ajv = new Ajv({allErrors: true, strict: false});
332+
const ajv = new Ajv({allErrors: true, strict: false, validateFormats: false});
333333
if (!ajv.validate(options.outschema, msg.payload)) {
334334
node.warn(`output schema validation error: ${ajv.errorsText()}`, msg);
335335
}
@@ -417,7 +417,7 @@ module.exports = function (RED) {
417417
}
418418
// TODO: validation of return value
419419
if (options.outschema) {
420-
const ajv = new Ajv({allErrors: true, strict: false});
420+
const ajv = new Ajv({allErrors: true, strict: false, validateFormats: false});
421421
if (!ajv.validate(options.outschema, msg.payload)) {
422422
node.warn(`output schema validation error: ${ajv.errorsText()}`, msg);
423423
}
@@ -477,7 +477,7 @@ module.exports = function (RED) {
477477
const auth = makeauth(normTd, form, username, password, token);
478478
const urivars = prop.hasOwnProperty("uriVariables") ? msg.payload : {};
479479
if (prop.uriVariables) {
480-
const ajv = new Ajv({allErrors: true, strict: false});
480+
const ajv = new Ajv({allErrors: true, strict: false, validateFormats: false});
481481
if (!ajv.validate(prop.uriVariables, urivars)) {
482482
node.warn(`input schema validation error: ${ajv.errorsText()}`, msg);
483483
}
@@ -494,7 +494,7 @@ module.exports = function (RED) {
494494
const prop = normTd.properties[node.propname];
495495
const form = prop.forms[node.formindex];// formSelection("property-write", prop.forms);
496496
const auth = makeauth(normTd, form, username, password, token);
497-
const ajv = new Ajv({allErrors: true, strict: false});
497+
const ajv = new Ajv({allErrors: true, strict: false, validateFormats: false});
498498
if (!ajv.validate(prop, msg.payload)) {
499499
node.warn(`input schema validation error: ${ajv.errorsText()}`, msg);
500500
}
@@ -511,7 +511,7 @@ module.exports = function (RED) {
511511
const auth = makeauth(normTd, form, username, password, token);
512512
const urivars = prop.hasOwnProperty("uriVariables") ? msg.payload : {};
513513
if (prop.uriVariables) {
514-
const ajv = new Ajv({allErrors: true, strict: false});
514+
const ajv = new Ajv({allErrors: true, strict: false, validateFormats: false});
515515
if (!ajv.validate(prop.uriVariables, urivars)) {
516516
node.warn(`input schema validation error: ${ajv.errorsText()}`, msg);
517517
}
@@ -532,13 +532,13 @@ module.exports = function (RED) {
532532
const auth = makeauth(normTd, form, username, password, token);
533533
const urivars = act.hasOwnProperty("uriVariables") ? msg.payload : {};
534534
if (act.uriVariables) {
535-
const ajv = new Ajv({allErrors: true, strict: false});
535+
const ajv = new Ajv({allErrors: true, strict: false, validateFormats: false});
536536
if (!ajv.validate(act.uriVariables, urivars)) {
537537
node.warn(`input schema validation error: ${ajv.errorsText()}`, msg);
538538
}
539539
}
540540
if (act.input) {
541-
const ajv = new Ajv({allErrors: true, strict: false});
541+
const ajv = new Ajv({allErrors: true, strict: false, validateFormats: false});
542542
if (!ajv.validate(act.input, msg.payload)) {
543543
node.warn(`input schema validation error: ${ajv.errorsText()}`, msg);
544544
}
@@ -555,7 +555,7 @@ module.exports = function (RED) {
555555
const auth = makeauth(normTd, form, username, password, token);
556556
const urivars = ev.hasOwnProperty("uriVariables") ? msg.payload : {};
557557
if (ev.uriVariables) {
558-
const ajv = new Ajv({allErrors: true, strict: false});
558+
const ajv = new Ajv({allErrors: true, strict: false, validateFormats: false});
559559
if (!ajv.validate(ev.uriVariables, urivars)) {
560560
node.warn(`input schema validation error: ${ajv.errorsText()}`, msg);
561561
}

0 commit comments

Comments
 (0)