@@ -54,7 +54,7 @@ graphql_object!(Root: () as "Root" |&self| {
54
54
field sample_scalar(
55
55
first: i64 as "The first number" ,
56
56
second = 123 : i64 as "The second number"
57
- ) -> FieldResult <Scalar > {
57
+ ) -> FieldResult <Scalar > as "A sample scalar field on the object" {
58
58
Ok ( Scalar ( first + second) )
59
59
}
60
60
} ) ;
@@ -251,6 +251,19 @@ fn object_introspection() {
251
251
description
252
252
args {
253
253
name
254
+ description
255
+ type {
256
+ name
257
+ kind
258
+ ofType {
259
+ name
260
+ kind
261
+ ofType {
262
+ name
263
+ }
264
+ }
265
+ }
266
+ defaultValue
254
267
}
255
268
type {
256
269
name
@@ -306,6 +319,8 @@ fn object_introspection() {
306
319
307
320
assert_eq ! ( fields. len( ) , 5 ) ; // The two fields, __typename, __type, __schema
308
321
322
+ println ! ( "Fields: {:#?}" , fields) ;
323
+
309
324
assert ! ( fields. contains( & Value :: object( vec![
310
325
( "name" , Value :: string( "sampleEnum" ) ) ,
311
326
( "description" , Value :: null( ) ) ,
@@ -321,6 +336,47 @@ fn object_introspection() {
321
336
( "isDeprecated" , Value :: boolean( false ) ) ,
322
337
( "deprecationReason" , Value :: null( ) ) ,
323
338
] . into_iter( ) . collect( ) ) ) ) ;
339
+
340
+ assert ! ( fields. contains( & Value :: object( vec![
341
+ ( "name" , Value :: string( "sampleScalar" ) ) ,
342
+ ( "description" , Value :: string( "A sample scalar field on the object" ) ) ,
343
+ ( "args" , Value :: list( vec![
344
+ Value :: object( vec![
345
+ ( "name" , Value :: string( "first" ) ) ,
346
+ ( "description" , Value :: string( "The first number" ) ) ,
347
+ ( "type" , Value :: object( vec![
348
+ ( "name" , Value :: null( ) ) ,
349
+ ( "kind" , Value :: string( "NON_NULL" ) ) ,
350
+ ( "ofType" , Value :: object( vec![
351
+ ( "name" , Value :: string( "Int" ) ) ,
352
+ ( "kind" , Value :: string( "SCALAR" ) ) ,
353
+ ( "ofType" , Value :: null( ) ) ,
354
+ ] . into_iter( ) . collect( ) ) ) ,
355
+ ] . into_iter( ) . collect( ) ) ) ,
356
+ ( "defaultValue" , Value :: null( ) ) ,
357
+ ] . into_iter( ) . collect( ) ) ,
358
+ Value :: object( vec![
359
+ ( "name" , Value :: string( "second" ) ) ,
360
+ ( "description" , Value :: string( "The second number" ) ) ,
361
+ ( "type" , Value :: object( vec![
362
+ ( "name" , Value :: string( "Int" ) ) ,
363
+ ( "kind" , Value :: string( "SCALAR" ) ) ,
364
+ ( "ofType" , Value :: null( ) ) ,
365
+ ] . into_iter( ) . collect( ) ) ) ,
366
+ ( "defaultValue" , Value :: string( "123" ) ) ,
367
+ ] . into_iter( ) . collect( ) ) ,
368
+ ] ) ) ,
369
+ ( "type" , Value :: object( vec![
370
+ ( "name" , Value :: null( ) ) ,
371
+ ( "kind" , Value :: string( "NON_NULL" ) ) ,
372
+ ( "ofType" , Value :: object( vec![
373
+ ( "name" , Value :: string( "SampleScalar" ) ) ,
374
+ ( "kind" , Value :: string( "SCALAR" ) ) ,
375
+ ] . into_iter( ) . collect( ) ) ) ,
376
+ ] . into_iter( ) . collect( ) ) ) ,
377
+ ( "isDeprecated" , Value :: boolean( false ) ) ,
378
+ ( "deprecationReason" , Value :: null( ) ) ,
379
+ ] . into_iter( ) . collect( ) ) ) ) ;
324
380
}
325
381
326
382
#[ test]
0 commit comments