1+ use std:: { borrow:: Borrow , cell:: RefCell , collections:: HashMap , fmt:: Debug , hash:: Hash } ;
2+
13use crate :: {
24 ast:: { Arguments , Definition , Document , Field , Fragment , FragmentSpread , Selection , Type } ,
35 parser:: { SourcePosition , Spanning } ,
46 schema:: meta:: { Field as FieldType , MetaType } ,
57 validation:: { ValidatorContext , Visitor } ,
68 value:: ScalarValue ,
79} ;
8- use std:: { borrow:: Borrow , cell:: RefCell , collections:: HashMap , fmt:: Debug , hash:: Hash } ;
910
1011#[ derive( Debug ) ]
1112struct Conflict ( ConflictReason , Vec < SourcePosition > , Vec < SourcePosition > ) ;
@@ -741,7 +742,7 @@ mod tests {
741742 executor:: Registry ,
742743 schema:: meta:: MetaType ,
743744 types:: {
744- base:: GraphQLType ,
745+ base:: { GraphQLType , GraphQLValue } ,
745746 scalars:: { EmptyMutation , EmptySubscription , ID } ,
746747 } ,
747748 } ;
@@ -1380,9 +1381,6 @@ mod tests {
13801381 where
13811382 S : ScalarValue ,
13821383 {
1383- type Context = ( ) ;
1384- type TypeInfo = ( ) ;
1385-
13861384 fn name ( _: & ( ) ) -> Option < & ' static str > {
13871385 Some ( "SomeBox" )
13881386 }
@@ -1401,13 +1399,22 @@ mod tests {
14011399 }
14021400 }
14031401
1404- impl < S > GraphQLType < S > for StringBox
1402+ impl < S > GraphQLValue < S > for SomeBox
14051403 where
14061404 S : ScalarValue ,
14071405 {
14081406 type Context = ( ) ;
14091407 type TypeInfo = ( ) ;
14101408
1409+ fn type_name < ' i > ( & self , info : & ' i Self :: TypeInfo ) -> Option < & ' i str > {
1410+ <Self as GraphQLType >:: name ( info)
1411+ }
1412+ }
1413+
1414+ impl < S > GraphQLType < S > for StringBox
1415+ where
1416+ S : ScalarValue ,
1417+ {
14111418 fn name ( _: & ( ) ) -> Option < & ' static str > {
14121419 Some ( "StringBox" )
14131420 }
@@ -1432,13 +1439,22 @@ mod tests {
14321439 }
14331440 }
14341441
1435- impl < S > GraphQLType < S > for IntBox
1442+ impl < S > GraphQLValue < S > for StringBox
14361443 where
14371444 S : ScalarValue ,
14381445 {
14391446 type Context = ( ) ;
14401447 type TypeInfo = ( ) ;
14411448
1449+ fn type_name < ' i > ( & self , info : & ' i Self :: TypeInfo ) -> Option < & ' i str > {
1450+ <Self as GraphQLType >:: name ( info)
1451+ }
1452+ }
1453+
1454+ impl < S > GraphQLType < S > for IntBox
1455+ where
1456+ S : ScalarValue ,
1457+ {
14421458 fn name ( _: & ( ) ) -> Option < & ' static str > {
14431459 Some ( "IntBox" )
14441460 }
@@ -1463,13 +1479,22 @@ mod tests {
14631479 }
14641480 }
14651481
1466- impl < S > GraphQLType < S > for NonNullStringBox1
1482+ impl < S > GraphQLValue < S > for IntBox
14671483 where
14681484 S : ScalarValue ,
14691485 {
14701486 type Context = ( ) ;
14711487 type TypeInfo = ( ) ;
14721488
1489+ fn type_name < ' i > ( & self , info : & ' i Self :: TypeInfo ) -> Option < & ' i str > {
1490+ <Self as GraphQLType >:: name ( info)
1491+ }
1492+ }
1493+
1494+ impl < S > GraphQLType < S > for NonNullStringBox1
1495+ where
1496+ S : ScalarValue ,
1497+ {
14731498 fn name ( _: & ( ) ) -> Option < & ' static str > {
14741499 Some ( "NonNullStringBox1" )
14751500 }
@@ -1484,13 +1509,22 @@ mod tests {
14841509 }
14851510 }
14861511
1487- impl < S > GraphQLType < S > for NonNullStringBox1Impl
1512+ impl < S > GraphQLValue < S > for NonNullStringBox1
14881513 where
14891514 S : ScalarValue ,
14901515 {
14911516 type Context = ( ) ;
14921517 type TypeInfo = ( ) ;
14931518
1519+ fn type_name < ' i > ( & self , info : & ' i Self :: TypeInfo ) -> Option < & ' i str > {
1520+ <Self as GraphQLType >:: name ( info)
1521+ }
1522+ }
1523+
1524+ impl < S > GraphQLType < S > for NonNullStringBox1Impl
1525+ where
1526+ S : ScalarValue ,
1527+ {
14941528 fn name ( _: & ( ) ) -> Option < & ' static str > {
14951529 Some ( "NonNullStringBox1Impl" )
14961530 }
@@ -1515,13 +1549,22 @@ mod tests {
15151549 }
15161550 }
15171551
1518- impl < S > GraphQLType < S > for NonNullStringBox2
1552+ impl < S > GraphQLValue < S > for NonNullStringBox1Impl
15191553 where
15201554 S : ScalarValue ,
15211555 {
15221556 type Context = ( ) ;
15231557 type TypeInfo = ( ) ;
15241558
1559+ fn type_name < ' i > ( & self , info : & ' i Self :: TypeInfo ) -> Option < & ' i str > {
1560+ <Self as GraphQLType >:: name ( info)
1561+ }
1562+ }
1563+
1564+ impl < S > GraphQLType < S > for NonNullStringBox2
1565+ where
1566+ S : ScalarValue ,
1567+ {
15251568 fn name ( _: & ( ) ) -> Option < & ' static str > {
15261569 Some ( "NonNullStringBox2" )
15271570 }
@@ -1536,13 +1579,22 @@ mod tests {
15361579 }
15371580 }
15381581
1539- impl < S > GraphQLType < S > for NonNullStringBox2Impl
1582+ impl < S > GraphQLValue < S > for NonNullStringBox2
15401583 where
15411584 S : ScalarValue ,
15421585 {
15431586 type Context = ( ) ;
15441587 type TypeInfo = ( ) ;
15451588
1589+ fn type_name < ' i > ( & self , info : & ' i Self :: TypeInfo ) -> Option < & ' i str > {
1590+ <Self as GraphQLType >:: name ( info)
1591+ }
1592+ }
1593+
1594+ impl < S > GraphQLType < S > for NonNullStringBox2Impl
1595+ where
1596+ S : ScalarValue ,
1597+ {
15461598 fn name ( _: & ( ) ) -> Option < & ' static str > {
15471599 Some ( "NonNullStringBox2Impl" )
15481600 }
@@ -1567,13 +1619,22 @@ mod tests {
15671619 }
15681620 }
15691621
1570- impl < S > GraphQLType < S > for Node
1622+ impl < S > GraphQLValue < S > for NonNullStringBox2Impl
15711623 where
15721624 S : ScalarValue ,
15731625 {
15741626 type Context = ( ) ;
15751627 type TypeInfo = ( ) ;
15761628
1629+ fn type_name < ' i > ( & self , info : & ' i Self :: TypeInfo ) -> Option < & ' i str > {
1630+ <Self as GraphQLType >:: name ( info)
1631+ }
1632+ }
1633+
1634+ impl < S > GraphQLType < S > for Node
1635+ where
1636+ S : ScalarValue ,
1637+ {
15771638 fn name ( _: & ( ) ) -> Option < & ' static str > {
15781639 Some ( "Node" )
15791640 }
@@ -1591,13 +1652,22 @@ mod tests {
15911652 }
15921653 }
15931654
1594- impl < S > GraphQLType < S > for Edge
1655+ impl < S > GraphQLValue < S > for Node
15951656 where
15961657 S : ScalarValue ,
15971658 {
15981659 type Context = ( ) ;
15991660 type TypeInfo = ( ) ;
16001661
1662+ fn type_name < ' i > ( & self , info : & ' i Self :: TypeInfo ) -> Option < & ' i str > {
1663+ <Self as GraphQLType >:: name ( info)
1664+ }
1665+ }
1666+
1667+ impl < S > GraphQLType < S > for Edge
1668+ where
1669+ S : ScalarValue ,
1670+ {
16011671 fn name ( _: & ( ) ) -> Option < & ' static str > {
16021672 Some ( "Edge" )
16031673 }
@@ -1612,13 +1682,22 @@ mod tests {
16121682 }
16131683 }
16141684
1615- impl < S > GraphQLType < S > for Connection
1685+ impl < S > GraphQLValue < S > for Edge
16161686 where
16171687 S : ScalarValue ,
16181688 {
16191689 type Context = ( ) ;
16201690 type TypeInfo = ( ) ;
16211691
1692+ fn type_name < ' i > ( & self , info : & ' i Self :: TypeInfo ) -> Option < & ' i str > {
1693+ <Self as GraphQLType >:: name ( info)
1694+ }
1695+ }
1696+
1697+ impl < S > GraphQLType < S > for Connection
1698+ where
1699+ S : ScalarValue ,
1700+ {
16221701 fn name ( _: & ( ) ) -> Option < & ' static str > {
16231702 Some ( "Connection" )
16241703 }
@@ -1633,13 +1712,22 @@ mod tests {
16331712 }
16341713 }
16351714
1636- impl < S > GraphQLType < S > for QueryRoot
1715+ impl < S > GraphQLValue < S > for Connection
16371716 where
16381717 S : ScalarValue ,
16391718 {
16401719 type Context = ( ) ;
16411720 type TypeInfo = ( ) ;
16421721
1722+ fn type_name < ' i > ( & self , info : & ' i Self :: TypeInfo ) -> Option < & ' i str > {
1723+ <Self as GraphQLType >:: name ( info)
1724+ }
1725+ }
1726+
1727+ impl < S > GraphQLType < S > for QueryRoot
1728+ where
1729+ S : ScalarValue ,
1730+ {
16431731 fn name ( _: & ( ) ) -> Option < & ' static str > {
16441732 Some ( "QueryRoot" )
16451733 }
@@ -1661,6 +1749,18 @@ mod tests {
16611749 }
16621750 }
16631751
1752+ impl < S > GraphQLValue < S > for QueryRoot
1753+ where
1754+ S : ScalarValue ,
1755+ {
1756+ type Context = ( ) ;
1757+ type TypeInfo = ( ) ;
1758+
1759+ fn type_name < ' i > ( & self , info : & ' i Self :: TypeInfo ) -> Option < & ' i str > {
1760+ <Self as GraphQLType >:: name ( info)
1761+ }
1762+ }
1763+
16641764 #[ test]
16651765 fn conflicting_return_types_which_potentially_overlap ( ) {
16661766 expect_fails_rule_with_schema :: < _ , EmptyMutation < ( ) > , _ , _ , DefaultScalarValue > (
0 commit comments