@sanity/schema 6.9.2-next.9 → 6.9.2
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/Schema-BckCkziq.js.map +1 -1
- package/lib/_internal.js +3 -8
- package/lib/_internal.js.map +1 -1
- package/package.json +6 -6
package/lib/_internal.js
CHANGED
|
@@ -389,10 +389,7 @@ function maybeValidations(obj) {
|
|
|
389
389
|
case "reference":
|
|
390
390
|
impliedRules.push({ type: "reference" });
|
|
391
391
|
break;
|
|
392
|
-
case "email":
|
|
393
|
-
impliedRules.push({ type: "email" });
|
|
394
|
-
break;
|
|
395
|
-
default:
|
|
392
|
+
case "email": impliedRules.push({ type: "email" });
|
|
396
393
|
}
|
|
397
394
|
if (!("validation" in obj) || !obj.validation) return impliedRules.length > 0 ? [{
|
|
398
395
|
level: "error",
|
|
@@ -1833,8 +1830,8 @@ function validateTypeName(typeName, visitorContext) {
|
|
|
1833
1830
|
if (!typeName) return [error("Type is missing a type.", HELP_IDS.TYPE_MISSING_TYPE)];
|
|
1834
1831
|
if (typeof typeName != "string") return [error("Type has an invalid \"type\"-property - should be a string.", HELP_IDS.TYPE_MISSING_TYPE)];
|
|
1835
1832
|
if (!possibleTypeNames.includes(typeName)) {
|
|
1836
|
-
let suggestions = possibleTypeNames.map((possibleTypeName) => [leven(typeName, possibleTypeName), possibleTypeName]).filter(([distance]) => distance < 3).map(([_, name]) => name);
|
|
1837
|
-
return [error(`Unknown type: ${typeName}.${
|
|
1833
|
+
let suggestions = possibleTypeNames.map((possibleTypeName) => [leven(typeName, possibleTypeName), possibleTypeName]).filter(([distance]) => distance < 3).map(([_, name]) => name), suggestion = suggestions.length > 0 ? ` Did you mean ${humanizeList(suggestions.map(quote), { conjunction: "or" })}?` : "";
|
|
1834
|
+
return [error(`Unknown type: ${typeName}.${suggestion}`)];
|
|
1838
1835
|
}
|
|
1839
1836
|
return [];
|
|
1840
1837
|
}
|
|
@@ -2211,8 +2208,6 @@ function applyRuleSpec(rule, ruleSpec) {
|
|
|
2211
2208
|
case "media":
|
|
2212
2209
|
if (constraint === void 0) return rule.media(() => !0);
|
|
2213
2210
|
if (typeof constraint == "function") return rule.media(constraint);
|
|
2214
|
-
break;
|
|
2215
|
-
default: break;
|
|
2216
2211
|
}
|
|
2217
2212
|
return rule;
|
|
2218
2213
|
}
|