Giter Site home page Giter Site logo

dropwizard-graphql's People

Contributors

aneessh18 avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar jplock avatar phact avatar rcleps avatar sullis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dropwizard-graphql's Issues

GraphQLBundle having another override `getGraphQLSchema()`?

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?

TODO

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:

  • specify a package prefix in the configuration and scan for GraphQL types to automatically register with the servlet
  • figure out a better way to support setting data fetchers on each field (using @GraphQLDataFetcher). Right now, since we aren't setting a data fetcher with annotations, we are setting it manually

Build failure for the example app

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

Apollo GraphQL Federation

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

GraphQLfactory should allow for multiple schema files

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.

Facing issue when building Dropwizard GraphQL Bundle

[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 ?

Response null on http://0.0.0.0:8080/

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
}
}

Not able to update the graphql playground url after overriding the run method

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.

URI is not hierarchical

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

Adding documentation for dropwizard-graphql

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.

Couple of tweaks which would help to expose both GraphQL and REST API endpoints simultaneously.

  1. We have to change the root path in the GraphQL bundle which we add in the initialize method.
  2. We have to also change the environment variables in run function in the GraphQL bundle class so that the GraphQL playground could find the schema.json file.

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.

dependency convergence issue

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

java.lang.NoSuchMethodError: graphql.ExecutionInput$Builder.executionId(

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)

Unable to build the project with the mvnw command

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.