...

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

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

     1- name: with no directives
     2  rule: KnownDirectives
     3  schema: 2
     4  query: |2-
     5
     6          query Foo {
     7            name
     8            ...Frag
     9          }
    10          
    11          fragment Frag on Dog {
    12            name
    13          }
    14
    15  errors: []
    16- name: with standard directives
    17  rule: KnownDirectives
    18  schema: 2
    19  query: |2-
    20
    21          {
    22            human @skip(if: false) {
    23              name
    24              pets {
    25                ... on Dog @include(if: true) {
    26                  name
    27                }
    28              }
    29            }
    30          }
    31
    32  errors: []
    33- name: with unknown directive
    34  rule: KnownDirectives
    35  schema: 2
    36  query: |2-
    37
    38          {
    39            human @unknown(directive: "value") {
    40              name
    41            }
    42          }
    43
    44  errors:
    45    - message: Unknown directive "@unknown".
    46      locations:
    47        - {line: 3, column: 15}
    48- name: with many unknown directives
    49  rule: KnownDirectives
    50  schema: 2
    51  query: |2-
    52
    53          {
    54            __typename @unknown
    55            human @unknown {
    56              name
    57              pets @unknown {
    58                name
    59              }
    60            }
    61          }
    62
    63  errors:
    64    - message: Unknown directive "@unknown".
    65      locations:
    66        - {line: 3, column: 20}
    67    - message: Unknown directive "@unknown".
    68      locations:
    69        - {line: 4, column: 15}
    70    - message: Unknown directive "@unknown".
    71      locations:
    72        - {line: 6, column: 16}
    73- name: with well placed directives
    74  rule: KnownDirectives
    75  schema: 2
    76  query: |2-
    77
    78          query ($var: Boolean @onVariableDefinition) @onQuery {
    79            human @onField {
    80              ...Frag @onFragmentSpread
    81              ... @onInlineFragment {
    82                name @onField
    83              }
    84            }
    85          }
    86          
    87          mutation @onMutation {
    88            someField @onField
    89          }
    90          
    91          subscription @onSubscription {
    92            someField @onField
    93          }
    94          
    95          fragment Frag on Human @onFragmentDefinition {
    96            name @onField
    97          }
    98
    99  errors: []
   100- name: with misplaced directives
   101  rule: KnownDirectives
   102  schema: 2
   103  query: |2-
   104
   105          query ($var: Boolean @onQuery) @onMutation {
   106            human @onQuery {
   107              ...Frag @onQuery
   108              ... @onQuery {
   109                name @onQuery
   110              }
   111            }
   112          }
   113          
   114          mutation @onQuery {
   115            someField @onQuery
   116          }
   117          
   118          subscription @onQuery {
   119            someField @onQuery
   120          }
   121          
   122          fragment Frag on Human @onQuery {
   123            name @onQuery
   124          }
   125
   126  errors:
   127    - message: Directive "@onQuery" may not be used on VARIABLE_DEFINITION.
   128      locations:
   129        - {line: 2, column: 28}
   130    - message: Directive "@onMutation" may not be used on QUERY.
   131      locations:
   132        - {line: 2, column: 38}
   133    - message: Directive "@onQuery" may not be used on FIELD.
   134      locations:
   135        - {line: 3, column: 15}
   136    - message: Directive "@onQuery" may not be used on FRAGMENT_SPREAD.
   137      locations:
   138        - {line: 4, column: 19}
   139    - message: Directive "@onQuery" may not be used on INLINE_FRAGMENT.
   140      locations:
   141        - {line: 5, column: 15}
   142    - message: Directive "@onQuery" may not be used on FIELD.
   143      locations:
   144        - {line: 6, column: 18}
   145    - message: Directive "@onQuery" may not be used on MUTATION.
   146      locations:
   147        - {line: 11, column: 16}
   148    - message: Directive "@onQuery" may not be used on FIELD.
   149      locations:
   150        - {column: 19, line: 12}
   151    - message: Directive "@onQuery" may not be used on SUBSCRIPTION.
   152      locations:
   153        - {column: 20, line: 15}
   154    - message: Directive "@onQuery" may not be used on FIELD.
   155      locations:
   156        - {column: 19, line: 16}
   157    - message: Directive "@onQuery" may not be used on FRAGMENT_DEFINITION.
   158      locations:
   159        - {column: 30, line: 19}
   160    - message: Directive "@onQuery" may not be used on FIELD.
   161      locations:
   162        - {column: 14, line: 20}

View as plain text