Skip to content

Releases: graphql-java/graphql-java

Version 15.0

29 May 04:10
Compare
Choose a tag to compare

This is an important release which comes with two new major features and a bunch of performance improvements:

#1764 New Feature: Interfaces can implement other interfaces

This change allows interfaces to be implement by other interfaces instead of just objects.

This post explains the motivation and the background for it

#1772 New Feature: Custom Scalar specification URL

This lets you define a specification URL for a custom Scalar, which documents how this Scalar works.

This talk explains some background.

Performance improvements

We have a lot of performance improvements in this release. Some of them are significant improvements for systems at high scale.

#1815 More efficient DataFetcher
#1891 Improve ExecutionPath performance
#1792 Reduce NonNullable Exception overhead

Directives on variable declaration

It is now allowed to use directives on variable declaration.

Subscription improvements

#1804 DataFethcerResult can now be returned from subscription fetchers

#1801 Fixes the Subscription publisher so that it does not drop values at scale.

Non standard Scalar handling (Breaking change)

Any special handling for non standard Scalars got removed. This means you have to declare any Long, Char, etc Scalar explicitly in your SDL and provide an implementation.

The implementation for these non standard Scalars are still available in GraphQL Java itself (in the Scalars class) but they will be removed in the next release. The extended scalars project is the recommend way to migrate.

All breaking changes

All PRs for 15.0

Version 14.0

17 Jan 03:53
578985f
Compare
Choose a tag to compare

Overview

This is a big release after more than 6 months without a new major version. It consists of over 70 PRs which is mainly smaller bugfixes and improvements from all over the place.

The "biggest" feature in terms of work was the new SchemaTransformer and FieldVisibilitySchemaTransformation: it allows you to transform a GraphQLSchema and more specifically to remove one or more fields from a GraphQLSchema. While implementing this we refactored the GraphQLType hierarchy. If you are doing advanced GraphQLSchema processing you might be affected by it.

