smoketurner / dropwizard-graphql Goto Github PK
View Code? Open in Web Editor NEWDropwizard GraphQL Bundle
License: Apache License 2.0
Dropwizard GraphQL Bundle
License: Apache License 2.0
I am building the schema via manual objects instead of via the RuntimeWiring and SDL files. However, the GraphQLFactory abstraction that is currently exposed in this plugin requires you to be using RuntimeWiring.
If I put together a PR that added a getGraphQLSchema()
overridable function that can optionally be used instead would that be accepted?
Right now, this project doesn't do much except for registering https://github.com/graphql-java/graphql-java-servlet as a jetty servlet. It would be nice to support:
Hello,
When I run the "./mvnw" it doesn't get recogonized as a command:
./mvnw
./mvnw: Command not found.
Also when I try to run with in-house maven, like " mvn clean package" -> I get this error:
10610 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.1.1:jar (attach-javadocs) on project graphql-core: MavenReportException: Error while generating Javadoc:
10610 [ERROR] Exit code: 1 - javadoc: error - invalid flag: -html5
10611 [ERROR]
10611 [ERROR] Command line was: /mathworks/hub/3rdparty/internal/1874930/glnxa64/jdk/jre/../bin/javadoc @options @packages
10611 [ERROR]
10611 [ERROR] Refer to the generated Javadoc files in '/mathworks/devel/sandbox/asudhaka/batup_work/dropwizard-graphql/graphql-core/target/apidocs' dir.
10611 [ERROR]
10611 [ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: F
Any help/pointers is appreciated.
Thanks, Anand
Hi,
Recently I forked this project to support a Dropwizard application's integration with Apollo Gateway. I was curious if you are interested in having this code merged back. I'm more than willing to make any adjustments to my copy in order to have the contribution be accepted as I hope it might be useful to other Dropwizard users.
Let me know if this is of any interest.
Thanks,
Bryce
Is there any reason the graphql endpoint is not setup as a dropwizard jersey resource?
I would like to use dropwizard-graphql
for a project I'm working on but currently the schema is contained in multiple files. Doing this directly in graph-java I do the following:
TypeDefinitionRegistry registry = new TypeDefinitionRegistry();
registry.merge(parser.parse(new InputStreamReader(getClass().getClassLoader().getResourceAsStream(GRAPHQL_TYPES_PATH))));
registry.merge(parser.parse(new InputStreamReader(getClass().getClassLoader().getResourceAsStream(GRAPHQL_API_PATH))));
It appears that the current implementation of GraphQLFactory
expects the schema to be in a single file that is set via a single method call.
It would be nice if dropwizard-graphql would allow me to spread my schema across multiple files in projects that want to do that.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project graphql-core: Fatal error compiling: invalid flag: --release -> [Help 1]
What does this actually indicate ?
Hi,
I was trying graphiql interface using following query but i keed on getting null response from graphql example api.
Query:
{
saying{
id,
content(name:"ded")
}
}
Response:
{
"data": {
"saying": null
}
}
Hi,
I'm trying to use graphql and Dropwizard and I'd like to use DataLoaders and BatchLoaders. But I can't figure out how to register a data loader using a registry.
Could you please provide an example?
Best
When I try to run the graphql playground with dropwizard and kotlin in the code first approach, http://localhost:PORT
, the playground url shows as localhost:PORT/graphql
, but that is not the actual location of the graphql schema.
The actual graphql schema is located at : localhost:PORT/api/graphql
. How can I configure this url, so that whenever I start my graphql server. The playground url automatically shows localhost:PORT/graphql
.
When I run this from inside Eclipse, it starts up fine, but if I run from the command line, I get the error:
java.lang.IllegalArgumentException: URI is not hierarchical at java.io.File.<init>(File.java:418) at com.smoketurner.dropwizard.graphql.GraphQLFactory.getSchemaFile(GraphQLFactory.java:65) at com.smoketurner.dropwizard.graphql.GraphQLFactory.build(GraphQLFactory.java:125) at com.smoketurner.dropwizard.graphql.GraphQLBundle.run(GraphQLBundle.java:40) at com.smoketurner.dropwizard.graphql.GraphQLBundle.run(GraphQLBundle.java:27) at io.dropwizard.setup.Bootstrap.run(Bootstrap.java:200) at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:42) at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:85) at io.dropwizard.cli.Cli.run(Cli.java:75) at io.dropwizard.Application.run(Application.java:93) at com.example.helloworld.HelloWorldApplication.main(HelloWorldApplication.java:35)
It looks like the issue is something related to this:
https://stackoverflow.com/questions/20389255/reading-a-resource-file-from-within-jar
The present hello world documentation does provide for starting GraphQL in Dropwizard But if we need to write REST and GraphQL APIs in the same Dropwizard application then we may need to look into the source code and tweak according to it.
We have to override these methods in the main class of the Dropwizard app.
Now the changed versions of these methods will be :
@Override
public void initialize(Bootstrap<?> bootstrap) {
bootstrap.addBundle(new AssetsBundle("/assets", "/graphql", "index.htm", "graphql-playground"));
} // for exposing graphql endpoint at localhost:8080/graphql
@Override
public void run(final C configuration, final Environment environment) throws Exception {
final GraphQLFactory factory = getGraphQLFactory(configuration);
final PreparsedDocumentProvider provider =
new CachingPreparsedDocumentProvider(factory.getQueryCache(), environment.metrics());
final GraphQLSchema schema = factory.build();
final GraphQLQueryInvoker queryInvoker =
GraphQLQueryInvoker.newBuilder()
.withPreparsedDocumentProvider(provider)
.withInstrumentation(factory.getInstrumentations())
.build();
final graphql.kickstart.servlet.GraphQLConfiguration config =
graphql.kickstart.servlet.GraphQLConfiguration.with(schema).with(queryInvoker).build();
final GraphQLHttpServlet servlet = GraphQLHttpServlet.with(config);
environment.servlets().addServlet("graphql", servlet).addMapping("/schema", "/schema.json");
// for exposing the graphql schema at localhost:8080/graphql/schema
I found these tweaks useful for exposing REST and GraphQL APIs simultaneously. Raising this issue so that it would be helpful for those who would be facing the same issue. Adding these tweaks in the docs would be really helpful for someone who would want to try out GraphQL in Dropwizard.
When trying to do mvn clean install, compilation of Dropwizard GraphQL Bundle fails and this is the error/warning i see -
Dependency convergence error for org.assertj:assertj-core:3.11.1 paths to dependency are:
+-com.smoketurner.dropwizard:graphql-core:1.3.8-2-SNAPSHOT
+-org.assertj:assertj-core:3.11.1
and
+-com.smoketurner.dropwizard:graphql-core:1.3.8-2-SNAPSHOT
+-io.dropwizard:dropwizard-testing:1.3.8
+-org.assertj:assertj-core:3.9.1
dropwizard v.0.7.1
graphql-java v.13.0.0
graphql-core v.1.3.12-4
Getting the following error when making a graphql request
0:0:0:0:0:0:0:1 - - [23/Jul/2019:18:35:51 +0000] "POST /graphql HTTP/1.1" 500 - "-" "insomnia/6.5.4" 23
ERROR [2019-07-23 18:35:51,923] graphql.servlet.AbstractGraphQLHttpServlet: Error executing GraphQL request!
! java.lang.NoSuchMethodError: graphql.ExecutionInput$Builder.executionId(Lgraphql/execution/ExecutionId;)Lgraphql/ExecutionInput$Builder;
! at graphql.servlet.input.GraphQLSingleInvocationInput.createExecutionInput(GraphQLSingleInvocationInput.java:52)
! at graphql.servlet.input.GraphQLSingleInvocationInput.<init>(GraphQLSingleInvocationInput.java:26)
! at graphql.servlet.input.GraphQLInvocationInputFactory.create(GraphQLInvocationInputFactory.java:72)
! at graphql.servlet.input.GraphQLInvocationInputFactory.create(GraphQLInvocationInputFactory.java:40)
! at graphql.servlet.AbstractGraphQLHttpServlet.lambda$init$4(AbstractGraphQLHttpServlet.java:237)
! at graphql.servlet.AbstractGraphQLHttpServlet.doRequest(AbstractGraphQLHttpServlet.java:342)
! at graphql.servlet.AbstractGraphQLHttpServlet.doRequestAsync(AbstractGraphQLHttpServlet.java:333)
! at graphql.servlet.AbstractGraphQLHttpServlet.doPost(AbstractGraphQLHttpServlet.java:365)
! at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
! at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
As soon as I tried to build the project with the command ./mvnw clean package I get the error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project graphql-core: Fatal error compiling: Error while executing the compiler. InvocationTargetException: ANNOTATION_PROCESSOR_MODULE_PATH -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :graphql-core
Not sure what to do as I haven't changed any configurations to your project.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.