FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix SchemaTransformerBenchmark to pass schema validation by andimarek · Pull Request #4255 · graphql-java/graphql-java · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or 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
@@ -1,5 +1,6 @@
package benchmark;

import graphql.introspection.Introspection.DirectiveLocation;
import graphql.schema.GraphQLDirective;
import graphql.schema.GraphQLFieldDefinition;
import graphql.schema.GraphQLObjectType;
Expand Down Expand Up @@ -42,6 +43,8 @@ public static class MyState {

GraphQLDirective infoDirective = GraphQLDirective.newDirective()
.name("Info")
.validLocation(DirectiveLocation.FIELD_DEFINITION)
.validLocation(DirectiveLocation.OBJECT)
.build();
GraphQLTypeVisitor directiveAdder = new GraphQLTypeVisitorStub() {
@Override
Expand Down Expand Up @@ -94,6 +97,8 @@ public void setup() {
try {
String schemaString = BenchmarkUtils.loadResource("large-schema-3.graphqls");
schema = SchemaGenerator.createdMockedSchema(schemaString);
// Declare the Info directive on the schema so validation passes after transformation
schema = schema.transform(builder -> builder.additionalDirective(infoDirective));
txSchema = SchemaTransformer.transformSchema(schema, directiveAdder);
} catch (Exception e) {
throw new RuntimeException(e);
Expand Down
Loading

Back | FazBrowse Home | New Git URL