@@ -193,13 +193,12 @@ func GetNamed(ttype Type) Named {
193
193
//
194
194
// Example:
195
195
//
196
- // var OddType = new Scalar({
197
- // name: 'Odd',
198
- // serialize(value) {
199
- // return value % 2 === 1 ? value : null;
200
- // }
201
- // });
202
- //
196
+ // var OddType = new Scalar({
197
+ // name: 'Odd',
198
+ // serialize(value) {
199
+ // return value % 2 === 1 ? value : null;
200
+ // }
201
+ // });
203
202
type Scalar struct {
204
203
PrivateName string `json:"name"`
205
204
PrivateDescription string `json:"description"`
@@ -306,33 +305,33 @@ func (st *Scalar) Error() error {
306
305
// have a name, but most importantly describe their fields.
307
306
// Example:
308
307
//
309
- // var AddressType = new Object({
310
- // name: 'Address',
311
- // fields: {
312
- // street: { type: String },
313
- // number: { type: Int },
314
- // formatted: {
315
- // type: String,
316
- // resolve(obj) {
317
- // return obj.number + ' ' + obj.street
318
- // }
319
- // }
320
- // }
321
- // });
308
+ // var AddressType = new Object({
309
+ // name: 'Address',
310
+ // fields: {
311
+ // street: { type: String },
312
+ // number: { type: Int },
313
+ // formatted: {
314
+ // type: String,
315
+ // resolve(obj) {
316
+ // return obj.number + ' ' + obj.street
317
+ // }
318
+ // }
319
+ // }
320
+ // });
322
321
//
323
322
// When two types need to refer to each other, or a type needs to refer to
324
323
// itself in a field, you can use a function expression (aka a closure or a
325
324
// thunk) to supply the fields lazily.
326
325
//
327
326
// Example:
328
327
//
329
- // var PersonType = new Object({
330
- // name: 'Person',
331
- // fields: () => ({
332
- // name: { type: String },
333
- // bestFriend: { type: PersonType },
334
- // })
335
- // });
328
+ // var PersonType = new Object({
329
+ // name: 'Person',
330
+ // fields: () => ({
331
+ // name: { type: String },
332
+ // bestFriend: { type: PersonType },
333
+ // })
334
+ // });
336
335
//
337
336
// /
338
337
type Object struct {
@@ -668,14 +667,12 @@ func (st *Argument) Error() error {
668
667
//
669
668
// Example:
670
669
//
671
- // var EntityType = new Interface({
672
- // name: 'Entity',
673
- // fields: {
674
- // name: { type: String }
675
- // }
676
- // });
677
- //
678
- //
670
+ // var EntityType = new Interface({
671
+ // name: 'Entity',
672
+ // fields: {
673
+ // name: { type: String }
674
+ // }
675
+ // });
679
676
type Interface struct {
680
677
PrivateName string `json:"name"`
681
678
PrivateDescription string `json:"description"`
@@ -779,18 +776,18 @@ func (it *Interface) Error() error {
779
776
//
780
777
// Example:
781
778
//
782
- // var PetType = new Union({
783
- // name: 'Pet',
784
- // types: [ DogType, CatType ],
785
- // resolveType(value) {
786
- // if (value instanceof Dog) {
787
- // return DogType;
788
- // }
789
- // if (value instanceof Cat) {
790
- // return CatType;
791
- // }
792
- // }
793
- // });
779
+ // var PetType = new Union({
780
+ // name: 'Pet',
781
+ // types: [ DogType, CatType ],
782
+ // resolveType(value) {
783
+ // if (value instanceof Dog) {
784
+ // return DogType;
785
+ // }
786
+ // if (value instanceof Cat) {
787
+ // return CatType;
788
+ // }
789
+ // }
790
+ // });
794
791
type Union struct {
795
792
PrivateName string `json:"name"`
796
793
PrivateDescription string `json:"description"`
@@ -1085,18 +1082,18 @@ func (gt *Enum) getNameLookup() map[string]*EnumValueDefinition {
1085
1082
// An input object defines a structured collection of fields which may be
1086
1083
// supplied to a field argument.
1087
1084
//
1088
- // Using `NonNull` will ensure that a value must be provided by the query
1085
+ // # Using `NonNull` will ensure that a value must be provided by the query
1089
1086
//
1090
1087
// Example:
1091
1088
//
1092
- // var GeoPoint = new InputObject({
1093
- // name: 'GeoPoint',
1094
- // fields: {
1095
- // lat: { type: new NonNull(Float) },
1096
- // lon: { type: new NonNull(Float) },
1097
- // alt: { type: Float, defaultValue: 0 },
1098
- // }
1099
- // });
1089
+ // var GeoPoint = new InputObject({
1090
+ // name: 'GeoPoint',
1091
+ // fields: {
1092
+ // lat: { type: new NonNull(Float) },
1093
+ // lon: { type: new NonNull(Float) },
1094
+ // alt: { type: Float, defaultValue: 0 },
1095
+ // }
1096
+ // });
1100
1097
type InputObject struct {
1101
1098
PrivateName string `json:"name"`
1102
1099
PrivateDescription string `json:"description"`
@@ -1235,14 +1232,13 @@ func (gt *InputObject) Error() error {
1235
1232
//
1236
1233
// Example:
1237
1234
//
1238
- // var PersonType = new Object({
1239
- // name: 'Person',
1240
- // fields: () => ({
1241
- // parents: { type: new List(Person) },
1242
- // children: { type: new List(Person) },
1243
- // })
1244
- // })
1245
- //
1235
+ // var PersonType = new Object({
1236
+ // name: 'Person',
1237
+ // fields: () => ({
1238
+ // parents: { type: new List(Person) },
1239
+ // children: { type: new List(Person) },
1240
+ // })
1241
+ // })
1246
1242
type List struct {
1247
1243
OfType Type `json:"ofType"`
1248
1244
@@ -1261,14 +1257,14 @@ func NewList(ofType Type) *List {
1261
1257
return gl
1262
1258
}
1263
1259
func (gl * List ) Name () string {
1264
- return fmt .Sprintf ("%v " , gl .OfType )
1260
+ return fmt .Sprintf ("[%v] " , gl .OfType )
1265
1261
}
1266
1262
func (gl * List ) Description () string {
1267
1263
return ""
1268
1264
}
1269
1265
func (gl * List ) String () string {
1270
1266
if gl .OfType != nil {
1271
- return fmt . Sprintf ( "[%v]" , gl .OfType )
1267
+ return gl .Name ( )
1272
1268
}
1273
1269
return ""
1274
1270
}
@@ -1286,12 +1282,12 @@ func (gl *List) Error() error {
1286
1282
//
1287
1283
// Example:
1288
1284
//
1289
- // var RowType = new Object({
1290
- // name: 'Row',
1291
- // fields: () => ({
1292
- // id: { type: new NonNull(String) },
1293
- // })
1294
- // })
1285
+ // var RowType = new Object({
1286
+ // name: 'Row',
1287
+ // fields: () => ({
1288
+ // id: { type: new NonNull(String) },
1289
+ // })
1290
+ // })
1295
1291
//
1296
1292
// Note: the enforcement of non-nullability occurs within the executor.
1297
1293
type NonNull struct {
0 commit comments