use of graphql.schema.idl.SchemaParser in project vertx-web by vert-x3.
the class VertxBatchLoaderTest method graphQL.
@Override
protected GraphQL graphQL() {
String schema = vertx.fileSystem().readFileBlocking("links.graphqls").toString();
SchemaParser schemaParser = new SchemaParser();
TypeDefinitionRegistry typeDefinitionRegistry = schemaParser.parse(schema);
RuntimeWiring runtimeWiring = newRuntimeWiring().type("Query", builder -> builder.dataFetcher("allLinks", this::getAllLinks)).type("Link", builder -> builder.dataFetcher("postedBy", this::getLinkPostedBy)).build();
SchemaGenerator schemaGenerator = new SchemaGenerator();
GraphQLSchema graphQLSchema = schemaGenerator.makeExecutableSchema(typeDefinitionRegistry, runtimeWiring);
DataLoaderDispatcherInstrumentation dispatcherInstrumentation = new DataLoaderDispatcherInstrumentation();
return GraphQL.newGraphQL(graphQLSchema).instrumentation(dispatcherInstrumentation).build();
}
use of graphql.schema.idl.SchemaParser in project vertx-web by vert-x3.
the class VertxMappedBatchLoaderTest method graphQL.
@Override
protected GraphQL graphQL() {
String schema = vertx.fileSystem().readFileBlocking("links.graphqls").toString();
SchemaParser schemaParser = new SchemaParser();
TypeDefinitionRegistry typeDefinitionRegistry = schemaParser.parse(schema);
RuntimeWiring runtimeWiring = newRuntimeWiring().type("Query", builder -> builder.dataFetcher("allLinks", this::getAllLinks)).type("Link", builder -> builder.dataFetcher("postedBy", this::getLinkPostedBy)).build();
SchemaGenerator schemaGenerator = new SchemaGenerator();
GraphQLSchema graphQLSchema = schemaGenerator.makeExecutableSchema(typeDefinitionRegistry, runtimeWiring);
DataLoaderDispatcherInstrumentation dispatcherInstrumentation = new DataLoaderDispatcherInstrumentation();
return GraphQL.newGraphQL(graphQLSchema).instrumentation(dispatcherInstrumentation).build();
}
use of graphql.schema.idl.SchemaParser in project vertx-web by vert-x3.
the class ApolloWSHandlerTest method graphQL.
protected GraphQL graphQL() {
String schema = vertx.fileSystem().readFileBlocking("counter.graphqls").toString();
SchemaParser schemaParser = new SchemaParser();
TypeDefinitionRegistry typeDefinitionRegistry = schemaParser.parse(schema);
RuntimeWiring runtimeWiring = newRuntimeWiring().type("Query", builder -> builder.dataFetcher("staticCounter", this::getStaticCounter)).type("Subscription", builder -> builder.dataFetcher("counter", this::getCounter)).build();
SchemaGenerator schemaGenerator = new SchemaGenerator();
GraphQLSchema graphQLSchema = schemaGenerator.makeExecutableSchema(typeDefinitionRegistry, runtimeWiring);
return GraphQL.newGraphQL(graphQLSchema).build();
}
use of graphql.schema.idl.SchemaParser in project vertx-web by vert-x3.
the class MultipartRequestTest method graphQL.
private GraphQL graphQL() {
final String schema = vertx.fileSystem().readFileBlocking("upload.graphqls").toString();
final String emptyQueryschema = vertx.fileSystem().readFileBlocking("emptyQuery.graphqls").toString();
final SchemaParser schemaParser = new SchemaParser();
final TypeDefinitionRegistry typeDefinitionRegistry = schemaParser.parse(schema).merge(schemaParser.parse(emptyQueryschema));
final RuntimeWiring runtimeWiring = RuntimeWiring.newRuntimeWiring().scalar(UploadScalar.build()).type("Mutation", builder -> {
builder.dataFetcher("singleUpload", this::singleUpload);
builder.dataFetcher("multipleUpload", this::multipleUpload);
return builder;
}).build();
final SchemaGenerator schemaGenerator = new SchemaGenerator();
final GraphQLSchema graphQLSchema = schemaGenerator.makeExecutableSchema(typeDefinitionRegistry, runtimeWiring);
return GraphQL.newGraphQL(graphQLSchema).build();
}
use of graphql.schema.idl.SchemaParser in project vertx-web by vert-x3.
the class ApolloTestsServer method setupWsGraphQL.
private GraphQL setupWsGraphQL() {
String schema = vertx.fileSystem().readFileBlocking("counter.graphqls").toString();
SchemaParser schemaParser = new SchemaParser();
TypeDefinitionRegistry typeDefinitionRegistry = schemaParser.parse(schema);
RuntimeWiring runtimeWiring = newRuntimeWiring().type("Query", builder -> builder.dataFetcher("staticCounter", this::staticCounter)).type("Subscription", builder -> builder.dataFetcher("counter", this::counter)).build();
SchemaGenerator schemaGenerator = new SchemaGenerator();
GraphQLSchema graphQLSchema = schemaGenerator.makeExecutableSchema(typeDefinitionRegistry, runtimeWiring);
return GraphQL.newGraphQL(graphQLSchema).build();
}
Aggregations