...

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

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

     1- name: Boolean => Boolean
     2  rule: VariablesInAllowedPosition
     3  schema: 0
     4  query: |2-
     5
     6          query Query($booleanArg: Boolean)
     7          {
     8            complicatedArgs {
     9              booleanArgField(booleanArg: $booleanArg)
    10            }
    11          }
    12
    13  errors: []
    14- name: Boolean => Boolean within fragment
    15  rule: VariablesInAllowedPosition
    16  schema: 0
    17  query: |2-
    18
    19          fragment booleanArgFrag on ComplicatedArgs {
    20            booleanArgField(booleanArg: $booleanArg)
    21          }
    22          query Query($booleanArg: Boolean)
    23          {
    24            complicatedArgs {
    25              ...booleanArgFrag
    26            }
    27          }
    28
    29  errors: []
    30- name: Boolean => Boolean within fragment
    31  rule: VariablesInAllowedPosition
    32  schema: 0
    33  query: |2-
    34
    35          query Query($booleanArg: Boolean)
    36          {
    37            complicatedArgs {
    38              ...booleanArgFrag
    39            }
    40          }
    41          fragment booleanArgFrag on ComplicatedArgs {
    42            booleanArgField(booleanArg: $booleanArg)
    43          }
    44
    45  errors: []
    46- name: Boolean! => Boolean
    47  rule: VariablesInAllowedPosition
    48  schema: 0
    49  query: |2-
    50
    51          query Query($nonNullBooleanArg: Boolean!)
    52          {
    53            complicatedArgs {
    54              booleanArgField(booleanArg: $nonNullBooleanArg)
    55            }
    56          }
    57
    58  errors: []
    59- name: Boolean! => Boolean within fragment
    60  rule: VariablesInAllowedPosition
    61  schema: 0
    62  query: |2-
    63
    64          fragment booleanArgFrag on ComplicatedArgs {
    65            booleanArgField(booleanArg: $nonNullBooleanArg)
    66          }
    67          
    68          query Query($nonNullBooleanArg: Boolean!)
    69          {
    70            complicatedArgs {
    71              ...booleanArgFrag
    72            }
    73          }
    74
    75  errors: []
    76- name: '[String] => [String]'
    77  rule: VariablesInAllowedPosition
    78  schema: 0
    79  query: |2-
    80
    81          query Query($stringListVar: [String])
    82          {
    83            complicatedArgs {
    84              stringListArgField(stringListArg: $stringListVar)
    85            }
    86          }
    87
    88  errors: []
    89- name: '[String!] => [String]'
    90  rule: VariablesInAllowedPosition
    91  schema: 0
    92  query: |2-
    93
    94          query Query($stringListVar: [String!])
    95          {
    96            complicatedArgs {
    97              stringListArgField(stringListArg: $stringListVar)
    98            }
    99          }
   100
   101  errors: []
   102- name: String => [String] in item position
   103  rule: VariablesInAllowedPosition
   104  schema: 0
   105  query: |2-
   106
   107          query Query($stringVar: String)
   108          {
   109            complicatedArgs {
   110              stringListArgField(stringListArg: [$stringVar])
   111            }
   112          }
   113
   114  errors: []
   115- name: String! => [String] in item position
   116  rule: VariablesInAllowedPosition
   117  schema: 0
   118  query: |2-
   119
   120          query Query($stringVar: String!)
   121          {
   122            complicatedArgs {
   123              stringListArgField(stringListArg: [$stringVar])
   124            }
   125          }
   126
   127  errors: []
   128- name: ComplexInput => ComplexInput
   129  rule: VariablesInAllowedPosition
   130  schema: 0
   131  query: |2-
   132
   133          query Query($complexVar: ComplexInput)
   134          {
   135            complicatedArgs {
   136              complexArgField(complexArg: $complexVar)
   137            }
   138          }
   139
   140  errors: []
   141- name: ComplexInput => ComplexInput in field position
   142  rule: VariablesInAllowedPosition
   143  schema: 0
   144  query: |2-
   145
   146          query Query($boolVar: Boolean = false)
   147          {
   148            complicatedArgs {
   149              complexArgField(complexArg: {requiredArg: $boolVar})
   150            }
   151          }
   152
   153  errors: []
   154- name: Boolean! => Boolean! in directive
   155  rule: VariablesInAllowedPosition
   156  schema: 0
   157  query: |2-
   158
   159          query Query($boolVar: Boolean!)
   160          {
   161            dog @include(if: $boolVar)
   162          }
   163
   164  errors: []
   165- name: Int => Int!
   166  rule: VariablesInAllowedPosition
   167  schema: 0
   168  query: |2-
   169
   170          query Query($intArg: Int) {
   171            complicatedArgs {
   172              nonNullIntArgField(nonNullIntArg: $intArg)
   173            }
   174          }
   175
   176  errors:
   177    - message: Variable "$intArg" of type "Int" used in position expecting type "Int!".
   178      locations:
   179        - {line: 2, column: 19}
   180        - {line: 4, column: 45}
   181- name: Int => Int! within fragment
   182  rule: VariablesInAllowedPosition
   183  schema: 0
   184  query: |2-
   185
   186          fragment nonNullIntArgFieldFrag on ComplicatedArgs {
   187            nonNullIntArgField(nonNullIntArg: $intArg)
   188          }
   189          
   190          query Query($intArg: Int) {
   191            complicatedArgs {
   192              ...nonNullIntArgFieldFrag
   193            }
   194          }
   195
   196  errors:
   197    - message: Variable "$intArg" of type "Int" used in position expecting type "Int!".
   198      locations:
   199        - {line: 6, column: 19}
   200        - {line: 3, column: 43}
   201- name: Int => Int! within nested fragment
   202  rule: VariablesInAllowedPosition
   203  schema: 0
   204  query: |2-
   205
   206          fragment outerFrag on ComplicatedArgs {
   207            ...nonNullIntArgFieldFrag
   208          }
   209          
   210          fragment nonNullIntArgFieldFrag on ComplicatedArgs {
   211            nonNullIntArgField(nonNullIntArg: $intArg)
   212          }
   213          
   214          query Query($intArg: Int) {
   215            complicatedArgs {
   216              ...outerFrag
   217            }
   218          }
   219
   220  errors:
   221    - message: Variable "$intArg" of type "Int" used in position expecting type "Int!".
   222      locations:
   223        - {line: 10, column: 19}
   224        - {line: 7, column: 43}
   225- name: String over Boolean
   226  rule: VariablesInAllowedPosition
   227  schema: 0
   228  query: |2-
   229
   230          query Query($stringVar: String) {
   231            complicatedArgs {
   232              booleanArgField(booleanArg: $stringVar)
   233            }
   234          }
   235
   236  errors:
   237    - message: Variable "$stringVar" of type "String" used in position expecting type "Boolean".
   238      locations:
   239        - {line: 2, column: 19}
   240        - {line: 4, column: 39}
   241- name: String => [String]
   242  rule: VariablesInAllowedPosition
   243  schema: 0
   244  query: |2-
   245
   246          query Query($stringVar: String) {
   247            complicatedArgs {
   248              stringListArgField(stringListArg: $stringVar)
   249            }
   250          }
   251
   252  errors:
   253    - message: Variable "$stringVar" of type "String" used in position expecting type "[String]".
   254      locations:
   255        - {line: 2, column: 19}
   256        - {line: 4, column: 45}
   257- name: Boolean => Boolean! in directive
   258  rule: VariablesInAllowedPosition
   259  schema: 0
   260  query: |2-
   261
   262          query Query($boolVar: Boolean) {
   263            dog @include(if: $boolVar)
   264          }
   265
   266  errors:
   267    - message: Variable "$boolVar" of type "Boolean" used in position expecting type "Boolean!".
   268      locations:
   269        - {line: 2, column: 19}
   270        - {line: 3, column: 26}
   271- name: String => Boolean! in directive
   272  rule: VariablesInAllowedPosition
   273  schema: 0
   274  query: |2-
   275
   276          query Query($stringVar: String) {
   277            dog @include(if: $stringVar)
   278          }
   279
   280  errors:
   281    - message: Variable "$stringVar" of type "String" used in position expecting type "Boolean!".
   282      locations:
   283        - {line: 2, column: 19}
   284        - {line: 3, column: 26}
   285- name: '[String] => [String!]'
   286  rule: VariablesInAllowedPosition
   287  schema: 0
   288  query: |2-
   289
   290          query Query($stringListVar: [String])
   291          {
   292            complicatedArgs {
   293              stringListNonNullArgField(stringListNonNullArg: $stringListVar)
   294            }
   295          }
   296
   297  errors:
   298    - message: Variable "$stringListVar" of type "[String]" used in position expecting type "[String!]".
   299      locations:
   300        - {line: 2, column: 19}
   301        - {line: 5, column: 59}
   302- name: Allows optional (nullable) variables with default values/Int => Int! fails when variable provides null default value
   303  rule: VariablesInAllowedPosition
   304  schema: 0
   305  query: |2-
   306
   307            query Query($intVar: Int = null) {
   308              complicatedArgs {
   309                nonNullIntArgField(nonNullIntArg: $intVar)
   310              }
   311            }
   312
   313  errors:
   314    - message: Variable "$intVar" of type "Int" used in position expecting type "Int!".
   315      locations:
   316        - {line: 2, column: 21}
   317        - {line: 4, column: 47}
   318- name: Allows optional (nullable) variables with default values/Int => Int! when variable provides non-null default value
   319  rule: VariablesInAllowedPosition
   320  schema: 0
   321  query: |2-
   322
   323            query Query($intVar: Int = 1) {
   324              complicatedArgs {
   325                nonNullIntArgField(nonNullIntArg: $intVar)
   326              }
   327            }
   328  errors: []
   329- name: Allows optional (nullable) variables with default values/Int => Int! when optional argument provides default value
   330  rule: VariablesInAllowedPosition
   331  schema: 0
   332  query: |2-
   333
   334            query Query($intVar: Int) {
   335              complicatedArgs {
   336                nonNullFieldWithDefault(nonNullIntArg: $intVar)
   337              }
   338            }
   339  errors: []
   340- name: Allows optional (nullable) variables with default values/Boolean => Boolean! in directive with default value with option
   341  rule: VariablesInAllowedPosition
   342  schema: 0
   343  query: |2-
   344
   345            query Query($boolVar: Boolean = false) {
   346              dog @include(if: $boolVar)
   347            }
   348  errors: []

View as plain text