diff --git a/models/Checkjson.js b/models/Checkjson.js index 544aa48..8bca908 100755 --- a/models/Checkjson.js +++ b/models/Checkjson.js @@ -20,9 +20,9 @@ Checkjson.schema.properties.type.integer = (n) => Checkjson.schema.properties.type.float = (n) => n != "" && !isNaN(n) && Math.round(n) != n; //not yet in json schema Checkjson.schema.properties.minLength = (str, min) => - typeof str === "string" && str.length > parseInt(min); + typeof str === "string" && str.length >= parseInt(min); Checkjson.schema.properties.maxLength = (str, max) => - typeof str === "string" && str.length < parseInt(max); + typeof str === "string" && str.length <= parseInt(max); Checkjson.schema.properties.multipleOf = (n, val) => typeof n === "number" && typeof val === "number" && @@ -93,6 +93,7 @@ Checkjson.schema.properties.format = { /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, "idn-email": / /, uuid: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, + url:/^(?:(?:https?|ftp):\/\/)(?:\w+(?::\w+)?@)?(?:(?:[a-z0-9-\.]+\.[a-z]{2,})(?:[-a-z0-9+\._\%\!\\[\]\(\)\,\*\?\&\=\:]*){1,})|(?:(?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?))(?:[:\/#][^#]*)?)$/, uri: / /, "uri-reference": / /, iri: / /,