The most impactful changes for normal users are probably:

  • The ID scalar was changed to serialize all objects (#1693)
  • There is a new java.util.Locale available on the DataFetcherEnvironment set when you start executing a query (#1576)
  • Support of all unicode characters (#1603)
  • add getArgumentOrDefault to DataFetcherEnvironment (#1659)
  • Correctly support additional optional arguments in fields defined by interfaces (#1694)
  • add hook to allow for custom value unboxing (#1684)

But the impact really depends on your specific use, so please have a look at the complete list below.

List of all Features and Bugfixes

#1576: New java.util.Locale on DataFetcherEnvironment

#1589: Bugfix: Non-null input object fields with default values should be valid

#1589: Allow "special" names like true or fragment to be used as names

#1585: Introduce privacy safe logger prefix

#1601 and #1602: Improve Lexer errors

#1603: Allow full range of unicode characters

#1607: Add unique fragment names validation

#1609: Schema printing now prints description by default

#1610: Improved schema diff

#1637: Bugfix: SchemaPrinter print directive arguments only when there is a value

#1638: Bugfix: QueryTraverser can visit fields when the scalar value is an AST object

#1643: Parse a inputStream of schema definitions

#1645: Capture extend ast definitions in the GraphQLSchema

#1648: Fix if strategy is updated during instrumenting execution context

#1651: Upgrade DataLoader and fix lazy date loader support

#1659: add getArgumentOrDefault to DataFetcherEnvironment

#1668: Enhanced execution input (and hence data loader registry) is now captured before use

#1676: Will not override error classification extensions if they are already present

#1684: add hook to allow for custom value unboxing

#1685: local context is now null by default on top level fields

#1689: add support for extend schema notation

#1691: Add negative cache for PropertyDataFetcher

#1692: Improve Introspection performance

#1693: ID scalar now serialize all objects via String.valueOf

#1694: Bugfix: Correctly support additional optional arguments in fields defined by interfaces

#1702: Add FieldVisibilitySchemaTransformation which allows you to remove specific fields from a schema

#1720: Bugfix: QueryTraverser: fix NPE for directive arguments

#1721: Fine grained directive filtering in printing

#1722: Bugfix: description of directives arguments are captured correctly from SDL

#1723: Bugfix: capture directive definition when building a GraphQLSchema from SDL

#1725: Allows the messages from a scalar validation to be sent back to the user

#1735: Bugfix: comments on interface arguments cause wrong error for schema validation

#1737: Improve PropertyDataFetcher: search private getter up the class hierarchy

Breaking changes

#1685: We changed the default behaviour for the local context property: It is now null by default on top
level fields.

#1605 and other: We refined the type system for GraphQLSchema objects (classes implementing GraphQLType) and introduced a general SchemaTransformer class which lets you transform a GraphQLSchema object.

#1734: The SDL PostProcessor hook was renamed from SchemaTransformer to SchemaGeneratorPostProcessing to make the purpose more clear but also to make the name SchemaTransformer available.

Details

All PRs merged for 14.0:
https://github.com/graphql-java/graphql-java/pulls?utf8=%E2%9C%93&q=is%3Apr+milestone%3A14.0+

All PRs with breaking changes:
https://github.com/graphql-java/graphql-java/pulls?utf8=%E2%9C%93&q=is%3Apr+milestone%3A14.0+label%3A%22breaking+change%22

Version 9.7

17 Jan 03:59
578985f
Compare
Choose a tag to compare

Version 9.7 is a bugfix release for our LTS Version 9.x.

It contains the following bugfixes:

#1753 multiple GraphQL sub types printing

#1752 additional optional arguments fields defined by interfaces

#1751 capture directive definition when building Schema

#1750 description of directives arguments are captured

#1749 Strategy update didn't take effect

#1748 Print directive argument only when it has a value

#1747 Non-null input object fields with default values should be valid

https://github.com/graphql-java/graphql-java/pulls?q=is%3Apr+milestone%3A9.7

Version 13.0

13 Jun 05:18
Compare
Choose a tag to compare

Breaking changes

#1221 @deferred behavior now includes field path

This is breaking in the sense that data that was not there before is now present and hence the behaviour has changed.

Some would argue that this is not a breaking change but we are being conservative here.

#1460 @defer is no longer a default directive

You now have to opt in to getting @defer behavior whereas before it as the default

#1483 PreparsedDocumentProvider now has full input

Previously only the query string was passed to the PreparsedDocumentProvider but now it receives the full execution input

#1495 ErrorClassification can now contribute to the extensions map of the error

This is breaking in the sense that new data will arrive on error object that was not present before.

Some would argue that this is not a breaking change but we are being conservative here.

#1536 Directive Wiring will be called for all directives

Previously a directive schema wiring would only be called back if the element had the named directive on it. This has been changed to that there is not a class of registration where a directive schema wiring can be called back for all elements regardless of whether they have a directive or not

The breaking change is now that the arguments passed into a SchemaDirectiveWiring can now be null at certain times whereas before it could never be null

#1540 DirectivesContainer no longer inherits from NamedNode

Not all AST elements that can have directives are actually NamedNodes so this has been changed

#1546 Pluggable type comparators

SchemaPrinterComparatorRegistry has been renamed as GraphqlTypeComparatorRegistry and applies to a wider aspect than just in schema printing.

You can now have one on at the schema level and decide how types get sorted in all contexts including Introspection and Schema printing.

All breaking changes

https://github.com/graphql-java/graphql-java/pulls?utf8=%E2%9C%93&q=is%3Apr+milestone%3A13.0+is%3Aclosed+label%3A%22breaking+change%22

Other changes

#1567 A list of DataFetcherResult can now be returned

Previously one could return a DataFetcherResult (with data, local context and possible errors) from a field fetch call

Now you return a List of DataFetcherResult objects (for list types) so that each item in the list gets its own data, local context and possible errors.

#1513 Line numbers are off by one

Previously syntax errors ;line numbers might be off by one. This was due to confusion between zero based offsets and ones based offsets in ANTLR - this has been fixed

#1493 A CacheControl instance is always seeded into ExecutionInput

#1487 containsAllOf and containsAnyOf has been added to DataFetcherSeletionSet

This makes it a bit easier to decide if sub selected fields are present

#1491 ExecutionResult can now programmatically tell you if a data element is present

#1393 You can get the runtime directives that are present on a query field

We now generate filled outgraphql.schema.GraphQLDirective objects for the directives on a field at fetch time.

All changes

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

Version 9.6

13 Jun 05:06
Compare
Choose a tag to compare

This is the next stable release of graphql-java

There are two fixes applied

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

Version 12.0

12 Mar 00:30
Compare
Choose a tag to compare

Breaking changes

#1335 Immutable Ast

This is a change we actually started a few months ago with making nearly all Nodes immutable.
This PR makes now all Nodes immutable and also provides a convenient way of changing Nodes in a Tree.
See #1335 (comment) for more details how to do that.

It contains also a change for the general tree TraverserContext: the result per Context is gone in favour of a accumulate property which lets you implement a general tree reduce logic.

Special thanks to @felipe-gdr for this PR.

#1308 GraphQLCodeRegistry

A new CodeRegistry was introduced which separates "code" (DataFetcher and TypeResolver) from the actual GraphQLSchema.

As a consequence you can't read the DataFetcher or TypeResolver anymore from a GraphQL object. (Adding a DataFetcher and TypeResolver when creating a GraphQLSchema is deprecated but still works as before. This was done for backwards compatibility but will be removed in a future version and hence the only way t associate data fetcher code with fields will be via the CodeRegistry)

#1313 Default Context object

GraphQL Java now offers a default context object if nothing was set.
The small breaking change is that the default context value is not null any more. We dont expect this to be a problem in practice.

#1387 removed ExecutionContext from DataFetcherEnvironment

ExecutionContext was removed from DataFetcherEnvironment in favour of adding more properties to the DataFetcherEnvironment directly.

#1415 General Purpose Error Builder

The breaking change is regarding mapping or errors returned from a DataFetcher. DataFetcherResult has a new property isMapRelativeErrors which is false by default. Previously it was like it was true by default . When it is true, the data fetching code will map this error as being a relative error from the existing field. If it is false then any errors returned will be passed on unchanged.

All breaking changes PRs

https://github.com/graphql-java/graphql-java/issues?utf8=%E2%9C%93&q=+label%3A%22breaking+change%22+milestone%3A%2212.0%22

Other changes

#1416 SchemaDirectiveWiring is now done after the full set of graphql elements are built

This makes the schema directive wiring occur after the type has been built and hence the callback gets full access to the type hierarchy

#1376 Passing local context objects from data fetchers to child fields

This uses DataFetcherResult as the mechanism for a DataFetcher to pass local context objects down to child fetchers. This allows parent fields to pass down information to lower layers. If a field does not pass any local context down, then the local context from the previous parent is used.

#1355 Added the ability to instrument document and variables

#1285 PropertyDataFetcher: Added the ability to not use setAccessible for non public access

All changes:

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

Version 9.5

12 Mar 00:30
cf1e838
Compare
Choose a tag to compare

Maintenance release for the stable branch 9.x with:

  • Update antlr4 from 4.7.1 to 4.7.2
  • Fix NPE in AstPrinter for inline fragments without type condition
  • ClassCastException when using a fragment with wrong input type condition and overlapping fields are being merged.
  • Floats can have positive exponents

Full list of PRS:

https://github.com/graphql-java/graphql-java/pulls?utf8=%E2%9C%93&q=milestone%3A%229.5%22

11.0

20 Oct 00:48
Compare
Choose a tag to compare

Breaking changes

#1263 - DataLoader Scope changes

The dataloader support in graphql-java has been changed to encourage the right behavior. The DataLoaderRegistry and its contained DataLoaders need to be per execution instance based. However the previous setup made them tied to schema which is typically shared across executions.

Instead now the DataLoaderRegistry is specified as a property of the ExecutionInput and hence definitely per execution. This ensure thats the behaviour of data loader is scope to one execution and only one execution.

#1269 #1275 #1276 #1277 - ExecutionTypeInfo changed

These PRs are all somehow related.
The main change is that we renamed ExecutionTypeInfo to a more semantically correct ExecutionStepInfo since it contains much more information than just type information and it is actually focused around the current step of the execution.
We also changed the meaning of ExecutionStepInfo.type for non nullable types: previously it has been automatically unwrapped so that type was never NonNull.
If you used .getType() please change it to .getUnwrappedNonNullType() to avoid any logic changes.

Also castType was removed (just do the cast yourself if needed) and treatAs was renamed to changeTypeWithPreservedNonNull.

Other changes

#1269 - data fetchers can get their parents arguments

Sometimes a child data fetcher wants to lookup upwards and know what arguments are passed to its parents. This is now supported via the ExecutionStepInfo class. You can get the parent ExecutionStepInfo from the current field ExecutionStepInfo and also gets its arguments.

#1213

Directives are now considered children of graphql types and will be visited like other children. This allows you to write Traversals that find directives on graphql type objects and apply certain behaviours.

#1264 default methods on interfaces can now supply values to the property data fetcher

#1255 a possible deadlock in the data loader instrumentation tracking was fixed when DataLoader is not per execution

#1243 all the older BatchedExecutionStrategy code is deprecated. Use the DataLoader pattern instead

#1222 The handling of __typename was fixed that caused problems in max query complexity

#1203 the field paths now using the field alias of defined as the path name. This is more correct and specific.

All PRs can be seen here : https://github.com/graphql-java/graphql-java/pulls?q=is%3Apr+milestone%3A11.0

9.4

03 Oct 07:24
Compare
Choose a tag to compare
9.4

This release consists of a series of fixes on the 9.x stable branch of graphql-java

#1260
#1259
#1258
#1225

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

10.0

03 Sep 03:22
Compare
Choose a tag to compare

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+