Open sergehuber opened 5 years ago
@sergehuber Not sure I quite follow you here. This servlet is a wrapper around graphql-java
and therefore provides support for this. When used in combination with graphql-java-tools
you get automatic parsing of SDL found on the class path. So what it is exactly that you would like to be able to do which you can't right now?
I wasn't aware this was possible. So basically I need to provide a schema Provider that uses graphql-java-tools?
I thought SDL was directly supported by graphql-java or did I misunderstand there? it seems they have a SchemaParser available ? https://www.graphql-java.com/tutorials/getting-started-with-spring-boot/#schema
Regards, Serge...
Well you don't have to use graphql-java-tools, you can use the SchemaParser from graphql-java directly. So the way to use it in combination with graphql-java-servlet would be to first create a GraphQLSchema
with that SchemaParser
from graphql-java and then pass that in to create the servlet using GraphQLHttpServlet.with(schema)
.
Does that answer your question?
Almost, I'm using the OSGi servlet right now, which seems to lack an extension point for that. Maybe I will need to contribute it if my understanding is correct ?
Right, I don't have any experience with OSGi unfortunately. There's a GraphQLSchemaProvider
in the OsgiGraphQLHttpServlet
that's responsible for providing the GraphQLSchema
. Can't you use that somehow?
Actually that schemaProvider is initialized this way :
this.schemaProvider = new DefaultGraphQLSchemaProvider(newSchema().query(queryTypeBuilder.build())
.mutation(mutationType)
.subscription(subscriptionType)
.additionalTypes(types)
.build());
so it's not pluggeable (yet) and can't hook a parser to generate it. I could provide a patch to do this but I need to get around to implementing and testing that.
It would be nice to add SDL (https://www.graphql-java.com/documentation/v11/schema/) support to the GraphQL Java Servlet project. But this might also imply having a way to provide "parts" of SDL as well as Data Fetchers (TypeProviders should be ok) in a pluggable way (to stay compatible with OSGi notably).