@sanity/validation 2.21.4 → 2.21.7
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/lib/index.js
CHANGED
|
@@ -9,12 +9,7 @@ Object.defineProperty(exports, "Rule", {
|
|
|
9
9
|
return _Rule.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _validateDocument.default;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
12
|
+
exports.default = void 0;
|
|
18
13
|
Object.defineProperty(exports, "inferFromSchema", {
|
|
19
14
|
enumerable: true,
|
|
20
15
|
get: function get() {
|
|
@@ -27,7 +22,12 @@ Object.defineProperty(exports, "inferFromSchemaType", {
|
|
|
27
22
|
return _inferFromSchemaType.default;
|
|
28
23
|
}
|
|
29
24
|
});
|
|
30
|
-
exports
|
|
25
|
+
Object.defineProperty(exports, "validateDocument", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _validateDocument.default;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
31
|
|
|
32
32
|
var _Rule = _interopRequireDefault(require("./Rule"));
|
|
33
33
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isNonNullable = isNonNullable;
|
|
7
6
|
exports.default = convertToValidationMarker;
|
|
7
|
+
exports.isNonNullable = isNonNullable;
|
|
8
8
|
|
|
9
9
|
var _ValidationError = _interopRequireDefault(require("../ValidationError"));
|
|
10
10
|
|
package/lib/validateDocument.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.resolveTypeForArrayItem = resolveTypeForArrayItem;
|
|
7
6
|
exports.default = validateDocument;
|
|
7
|
+
exports.resolveTypeForArrayItem = resolveTypeForArrayItem;
|
|
8
8
|
exports.validateItem = validateItem;
|
|
9
9
|
|
|
10
10
|
var _uniqBy2 = _interopRequireDefault(require("lodash/uniqBy"));
|
|
@@ -140,7 +140,10 @@ function _validateItem() {
|
|
|
140
140
|
var nestedChecks = [];
|
|
141
141
|
var selfIsRequired = rules.some(rule => rule.isRequired());
|
|
142
142
|
var shouldRunNestedObjectValidation = // run nested validation for objects
|
|
143
|
-
(type === null || type === void 0 ? void 0 : type.jsonType) === 'object' && (
|
|
143
|
+
(type === null || type === void 0 ? void 0 : type.jsonType) === 'object' && ( // if the value is truthy
|
|
144
|
+
!!value || // or
|
|
145
|
+
// (the value is null or undefined) and the top-level value is required
|
|
146
|
+
(value === null || value === undefined) && selfIsRequired);
|
|
144
147
|
|
|
145
148
|
if (shouldRunNestedObjectValidation) {
|
|
146
149
|
var fieldTypes = type.fields.reduce((acc, field) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/validation",
|
|
3
|
-
"version": "2.21.
|
|
3
|
+
"version": "2.21.7",
|
|
4
4
|
"description": "Validation and warning infrastructure for Sanity projects",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./dist/dts",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"directory": "packages/@sanity/validation"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@sanity/client": "2.21.
|
|
36
|
-
"@sanity/schema": "2.21.
|
|
35
|
+
"@sanity/client": "2.21.7",
|
|
36
|
+
"@sanity/schema": "2.21.5"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@sanity/client": "^2.0.0"
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@sanity/types": "2.21.
|
|
47
|
+
"@sanity/types": "2.21.7",
|
|
48
48
|
"date-fns": "^2.16.1",
|
|
49
49
|
"lodash": "^4.17.15"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "682dc95b41e56841ab63d7f95643aa2534069fb9"
|
|
52
52
|
}
|