@@ -1509,3 +1509,82 @@ function g.test_specifiedBy_directive()
1509
1509
t .assert_equals (data , { test_A = { url = " http://localhost" , value = " 1" } })
1510
1510
t .assert_equals (errors , nil )
1511
1511
end
1512
+
1513
+ function g .test_descriptions ()
1514
+ local function callback (_ , _ )
1515
+ return nil
1516
+ end
1517
+
1518
+ local query_schema = {
1519
+ [' test_query' ] = {
1520
+ kind = types .string .nonNull ,
1521
+ arguments = {
1522
+ arg = types .string ,
1523
+ arg_described = {
1524
+ kind = types .object ({
1525
+ name = ' test_object' ,
1526
+ fields = {
1527
+ object_arg_described = {
1528
+ kind = types .string ,
1529
+ description = ' object argument'
1530
+ },
1531
+ object_arg = types .string ,
1532
+ },
1533
+ kind = types .string ,
1534
+ }),
1535
+ description = ' described query argument' ,
1536
+ }
1537
+ },
1538
+ resolve = callback ,
1539
+ description = ' test query' ,
1540
+ }
1541
+ }
1542
+
1543
+ local mutation_schema = {
1544
+ [' test_mutation' ] = {
1545
+ kind = types .string .nonNull ,
1546
+ arguments = {
1547
+ mutation_arg = types .string ,
1548
+ mutation_arg_described = {
1549
+ kind = types .inputObject ({
1550
+ name = ' test_input_object' ,
1551
+ fields = {
1552
+ input_object_arg_described = {
1553
+ kind = types .string ,
1554
+ description = ' input object argument'
1555
+ },
1556
+ input_object_arg = types .string ,
1557
+ },
1558
+ kind = types .string ,
1559
+ }),
1560
+ description = ' described mutation argument' ,
1561
+ },
1562
+ },
1563
+ resolve = callback ,
1564
+ description = ' test mutation' ,
1565
+ }
1566
+ }
1567
+
1568
+ local data , errors = check_request (introspection .query , query_schema , mutation_schema )
1569
+ t .assert_equals (errors , nil )
1570
+
1571
+ local test_query = util .find_by_name (data .__schema .types , ' Query' )
1572
+ t .assert_equals (test_query .fields [1 ].description , ' test query' )
1573
+
1574
+ local arg_described = util .find_by_name (test_query .fields [1 ].args , ' arg_described' )
1575
+ t .assert_equals (arg_described .description , ' described query argument' )
1576
+
1577
+ local test_object = util .find_by_name (data .__schema .types , ' test_object' )
1578
+ local object_arg_described = util .find_by_name (test_object .fields , ' object_arg_described' )
1579
+ t .assert_equals (object_arg_described .description , ' object argument' )
1580
+
1581
+ local test_mutation = util .find_by_name (data .__schema .types , ' Mutation' )
1582
+ t .assert_equals (test_mutation .fields [1 ].description , ' test mutation' )
1583
+
1584
+ local mutation_arg_described = util .find_by_name (test_mutation .fields [1 ].args , ' mutation_arg_described' )
1585
+ t .assert_equals (mutation_arg_described .description , ' described mutation argument' )
1586
+
1587
+ local test_input_object = util .find_by_name (data .__schema .types , ' test_input_object' )
1588
+ local input_object_arg_described = util .find_by_name (test_input_object .inputFields , ' input_object_arg_described' )
1589
+ t .assert_equals (input_object_arg_described .description , ' input object argument' )
1590
+ end
0 commit comments