@@ -587,7 +587,7 @@ type Root {
587
587
` ) ;
588
588
} ) ;
589
589
590
- it ( 'Print Introspection Schema' , ( ) => {
590
+ it . only ( 'Print Introspection Schema' , ( ) => {
591
591
const Root = new GraphQLObjectType ( {
592
592
name : 'Root' ,
593
593
fields : {
@@ -601,50 +601,116 @@ schema {
601
601
query: Root
602
602
}
603
603
604
- directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
604
+ # Directs the executor to include this field or fragment only when the ` if ` argument is true.
605
+ directive @include(
605
606
606
- directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
607
+ # Included when true.
608
+ if: Boolean!
609
+ ) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
607
610
608
- directive @deprecated(reason: String = "No longer supported") on FIELD_DEFINITION | ENUM_VALUE
611
+ # Directs the executor to skip this field or fragment when the ` if ` argument is true.
612
+ directive @skip(
609
613
614
+ # Skipped when true.
615
+ if: Boolean!
616
+ ) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
617
+
618
+ # Marks an element of a GraphQL schema as no longer supported.
619
+ directive @deprecated(
620
+
621
+ # Explains why this element was deprecated, usually also including a suggestion
622
+ # for how to access supported similar data. Formatted in
623
+ # [Markdown](https://daringfireball.net/projects/markdown/).
624
+ reason: String = "No longer supported"
625
+ ) on FIELD_DEFINITION | ENUM_VALUE
626
+
627
+ # A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.
628
+ #
629
+ # In some cases, you need to provide options to alter GraphQL's execution behavior
630
+ # in ways field arguments will not suffice, such as conditionally including or
631
+ # skipping a field. Directives provide this by describing additional information
632
+ # to the executor.
610
633
type __Directive {
611
634
name: String!
612
635
description: String
613
636
locations: [__DirectiveLocation!]!
614
637
args: [__InputValue!]!
615
- onOperation: Boolean! @deprecated(reason: "Use \ `locations\ `.")
616
- onFragment: Boolean! @deprecated(reason: "Use \ `locations\ `.")
617
- onField: Boolean! @deprecated(reason: "Use \ `locations\ `.")
638
+ onOperation: Boolean! @deprecated(reason: "Use ` locations `.")
639
+ onFragment: Boolean! @deprecated(reason: "Use ` locations `.")
640
+ onField: Boolean! @deprecated(reason: "Use ` locations `.")
618
641
}
619
642
643
+ # A Directive can be adjacent to many parts of the GraphQL language, a
644
+ # __DirectiveLocation describes one such possible adjacencies.
620
645
enum __DirectiveLocation {
646
+
647
+ # Location adjacent to a query operation.
621
648
QUERY
649
+
650
+ # Location adjacent to a mutation operation.
622
651
MUTATION
652
+
653
+ # Location adjacent to a subscription operation.
623
654
SUBSCRIPTION
655
+
656
+ # Location adjacent to a field.
624
657
FIELD
658
+
659
+ # Location adjacent to a fragment definition.
625
660
FRAGMENT_DEFINITION
661
+
662
+ # Location adjacent to a fragment spread.
626
663
FRAGMENT_SPREAD
664
+
665
+ # Location adjacent to an inline fragment.
627
666
INLINE_FRAGMENT
667
+
668
+ # Location adjacent to a schema definition.
628
669
SCHEMA
670
+
671
+ # Location adjacent to a scalar definition.
629
672
SCALAR
673
+
674
+ # Location adjacent to an object type definition.
630
675
OBJECT
676
+
677
+ # Location adjacent to a field definition.
631
678
FIELD_DEFINITION
679
+
680
+ # Location adjacent to an argument definition.
632
681
ARGUMENT_DEFINITION
682
+
683
+ # Location adjacent to an interface definition.
633
684
INTERFACE
685
+
686
+ # Location adjacent to a union definition.
634
687
UNION
688
+
689
+ # Location adjacent to an enum definition.
635
690
ENUM
691
+
692
+ # Location adjacent to an enum value definition.
636
693
ENUM_VALUE
694
+
695
+ # Location adjacent to an input object type definition.
637
696
INPUT_OBJECT
697
+
698
+ # Location adjacent to an input object field definition.
638
699
INPUT_FIELD_DEFINITION
639
700
}
640
701
702
+ # One possible value for a given Enum. Enum values are unique values, not a
703
+ # placeholder for a string or numeric value. However an Enum value is returned in
704
+ # a JSON response as a string.
641
705
type __EnumValue {
642
706
name: String!
643
707
description: String
644
708
isDeprecated: Boolean!
645
709
deprecationReason: String
646
710
}
647
711
712
+ # Object and Interface types are described by a list of Fields, each of which has
713
+ # a name, potentially a list of arguments, and a return type.
648
714
type __Field {
649
715
name: String!
650
716
description: String
@@ -654,21 +720,47 @@ type __Field {
654
720
deprecationReason: String
655
721
}
656
722
723
+ # Arguments provided to Fields or Directives and the input fields of an
724
+ # InputObject are represented as Input Values which describe their type and
725
+ # optionally a default value.
657
726
type __InputValue {
658
727
name: String!
659
728
description: String
660
729
type: __Type!
730
+
731
+ # A GraphQL-formatted string representing the default value for this input value.
661
732
defaultValue: String
662
733
}
663
734
735
+ # A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all
736
+ # available types and directives on the server, as well as the entry points for
737
+ # query, mutation, and subscription operations.
664
738
type __Schema {
739
+
740
+ # A list of all types supported by this server.
665
741
types: [__Type!]!
742
+
743
+ # The type that query operations will be rooted at.
666
744
queryType: __Type!
745
+
746
+ # If this server supports mutation, the type that mutation operations will be rooted at.
667
747
mutationType: __Type
748
+
749
+ # If this server support subscription, the type that subscription operations will be rooted at.
668
750
subscriptionType: __Type
751
+
752
+ # A list of all directives supported by this server.
669
753
directives: [__Directive!]!
670
754
}
671
755
756
+ # The fundamental unit of any GraphQL Schema is the type. There are many kinds of
757
+ # types in GraphQL as represented by the ` __TypeKind ` enum.
758
+ #
759
+ # Depending on the kind of a type, certain fields describe information about that
760
+ # type. Scalar types provide no information beyond a name and description, while
761
+ # Enum types provide their values. Object and Interface types provide the fields
762
+ # they describe. Abstract types, Union and Interface, provide the Object types
763
+ # possible at runtime. List and NonNull types compose other types.
672
764
type __Type {
673
765
kind: __TypeKind!
674
766
name: String
@@ -681,17 +773,35 @@ type __Type {
681
773
ofType: __Type
682
774
}
683
775
776
+ # An enum describing what kind of type a given ` __Type ` is.
684
777
enum __TypeKind {
778
+
779
+ # Indicates this type is a scalar.
685
780
SCALAR
781
+
782
+ # Indicates this type is an object. ` fields ` and ` interfaces ` are valid fields.
686
783
OBJECT
784
+
785
+ # Indicates this type is an interface. ` fields ` and ` possibleTypes ` are valid fields.
687
786
INTERFACE
787
+
788
+ # Indicates this type is a union. ` possibleTypes ` is a valid field.
688
789
UNION
790
+
791
+ # Indicates this type is an enum. ` enumValues ` is a valid field.
689
792
ENUM
793
+
794
+ # Indicates this type is an input object. ` inputFields ` is a valid field.
690
795
INPUT_OBJECT
796
+
797
+ # Indicates this type is a list. ` ofType ` is a valid field.
691
798
LIST
799
+
800
+ # Indicates this type is a non-null. ` ofType ` is a valid field.
692
801
NON_NULL
693
802
}
694
803
` ;
804
+ console . error ( output ) ; // eslint-disable-line
695
805
expect ( output ) . to . equal ( introspectionSchema ) ;
696
806
} ) ;
697
807
} ) ;
0 commit comments