Skip to content

Graphql java 12 #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
May 12, 2019
Merged

Graphql java 12 #209

merged 25 commits into from
May 12, 2019

Conversation

yarinvak
Copy link
Member

@yarinvak yarinvak commented Apr 29, 2019

Solving #206

This PR intends to work with new GraphQL-Java 12.
In their new version, graphql-java broke their API completely and now Data Fetching and Type Resolving are separated from the GraphQL type objects into a new GraphQLCodeRegistry.

In this PR, we have refactored the way we handle data fetching and type resolving in graphql-java-annotations. GraphQLCodeRegistry.Builder is now encapsulated inside the GraphQLAnnotations object, so that in every place we previously went accross some data fetcher/type resolver and added it to the graphql object, we now add it to the code registry builder instead.

Then, when building the schema, it will be necessary to not only provide the object built by GraphQLAnnotations, but also provide the GraphQLCodeRegistry (so it needs to be taken from the GraphQLAnnotations object, to be built, and then provided to the GraphQLSchema Builder).

To make things easier, a new class called AnnotationsSchema is now providing a builder class to help you create your schema without the need of handling the code registry. You can simply call query, mutation, directive, etc, methods - and provide them with the class you want to build a GraphQL Object from.

For example:

GraphQLSchema schema = newAnnotationsSchema().query(Query.class).mutation(Mutation.class).directive(MyDirective.class).build();

A breaking change in this PR is that GraphQLAnnotations is not a singletone anymore. You should instatiate a GraphQLAnnotations object in order to use it to build your graphql objects (or use the static AnnotationsSchema.Builder).

Changed GraphQLAnnotations to be not static
GraphQLCodeRegistry.Builder is now encapsulated inside ProcessingElementsContainer
@yarinvak yarinvak added this to the v7 milestone Apr 29, 2019
@yarinvak yarinvak self-assigned this Apr 29, 2019
@yarinvak yarinvak requested a review from DoctorVoid April 29, 2019 12:22
@yarinvak yarinvak changed the title WIP Graphql java 12 Graphql java 12 - WIP (:construction:) Apr 29, 2019
@yarinvak yarinvak changed the title Graphql java 12 - WIP (:construction:) Graphql java 12 - WIP 🚧 Apr 29, 2019
@yarinvak yarinvak changed the title Graphql java 12 - WIP 🚧 Graphql java 12 - WIP 🚧 Apr 29, 2019
@yarinvak yarinvak changed the title Graphql java 12 - WIP 🚧 Graphql java 12 May 12, 2019
@yarinvak yarinvak merged commit 51774f0 into Enigmatis:development May 12, 2019
@yarinvak yarinvak deleted the graphql-java-12 branch January 17, 2020 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants