github graphql-java/graphql-java v10.0
10.0

latest releases: v22.0, v21.5, v20.9...
5 years ago

Breaking Change: Ast Nodes

The biggest breaking is the mutability and the general design of Ast Nodes:

  • Every Node has now a Builder and aims to be immutable
  • Nearly every getter for a collection returns now a copy instead of the real collection

Background:

Ast Nodes have never really been part of the public Api, but they "sneaked" into it again and again over time (for example you can get the Field from the DataFetchingEnvironment). So it was time to really support it: we refactored them and made them immutable. Unfortunately because of some external dependencies on the mutability we didn't go all the way: some Nodes are still mutable. We aim for making it fully immutable in the future.

WARNING: If you rely on the mutability of the Ast you have to refactor your code! Especially getter returning now a copy of collections and modifications of it doesn't have any effect!

Other breaking changes:

#1130: QueryVisitorFieldEnvironment.getParentType() returns now the possible modified type and not the unmodified type.

#1133: TypeDefinitionRegistry.add now accepts only SDLDefintion

#1145: A small change around additonalTypes if you use the GraphqlSchema constructor directly

PropertyDataFetcher methods can receive an DataFetchingEnvironment object

See #1169

The invoked POJO method can now take the DataFetchingEnvironment as an argument which helps to make ever more light weight data fetching code.

DataLoader has been bumped to 2.1.1

The new DataLoader version allows new types of batch loading functions to be written and includes return a Map of results instead of an ordered list. They also allow context to be passed to help wire in things like user credentials and so on.

Ability to get field sub selections more easily

DataFetchingFieldSelectionSet has been improved making it easier to look at field sub selection and therefore optimise your data fetching queries.

For example a Relay system might have code like the following to help find out what data they want.

List<SelectedField> nodeFields = selectionSet.getFields("edges/nodes/*");

See #1176

ExecutorServiceExecutionStrategy has been depreacted

There is no need to use ExecutorServiceExecutionStrategy anymore since all its functionality can be replicated in data fetchers by calling CompletableFuture.supplyAsync(() -> someValues(), executor)

This will be removed in a future version

You now have the ability to navigate up the execution tree in terms of fields

Previously ExecutionTypeInfo created an execution tree of types but not the AST fields. This has been added, allowing a data fetcher to look upwards towards parent fields.

See #1176

Tons of other fixes

https://github.com/graphql-java/graphql-java/pulls?utf8=%E2%9C%93&q=+is%3Apr+milestone%3A10.0+

Don't miss a new graphql-java release

NewReleases is sending notifications on new releases.