@sanity/schema 5.21.0-next.13 → 5.21.0-next.15
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/_internal.js +3 -3
- package/lib/_internal.js.map +1 -1
- package/package.json +6 -6
package/lib/_internal.js
CHANGED
|
@@ -2827,7 +2827,7 @@ function extractSchema(schemaDef, extractOptions = {}) {
|
|
|
2827
2827
|
let typeName;
|
|
2828
2828
|
if (schemaType.type ? typeName = schemaType.type.name : "jsonType" in schemaType && (typeName = schemaType.jsonType), typeName === "document" && isObjectType(schemaType)) {
|
|
2829
2829
|
const defaultAttributes = documentDefaultFields(schemaType.name), object2 = createObject(schemaType);
|
|
2830
|
-
return
|
|
2830
|
+
return {
|
|
2831
2831
|
name: schemaType.name,
|
|
2832
2832
|
type: "document",
|
|
2833
2833
|
attributes: {
|
|
@@ -2906,7 +2906,7 @@ function extractSchema(schemaDef, extractOptions = {}) {
|
|
|
2906
2906
|
optional
|
|
2907
2907
|
};
|
|
2908
2908
|
}
|
|
2909
|
-
return extractOptions.enforceRequiredFields && hasAssetRequired(schemaType.validation) && attributes.asset && (attributes.asset.optional = !1),
|
|
2909
|
+
return extractOptions.enforceRequiredFields && hasAssetRequired(schemaType.validation) && attributes.asset && (attributes.asset.optional = !1), schemaType.type?.name !== "document" && schemaType.name !== "object" && (attributes._type = {
|
|
2910
2910
|
type: "objectAttribute",
|
|
2911
2911
|
value: {
|
|
2912
2912
|
type: "string",
|
|
@@ -2915,7 +2915,7 @@ function extractSchema(schemaDef, extractOptions = {}) {
|
|
|
2915
2915
|
}), {
|
|
2916
2916
|
type: "object",
|
|
2917
2917
|
attributes
|
|
2918
|
-
}
|
|
2918
|
+
};
|
|
2919
2919
|
}
|
|
2920
2920
|
function createArray(arraySchemaType) {
|
|
2921
2921
|
const of = [];
|