-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding federation tag directive to ignore
- Loading branch information
1 parent
8f7a2ee
commit 3b85686
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...t/graphql/orchestrator/federationdirectives/ignoredDirectives/IgnoredDirectiveSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.intuit.graphql.orchestrator.federationdirectives.ignoredDirectives | ||
|
||
import com.intuit.graphql.orchestrator.ServiceProvider | ||
import com.intuit.graphql.orchestrator.schema.RuntimeGraph | ||
import com.intuit.graphql.orchestrator.stitching.SchemaStitcher | ||
import graphql.schema.GraphQLFieldDefinition | ||
import helpers.BaseIntegrationTestSpecification | ||
|
||
class IgnoredDirectiveSpec extends BaseIntegrationTestSpecification { | ||
def "Successful stitching fields with tags"() { | ||
given: | ||
String SCHEMA_WITH_TAGS = ''' | ||
type Query { | ||
multipleTagField(id: String): String @tag(name: "tag1") @tag(name: "tag2") | ||
singleTagField: String @tag(name: "soloTag") | ||
noTagField: String | ||
} | ||
''' | ||
|
||
ServiceProvider tagProvider = createQueryMatchingService("TAG_SERVICE_PROVIDER", | ||
ServiceProvider.ServiceType.FEDERATION_SUBGRAPH, SCHEMA_WITH_TAGS, null) | ||
List<ServiceProvider> services = List.of(tagProvider) | ||
|
||
when: | ||
RuntimeGraph actualRuntimeGraph = SchemaStitcher.newBuilder() | ||
.services(services).build().stitchGraph() | ||
|
||
then: | ||
actualRuntimeGraph != null | ||
actualRuntimeGraph.addtionalDirectives.stream().anyMatch { it -> it.name == "tag" } | ||
GraphQLFieldDefinition multipleTagGqlDef = actualRuntimeGraph.executableSchema.queryType.getFieldDefinition("multipleTagField") | ||
multipleTagGqlDef.directives.size() == 2 | ||
multipleTagGqlDef.getDirectives().get(0).getArgument("name").argumentValue.getValue() == "tag1" | ||
multipleTagGqlDef.getDirectives().get(1).getArgument("name").argumentValue.getValue() == "tag2" | ||
|
||
GraphQLFieldDefinition singleTagGqlDef = actualRuntimeGraph.executableSchema.queryType.getFieldDefinition("singleTagField") | ||
singleTagGqlDef.directives.size() == 1 | ||
singleTagGqlDef.getDirectives().get(0).getArgument("name").argumentValue.getValue() == "soloTag" | ||
|
||
actualRuntimeGraph.executableSchema.queryType.getFieldDefinition("noTagField").directives.size() == 0 | ||
} | ||
} |