badmfck-api-server 3.0.9 → 3.1.0
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.
@@ -32,11 +32,13 @@ class Validator {
|
|
32
32
|
if (i.startsWith("$__"))
|
33
33
|
continue;
|
34
34
|
let type = typeof structure[i];
|
35
|
-
let description = structure[
|
35
|
+
let description = structure['$__' + i] || "";
|
36
36
|
let childs = undefined;
|
37
|
-
let optional = structure[
|
37
|
+
let optional = structure['$__optional_' + i] || "";
|
38
38
|
if (optional === undefined)
|
39
39
|
optional = structure[i] === null || structure[i] === undefined;
|
40
|
+
if (type === "object" && Array.isArray(structure[i]))
|
41
|
+
type = "array";
|
40
42
|
if (typeof structure[i] === "object")
|
41
43
|
childs = this.documentStructure(structure[i]);
|
42
44
|
if (structure[i] === "@")
|
@@ -81,7 +83,7 @@ class Validator {
|
|
81
83
|
foundKeys.push(i);
|
82
84
|
continue;
|
83
85
|
}
|
84
|
-
let optional = structure[
|
86
|
+
let optional = structure['$__optional_' + i] || false;
|
85
87
|
if (!(i in object)) {
|
86
88
|
if (!optional)
|
87
89
|
errors.push("no field '" + i + "'");
|