File tree Expand file tree Collapse file tree 5 files changed +16
-3
lines changed
apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal
apollo-compiler/src/test/validation/operation/directive_variable Expand file tree Collapse file tree 5 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -35,8 +35,8 @@ import com.apollographql.apollo3.ast.SourceLocation
35
35
import com.apollographql.apollo3.ast.VariableUsage
36
36
import com.apollographql.apollo3.ast.definitionFromScope
37
37
import com.apollographql.apollo3.ast.findDeprecationReason
38
- import com.apollographql.apollo3.ast.rawType
39
38
import com.apollographql.apollo3.ast.pretty
39
+ import com.apollographql.apollo3.ast.rawType
40
40
import com.apollographql.apollo3.ast.responseName
41
41
import com.apollographql.apollo3.ast.rootTypeDefinition
42
42
import com.apollographql.apollo3.ast.sharesPossibleTypesWith
@@ -336,6 +336,11 @@ internal class ExecutableValidationScope(
336
336
337
337
fieldsInSetCanMerge(selections.collectFields(rootTypeDefinition.name))
338
338
339
+ directives.forEach {
340
+ validateDirective(it, this ) {
341
+ variableUsages.add(it)
342
+ }
343
+ }
339
344
variableUsages.forEach {
340
345
validateVariable(this , it)
341
346
}
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ import com.apollographql.apollo3.ast.GQLNonNullType
19
19
import com.apollographql.apollo3.ast.GQLNullValue
20
20
import com.apollographql.apollo3.ast.GQLObjectTypeDefinition
21
21
import com.apollographql.apollo3.ast.GQLOperationDefinition
22
- import com.apollographql.apollo3.ast.GQLOperationTypeDefinition
23
22
import com.apollographql.apollo3.ast.GQLScalarTypeDefinition
24
23
import com.apollographql.apollo3.ast.GQLSchemaDefinition
25
24
import com.apollographql.apollo3.ast.GQLSchemaExtension
@@ -104,7 +103,7 @@ internal fun ValidationScope.validateDirective(
104
103
is GQLInlineFragment -> GQLDirectiveLocation .INLINE_FRAGMENT
105
104
is GQLFragmentSpread -> GQLDirectiveLocation .FRAGMENT_SPREAD
106
105
is GQLObjectTypeDefinition -> GQLDirectiveLocation .OBJECT
107
- is GQLOperationTypeDefinition -> {
106
+ is GQLOperationDefinition -> {
108
107
when (directiveContext.operationType) {
109
108
" query" -> GQLDirectiveLocation .QUERY
110
109
" mutation" -> GQLDirectiveLocation .MUTATION
Original file line number Diff line number Diff line change
1
+ # See https://github.com/apollographql/apollo-kotlin/issues/5112
2
+ query Collection ($country : String ) @inContext (country : $country ) {
3
+ random
4
+ }
Original file line number Diff line number Diff line change
1
+ type Query {
2
+ random : String
3
+ }
4
+
5
+ directive @inContext (country : String ) on QUERY
You can’t perform that action at this time.
0 commit comments