@sanity/schema 5.10.0-next.22 → 5.10.0-next.24

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 CHANGED
@@ -1369,7 +1369,19 @@ var array = (typeDef, visitorContext) => {
1369
1369
  )
1370
1370
  ), {
1371
1371
  ...typeDef,
1372
- of: of.map(visitorContext.visit),
1372
+ of: of.map((ofMember, index) => {
1373
+ const visited = visitorContext.visit(ofMember, index);
1374
+ return ofMember.type && typeof ofMember.type == "string" && visitorContext.getType(ofMember.type)?.type === "document" ? {
1375
+ ...visited,
1376
+ _problems: [
1377
+ ...visited._problems || [],
1378
+ warning(
1379
+ `The type "${ofMember.type}" is a document type and should not be used as a field type directly. Use a "reference" if you want to create a link to the document, or use "object" if you want to embed fields inline.`,
1380
+ HELP_IDS.FIELD_TYPE_IS_DOCUMENT
1381
+ )
1382
+ ]
1383
+ } : visited;
1384
+ }),
1373
1385
  _problems: problems
1374
1386
  };
1375
1387
  };