@aeriajs/validation 0.0.129 → 0.0.131
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 +5 -2
- package/dist/validate.mjs +7 -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
|
}
|
|
@@ -124,7 +124,10 @@ const validateProperty = (what, property, options = {}) => {
|
|
|
124
124
|
if ('properties' in property) {
|
|
125
125
|
return (0, exports.validate)(what, property, options);
|
|
126
126
|
}
|
|
127
|
-
|
|
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
|
+
}
|
|
128
131
|
}
|
|
129
132
|
case 'array': {
|
|
130
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
|
}
|
|
@@ -113,7 +113,12 @@ export const validateProperty = (what, property, options = {}) => {
|
|
|
113
113
|
if ("properties" in property) {
|
|
114
114
|
return validate(what, property, options);
|
|
115
115
|
}
|
|
116
|
-
|
|
116
|
+
switch (typeof property.additionalProperties) {
|
|
117
|
+
case "object":
|
|
118
|
+
return validate(what, property.additionalProperties, options);
|
|
119
|
+
case "boolean":
|
|
120
|
+
return Result.result(what);
|
|
121
|
+
}
|
|
117
122
|
}
|
|
118
123
|
case "array": {
|
|
119
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.131",
|
|
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.123",
|
|
30
|
+
"@aeriajs/types": "^0.0.105",
|
|
31
31
|
"mongodb": "^6.5.0"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|