@@ -266,16 +266,18 @@ extension GraphQLScalarType: Hashable {
266
266
* )
267
267
*
268
268
* When two types need to refer to each other, or a type needs to refer to
269
- * itself in a field, you can wrap it in a GraphQLTypeReference to supply the fields lazily.
269
+ * itself in a field, you can use a closure to supply the fields lazily.
270
270
*
271
271
* Example:
272
272
*
273
273
* let PersonType = GraphQLObjectType(
274
274
* name: "Person",
275
- * fields: [
275
+ * fields: {
276
+ * [
276
277
* "name": GraphQLField(type: GraphQLString),
277
- * "bestFriend": GraphQLField(type: GraphQLTypeReference(" PersonType") ),
278
+ * "bestFriend": GraphQLField(type: PersonType),
278
279
* ]
280
+ * }
279
281
* )
280
282
*
281
283
*/
@@ -1286,6 +1288,7 @@ public final class GraphQLList {
1286
1288
ofType = type
1287
1289
}
1288
1290
1291
+ @available ( * , deprecated, message: " Just reference type directly. " )
1289
1292
public init ( _ name: String ) {
1290
1293
ofType = GraphQLTypeReference ( name)
1291
1294
}
@@ -1351,6 +1354,7 @@ public final class GraphQLNonNull {
1351
1354
ofType = type
1352
1355
}
1353
1356
1357
+ @available ( * , deprecated, message: " Just reference type directly. " )
1354
1358
public init ( _ name: String ) {
1355
1359
ofType = GraphQLTypeReference ( name)
1356
1360
}
@@ -1392,6 +1396,7 @@ extension GraphQLNonNull: Hashable {
1392
1396
* A special type to allow object/interface/input types to reference itself. It's replaced with the real type
1393
1397
* object when the schema is built.
1394
1398
*/
1399
+ @available ( * , deprecated, message: " Use `fields` closure to lazily reference types. " )
1395
1400
public final class GraphQLTypeReference : GraphQLType , GraphQLOutputType , GraphQLInputType ,
1396
1401
GraphQLNullableType , GraphQLNamedType
1397
1402
{
0 commit comments