@sanity/schema 5.10.0-next.19 → 5.10.0-next.23

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.
@@ -58,15 +58,15 @@ declare const builtinTypes: ({
58
58
  type: string;
59
59
  title: string;
60
60
  readOnly: boolean;
61
- hidden?: undefined;
62
61
  fieldset?: undefined;
62
+ hidden?: undefined;
63
63
  } | {
64
64
  name: string;
65
65
  type: string;
66
66
  title: string;
67
67
  readOnly?: undefined;
68
- hidden?: undefined;
69
68
  fieldset?: undefined;
69
+ hidden?: undefined;
70
70
  } | {
71
71
  name: string;
72
72
  type: string;
@@ -125,15 +125,15 @@ declare const builtinTypes: ({
125
125
  type: string;
126
126
  title: string;
127
127
  readOnly: boolean;
128
- hidden?: undefined;
129
128
  fieldset?: undefined;
129
+ hidden?: undefined;
130
130
  } | {
131
131
  name: string;
132
132
  type: string;
133
133
  title: string;
134
134
  readOnly?: undefined;
135
- hidden?: undefined;
136
135
  fieldset?: undefined;
136
+ hidden?: undefined;
137
137
  } | {
138
138
  name: string;
139
139
  type: string;
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
  };