@@ -266,16 +266,18 @@ extension GraphQLScalarType: Hashable {
266266 * )
267267 *
268268 * 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.
270270 *
271271 * Example:
272272 *
273273 * let PersonType = GraphQLObjectType(
274274 * name: "Person",
275- * fields: [
275+ * fields: {
276+ * [
276277 * "name": GraphQLField(type: GraphQLString),
277- * "bestFriend": GraphQLField(type: GraphQLTypeReference(" PersonType") ),
278+ * "bestFriend": GraphQLField(type: PersonType),
278279 * ]
280+ * }
279281 * )
280282 *
281283 */
@@ -1286,6 +1288,7 @@ public final class GraphQLList {
12861288 ofType = type
12871289 }
12881290
1291+ @available ( * , deprecated, message: " Just reference type directly. " )
12891292 public init ( _ name: String ) {
12901293 ofType = GraphQLTypeReference ( name)
12911294 }
@@ -1351,6 +1354,7 @@ public final class GraphQLNonNull {
13511354 ofType = type
13521355 }
13531356
1357+ @available ( * , deprecated, message: " Just reference type directly. " )
13541358 public init ( _ name: String ) {
13551359 ofType = GraphQLTypeReference ( name)
13561360 }
@@ -1392,6 +1396,7 @@ extension GraphQLNonNull: Hashable {
13921396 * A special type to allow object/interface/input types to reference itself. It's replaced with the real type
13931397 * object when the schema is built.
13941398 */
1399+ @available ( * , deprecated, message: " Use `fields` closure to lazily reference types. " )
13951400public final class GraphQLTypeReference : GraphQLType , GraphQLOutputType , GraphQLInputType ,
13961401 GraphQLNullableType , GraphQLNamedType
13971402{
0 commit comments