badmfck-api-server 4.0.2 → 4.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -93,7 +93,7 @@ async function Initializer(services) {
93
93
  }
94
94
  exports.Initializer = Initializer;
95
95
  class APIService extends BaseService_1.BaseService {
96
- version = "4.0.1";
96
+ version = "4.0.2";
97
97
  options;
98
98
  monitor = null;
99
99
  started = new Date();
@@ -270,6 +270,13 @@ class Validator {
270
270
  if (object[i] > structureOptions.max)
271
271
  errors.push("value for field '" + parentPath + i + "' is too big, expected less than " + structureOptions.max + " got: " + object[i]);
272
272
  }
273
+ if (typeof structure[i] === "string" && !structureOptions.optional) {
274
+ let min = structureOptions.min || 1;
275
+ if (isNaN(min) || min < 1)
276
+ min = 1;
277
+ if (object[i].toString().trim().length < min)
278
+ errors.push("empty value for field '" + parentPath + i + "'");
279
+ }
273
280
  if (typeof object[i] === "string" && structureOptions.min && !isNaN(structureOptions.min)) {
274
281
  if (object[i].length < structureOptions.min)
275
282
  errors.push("value length for field '" + parentPath + i + "' is too small, expected more than " + structureOptions.min + " got: " + object[i].length);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",