@@ -761,6 +761,46 @@ describe('Type System: Input Objects must have fields', () => {
761
761
] ) ;
762
762
} ) ;
763
763
764
+ it ( 'rejects Input Objects with multiple non-breakable circular reference' , ( ) => {
765
+ const schema = buildSchema ( `
766
+ type Query {
767
+ field(arg: SomeInputObject): String
768
+ }
769
+
770
+ input SomeInputObject {
771
+ startLoop: AnotherInputObject!
772
+ }
773
+
774
+ input AnotherInputObject {
775
+ closeLoop: SomeInputObject!
776
+ startSecondLoop: YetAnotherInputObject!
777
+ }
778
+
779
+ input YetAnotherInputObject {
780
+ closeSecondLoop: AnotherInputObject!
781
+ nonNullSelf: YetAnotherInputObject!
782
+ }
783
+ ` ) ;
784
+
785
+ expect ( validateSchema ( schema ) ) . to . deep . equal ( [
786
+ {
787
+ message :
788
+ 'Cannot reference Input Object "SomeInputObject" within itself through a series of non-null fields: "startLoop.closeLoop".' ,
789
+ locations : [ { line : 7 , column : 9 } , { line : 11 , column : 9 } ] ,
790
+ } ,
791
+ {
792
+ message :
793
+ 'Cannot reference Input Object "AnotherInputObject" within itself through a series of non-null fields: "startSecondLoop.closeSecondLoop".' ,
794
+ locations : [ { line : 12 , column : 9 } , { line : 16 , column : 9 } ] ,
795
+ } ,
796
+ {
797
+ message :
798
+ 'Cannot reference Input Object "YetAnotherInputObject" within itself through a series of non-null fields: "nonNullSelf".' ,
799
+ locations : [ { line : 17 , column : 9 } ] ,
800
+ } ,
801
+ ] ) ;
802
+ } ) ;
803
+
764
804
it ( 'rejects an Input Object type with incorrectly typed fields' , ( ) => {
765
805
const schema = buildSchema ( `
766
806
type Query {
0 commit comments