@aeriajs/validation 0.0.128 → 0.0.130
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.
- package/dist/validate.js +8 -2
- package/dist/validate.mjs +10 -2
- package/package.json +3 -3
package/dist/validate.js
CHANGED
|
@@ -39,7 +39,7 @@ const makeValidationError = (error) => {
|
|
|
39
39
|
exports.makeValidationError = makeValidationError;
|
|
40
40
|
const validateProperty = (what, property, options = {}) => {
|
|
41
41
|
if (!property) {
|
|
42
|
-
if (options.parentProperty && 'additionalProperties' in options.parentProperty
|
|
42
|
+
if (options.parentProperty && 'additionalProperties' in options.parentProperty) {
|
|
43
43
|
if (options.parentProperty.additionalProperties === true) {
|
|
44
44
|
return types_1.Result.result(what);
|
|
45
45
|
}
|
|
@@ -121,7 +121,13 @@ const validateProperty = (what, property, options = {}) => {
|
|
|
121
121
|
break;
|
|
122
122
|
}
|
|
123
123
|
case 'object': {
|
|
124
|
-
|
|
124
|
+
if ('properties' in property) {
|
|
125
|
+
return (0, exports.validate)(what, property, options);
|
|
126
|
+
}
|
|
127
|
+
switch (typeof property.additionalProperties) {
|
|
128
|
+
case 'object': return (0, exports.validate)(what, property.additionalProperties, options);
|
|
129
|
+
case 'boolean': return types_1.Result.result(what);
|
|
130
|
+
}
|
|
125
131
|
}
|
|
126
132
|
case 'array': {
|
|
127
133
|
if (!Array.isArray(what)) {
|
package/dist/validate.mjs
CHANGED
|
@@ -34,7 +34,7 @@ export const makeValidationError = (error) => {
|
|
|
34
34
|
};
|
|
35
35
|
export const validateProperty = (what, property, options = {}) => {
|
|
36
36
|
if (!property) {
|
|
37
|
-
if (options.parentProperty && "additionalProperties" in options.parentProperty
|
|
37
|
+
if (options.parentProperty && "additionalProperties" in options.parentProperty) {
|
|
38
38
|
if (options.parentProperty.additionalProperties === true) {
|
|
39
39
|
return Result.result(what);
|
|
40
40
|
}
|
|
@@ -110,7 +110,15 @@ export const validateProperty = (what, property, options = {}) => {
|
|
|
110
110
|
break;
|
|
111
111
|
}
|
|
112
112
|
case "object": {
|
|
113
|
-
|
|
113
|
+
if ("properties" in property) {
|
|
114
|
+
return validate(what, property, options);
|
|
115
|
+
}
|
|
116
|
+
switch (typeof property.additionalProperties) {
|
|
117
|
+
case "object":
|
|
118
|
+
return validate(what, property.additionalProperties, options);
|
|
119
|
+
case "boolean":
|
|
120
|
+
return Result.result(what);
|
|
121
|
+
}
|
|
114
122
|
}
|
|
115
123
|
case "array": {
|
|
116
124
|
if (!Array.isArray(what)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/validation",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.130",
|
|
4
4
|
"description": "## Installation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@aeriajs/types": "link:../types"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@aeriajs/common": "^0.0.
|
|
30
|
-
"@aeriajs/types": "^0.0.
|
|
29
|
+
"@aeriajs/common": "^0.0.122",
|
|
30
|
+
"@aeriajs/types": "^0.0.104",
|
|
31
31
|
"mongodb": "^6.5.0"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|