Skip to content

Extract common graphql request handling into abstract parent - #14

Closed
apottere wants to merge 3 commits into
graphql-java-kickstart:masterfrom
DealerDotCom:generic-servlet
Closed

apottere wants to merge 3 commits into
graphql-java-kickstart:masterfrom
DealerDotCom:generic-servlet

Conversation

@apottere

Copy link
Copy Markdown
Contributor

In order to get a working servlet in our application with (https://github.com/Distelli/graphql-apigen), we needed a way to forego the type/mutation/query providers and provide a schema directly to the servlet.

I extracted all of the servlet logic to an abstract parent that GraphQLServlet now extends, in order to keep GraphQLServlet exactly the same as it was before but also allow us to subclass AbstractGraphQLServlet for our purposes.

I can add a simple implementation of the abstract parent to this project as well, if that's desired.

@yrashk

yrashk commented Jan 12, 2017

Copy link
Copy Markdown
Contributor

Thank you so much for the contribution! I have an alternative suggestion and want to test it with you and see if it will solve your problem with the schema builder graphql-java-servlet is shipping with. Instead of breaking up one class into a hierarchy, how about having a GraphQLSchemaProvider interfaces or something like that extracted so that different implementations can be plugged and the current one can become one of its implementations? Any thoughts?

@apottere

Copy link
Copy Markdown
Contributor Author

If I understand correctly, you want to remove queryProviders, mutationProviders, and typesProviders from GraphQLServlet and instead have that take a schemaProvider, one of which could implement the original functionality of taking the other providers and building the schema?

@yrashk

yrashk commented Jan 12, 2017 via email

Copy link
Copy Markdown
Contributor

@apottere

Copy link
Copy Markdown
Contributor Author

I think it would work, I'll open another PR with a prototype of that and you can see which fits better.

@apottere

Copy link
Copy Markdown
Contributor Author

closing in favor of #15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants