...

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

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

     1- name: no directives
     2  rule: UniqueDirectivesPerLocation
     3  schema: 17
     4  query: |2-
     5
     6          fragment Test on Type {
     7            field
     8          }
     9
    10  errors: []
    11- name: unique directives in different locations
    12  rule: UniqueDirectivesPerLocation
    13  schema: 17
    14  query: |2-
    15
    16          fragment Test on Type @directiveA {
    17            field @directiveB
    18          }
    19
    20  errors: []
    21- name: unique directives in same locations
    22  rule: UniqueDirectivesPerLocation
    23  schema: 17
    24  query: |2-
    25
    26          fragment Test on Type @directiveA @directiveB {
    27            field @directiveA @directiveB
    28          }
    29
    30  errors: []
    31- name: same directives in different locations
    32  rule: UniqueDirectivesPerLocation
    33  schema: 17
    34  query: |2-
    35
    36          fragment Test on Type @directiveA {
    37            field @directiveA
    38          }
    39
    40  errors: []
    41- name: same directives in similar locations
    42  rule: UniqueDirectivesPerLocation
    43  schema: 17
    44  query: |2-
    45
    46          fragment Test on Type {
    47            field @directive
    48            field @directive
    49          }
    50
    51  errors: []
    52- name: repeatable directives in same location
    53  rule: UniqueDirectivesPerLocation
    54  schema: 17
    55  query: |2-
    56
    57          fragment Test on Type @repeatable @repeatable {
    58            field @repeatable @repeatable
    59          }
    60
    61  errors: []
    62- name: unknown directives must be ignored
    63  rule: UniqueDirectivesPerLocation
    64  schema: 17
    65  query: |2-
    66
    67          type Test @unknown @unknown {
    68            field: String! @unknown @unknown
    69          }
    70          
    71          extend type Test @unknown {
    72            anotherField: String!
    73          }
    74
    75  errors: []
    76- name: duplicate directives in one location
    77  rule: UniqueDirectivesPerLocation
    78  schema: 17
    79  query: |2-
    80
    81          fragment Test on Type {
    82            field @directive @directive
    83          }
    84
    85  errors:
    86    - message: The directive "@directive" can only be used once at this location.
    87      locations:
    88        - {line: 3, column: 15}
    89        - {line: 3, column: 26}
    90- name: many duplicate directives in one location
    91  rule: UniqueDirectivesPerLocation
    92  schema: 17
    93  query: |2-
    94
    95          fragment Test on Type {
    96            field @directive @directive @directive
    97          }
    98
    99  errors:
   100    - message: The directive "@directive" can only be used once at this location.
   101      locations:
   102        - {line: 3, column: 15}
   103        - {line: 3, column: 26}
   104    - message: The directive "@directive" can only be used once at this location.
   105      locations:
   106        - {line: 3, column: 15}
   107        - {line: 3, column: 37}
   108- name: different duplicate directives in one location
   109  rule: UniqueDirectivesPerLocation
   110  schema: 17
   111  query: |2-
   112
   113          fragment Test on Type {
   114            field @directiveA @directiveB @directiveA @directiveB
   115          }
   116
   117  errors:
   118    - message: The directive "@directiveA" can only be used once at this location.
   119      locations:
   120        - {line: 3, column: 15}
   121        - {line: 3, column: 39}
   122    - message: The directive "@directiveB" can only be used once at this location.
   123      locations:
   124        - {line: 3, column: 27}
   125        - {line: 3, column: 51}
   126- name: duplicate directives in many locations
   127  rule: UniqueDirectivesPerLocation
   128  schema: 17
   129  query: |2-
   130
   131          fragment Test on Type @directive @directive {
   132            field @directive @directive
   133          }
   134
   135  errors:
   136    - message: The directive "@directive" can only be used once at this location.
   137      locations:
   138        - {line: 2, column: 29}
   139        - {line: 2, column: 40}
   140    - message: The directive "@directive" can only be used once at this location.
   141      locations:
   142        - {line: 3, column: 15}
   143        - {line: 3, column: 26}

View as plain text