Note: 4.2 is the newest 4.x version
Thanks a lot to all contributors for reporting bugs, giving feedback, fixing bugs, adding new features and more!
Major New features:
#590
This is the biggest enhancement to come to graphql-java in a long time. Query execution is now performed in a fully asynchronous manner. A DataFetcher
is now able to return a CompletionStage<Object>
background promise to data and the graphql-java engine will ensure that when it completes it will be placed into the correct place in the query results.
This allows you to use facilities like java 8's CompletableFuture.supplyAsync()
to run many data fetchers in parallel, which should improve the speed of your system by fully utilizing all your available CPUs.
All of the provided ExecutionStrategy
implementations now support fully asynchronous results. Note if you have your own derived ExecutionStrategy
then the method signatures have been modified and are described below in the breaking changes section.
#577
New TracingInstrumentation
has been added that tracks how long each field takes to execute. This is reported back on the ExecutionResult
extensions field and gives you insight into how you graphql-java server is performing.
This tracing support follows the proposed Apollo Tracing specification https://github.com/apollographql/apollo-tracing which can then be viewed via their Optics performance monitoring tooling : https://www.apollodata.com/optics/
#641
You can now control the visibility of selected fields in the schema. A GraphqlFieldVisibility
implementation can be attached to a schema that decide on what fields will be made visible to queries and introspection. This allows you to say restrict the view of the schema for different classes of users say.
#625
java.util.Optional
is now supported as a return value from data fetchers and will be collapsed into either an object or the null value in graphql terms.
#618 #575 #560
Instrumentation
was enhanced significantly to with an extra method when an ExecutionStrategy
is entered and exited. It also allows you to intercept DataFetcher
s and results and hence inject new behaviour into the running system.
#616
The error messages for argument validation have been improved and better tells you went wrong and in more detail.
#650
You can now store extra meta data on GraphqlError
objects that can be sent back to your client code
#552
The ExecutionResult
object now has a toSpecification()
method that gives you back and object that 100% complies with the graphql specification.
#449
There is now "path" support when running queries. Errors contain the path to which field was in error in a structured specified by the graphql specification and DataFetcher
s also get this path information.
#467 #470 #468
Schema IDL has been improved. Any additional types defined in schema IDL are now included into the build GraphqSchema
object as expected, deprecation is now supported via IDL files and the build runtime type objects contain the original AST definitions.
List of breaking changes:
#593:
- The
Instrumentation
callback is now one method (with two parameters) instead of two methods.
ExecutionStrategy
has been refactored by several PRs but it affects only custom strategies.
Main changes are cleaned up parameters and support ofCompletableFuture
.
#550:
ExecutionStrategy.handleDataFetchingException
is removed: Instead a delegateDataFetcherExceptionHandler
is used to handle Exceptions.
-
An explicit
root
Object is added which is available to DataFetchers and is thesource
for the first levelDataFetcher
. Before thatcontext
was used for that purpose. Note:GraphQL.execute(String query, Object context)
is still compatible to avoid unexpected bugs. -
The arguments objects for the
Instrumentation
are renamed to make them more clear: E.g.DataFetchParameters
->InstrumentationDataFetchParameters
#455:
- The overall scalar error logic was changed a bit. See this PR for details.
#427:
- By supporting the
null
literal the result of not providing an argument to a field was changed: not providing an arguments results in a arguments Map (for theDataFetcher
) with no key in it and providing thenull
literal results in a Javanull
values.
#660:
- removes the deprecated methods for the Relay support.
Full List of changes:
See here for the full list of all changes.