...

Text file src/github.com/vektah/gqlparser/v2/validator/imported/spec/NoSchemaIntrospectionCustomRule.spec.yml

Documentation: github.com/vektah/gqlparser/v2/validator/imported/spec

     1- name: ignores valid fields including __typename
     2  rule: NoSchemaIntrospectionCustom
     3  schema: 9
     4  query: |2-
     5
     6          {
     7            someQuery {
     8              __typename
     9              someField
    10            }
    11          }
    12
    13  errors: []
    14- name: ignores fields not in the schema
    15  rule: NoSchemaIntrospectionCustom
    16  schema: 9
    17  query: |2-
    18
    19          {
    20            __introspect
    21          }
    22
    23  errors: []
    24- name: reports error when a field with an introspection type is requested
    25  rule: NoSchemaIntrospectionCustom
    26  schema: 9
    27  query: |2-
    28
    29          {
    30            __schema {
    31              queryType {
    32                name
    33              }
    34            }
    35          }
    36
    37  errors:
    38    - message: GraphQL introspection has been disabled, but the requested query contained the field "__schema".
    39      locations:
    40        - {line: 3, column: 9}
    41    - message: GraphQL introspection has been disabled, but the requested query contained the field "queryType".
    42      locations:
    43        - {line: 4, column: 11}
    44- name: reports error when a field with an introspection type is requested and aliased
    45  rule: NoSchemaIntrospectionCustom
    46  schema: 9
    47  query: |2-
    48
    49          {
    50            s: __schema {
    51              queryType {
    52                name
    53              }
    54            }
    55          }
    56
    57  errors:
    58    - message: GraphQL introspection has been disabled, but the requested query contained the field "__schema".
    59      locations:
    60        - {line: 3, column: 9}
    61    - message: GraphQL introspection has been disabled, but the requested query contained the field "queryType".
    62      locations:
    63        - {line: 4, column: 11}
    64- name: reports error when using a fragment with a field with an introspection type
    65  rule: NoSchemaIntrospectionCustom
    66  schema: 9
    67  query: |2-
    68
    69          {
    70            ...QueryFragment
    71          }
    72          
    73          fragment QueryFragment on Query {
    74            __schema {
    75              queryType {
    76                name
    77              }
    78            }
    79          }
    80
    81  errors:
    82    - message: GraphQL introspection has been disabled, but the requested query contained the field "__schema".
    83      locations:
    84        - {line: 7, column: 9}
    85    - message: GraphQL introspection has been disabled, but the requested query contained the field "queryType".
    86      locations:
    87        - {line: 8, column: 11}
    88- name: reports error for non-standard introspection fields
    89  rule: NoSchemaIntrospectionCustom
    90  schema: 9
    91  query: |2-
    92
    93          {
    94            someQuery {
    95              introspectionField
    96            }
    97          }
    98
    99  errors:
   100    - message: GraphQL introspection has been disabled, but the requested query contained the field "introspectionField".
   101      locations:
   102        - {line: 4, column: 11}

View as plain text