Bot releases are visible (Hide)
Published by andimarek about 3 years ago
This is a bugfix release which contains the following changes:
https://github.com/graphql-java/graphql-java/milestone/36?closed=1
Published by bbakerman about 3 years ago
This release upgrade the DataLoader library to 3.1.0
which adds the ability to have an external value cache in place during data loader batch calls.
You can use it to model access to external caches like REDIS amd even do batch "cache gets".
Published by bbakerman about 3 years ago
We are happy to announce v17.0 of graphql-java
https://github.com/graphql-java/graphql-java/milestone/31?closed=1
@deprecated
supported on input fieldsIn line with coming graphql spec changes, the @deprecated
annotation can now be placed on input fields and not just output fields as before.
https://github.com/graphql-java/graphql-java/pull/2186
GraphQLSchema
buildingThe GraphQLSchema
is a graph of types and as such has to be built according to strict rules. The previous code would repeated visit and rebuilt the schema and this meant that large schemes could be slow to build.
This code has been extensively benchmarked and improved. For example on a very large and complex schema, total build time went from 3.5 seconds to 1.2 seconds.
Thank you to teams out there that used https://github.com/graphql-java/graphql-anonymizer to submit in real life schemas that we can test with.
DataFetchingFieldSelectionSet
The classes that underlie the DataFetchingFieldSelectionSet
code have been been remodelled to be dramatically more performant. Before interfaces could create an exponential explosion in objects created. This has been fixed which in turn improves the performance of this code as scale.
The graphql spec calls for overlapping fields in fragments to be validated in a certain way. The previous code followed the specs psudeo-algorithm correctly but it leads to asymptotic performance problems.
This has been rewritten via https://github.com/graphql-java/graphql-java/pull/2495 based on this article https://tech.xing.com/graphql-overlapping-fields-can-be-merged-fast-ea6e92e0a01 which dramatically improves how fast large queries can validated.
#2221 this is a non spec feature which lets you expose directives through Introspection
#2325 This is a relatively big change which fixed up how default values are processed. Before that default values were never validated and custom Scalars could cause invalid values printed in SDL or Introspection. This PR includes a new Scalar coercion function valueToLiteral
which is needed to implement this correct behaviour.
https://github.com/graphql-java/graphql-java/pull/2404 allows for better Unicode expression in queries and SDL documents
https://github.com/graphql-java/graphql-java/pull/2368 allows for a well known API for context within a graphql request. Previously any opaque object could be used and framework could was not able to make any assumptions about adding their own context properties
The old mechanism has been deprecated and a singleton (buy mutable) context object is now how context is passed around.
Characters in a graphql document that are not significant to the syntax, such as spaces, new lines and comms, used to be captured in memory against AST nodes.
This is no longer the case and it saves memory from parsed documents. There is a switch to turn on the old behavior intended for tooling code.
https://github.com/graphql-java/graphql-java/pull/2394
graphql-java operates in a asynchronous world and hence the code that handles exceptions in data fetchers should itself allow asynchronous handling.
https://github.com/graphql-java/graphql-java/pull/2371
graphql-java used to have non standard scalars like Byte
, Short
and Long
etc... These deprecated scalars have finally been removed and now reside in the https://github.com/graphql-java/graphql-java-extended-scalars library
The boolean values acceptable as variable input the Boolean scalar have been tightened to true
and false
- see https://github.com/graphql-java/graphql-java/pull/2419
The non standard @Fetch
directive support has been removed by default and deprecated. This was done for performance reasons because very few people used it but it slowed down schema creation a lot
The long deprecated BatchedExecutionStrategy
and ExecutorServiceExecutionStrategy
have finally been removed
The non standard scalars like Long
and Short
have been removed and moved to https://github.com/graphql-java/graphql-java-extended-scalars
Published by bbakerman about 3 years ago
An initial beta 1 release of 17.0.
We consider this production ready, but we are seeking feedback from early adopters, therefor the beta1 release.
https://github.com/graphql-java/graphql-java/milestone/31?closed=1
@deprecated
supported on input fieldsIn line with coming graphql spec changes, the @deprecated
annotation can now be placed on input fields and not just output fields as before.
https://github.com/graphql-java/graphql-java/pull/2186
GraphQLSchema
buildingThe GraphQLSchema
is a graph of types and as such has to be built according to strict rules. The previous code would repeated visit and rebuilt the schema and this meant that large schemes could be slow to build.
This code has been extensively benchmarked and improved. For example on a very large and complex schema, total build time went from 3.5 seconds to 1.2 seconds.
Thank you to teams out there that used https://github.com/graphql-java/graphql-anonymizer to submit in real life schemas that we can test with.
DataFetchingFieldSelectionSet
The classes that underlie the DataFetchingFieldSelectionSet
code have been been remodelled to be dramatically more performant. Before interfaces could create an exponential explosion in objects created. This has been fixed which in turn improves the performance of this code as scale.
https://github.com/graphql-java/java-dataloader has been upgraded to the new 3.0.1 version which adds new capabilities on external value caching.
#2221 this is a non spec feature which lets you expose directives through Introspection
#2325 This is a relatively big change which fixed up how default values are processed. Before that default values were never validated and custom Scalars could cause invalid values printed in SDL or Introspection. This PR includes a new Scalar coercion function valueToLiteral
which is needed to implement this correct behaviour.
https://github.com/graphql-java/graphql-java/pull/2404 allows for better Unicode expression in queries and SDL documents
https://github.com/graphql-java/graphql-java/pull/2368 allows for a well known API for context within a graphql request. Previously any opaque object could be used and framework could was not able to make any assumptions about adding their own context properties
The old mechanism has been deprecated and a singleton (buy mutable) context object is now how context is passed around.
Characters in a graphql document that are not significant to the syntax, such as spaces, new lines and comms, used to be captured in memory against AST nodes.
This is no longer the case and it saves memory from parsed documents. There is a switch to turn on the old behavior intended for tooling code.
https://github.com/graphql-java/graphql-java/pull/2394
graphql-java operates in a asynchronous world and hence the code that handles exceptions in data fetchers should itself allow asynchronous handling.
https://github.com/graphql-java/graphql-java/pull/2371
The boolean values acceptable as variable input the Boolean scalar have been tightened to true
and false
- see https://github.com/graphql-java/graphql-java/pull/2419
The non standard @Fetch
directive support has been removed by default and deprecated. This was done for performance reasons because very few people used it but it slowed down schema creation a lot
The new DataLoader upgrade has changed the signature of the future cache to be more correct.
The long deprecated BatchedExecutionStrategy
and ExecutorServiceExecutionStrategy
have finally been removed
Published by andimarek over 3 years ago
This is a bugfix release containing the following fixes and improvements:
https://github.com/graphql-java/graphql-java/milestone/33?closed=1
The most important ones are
#2168 Bugfix: caching of visited fragments in Normalized tree
#2173 Ensure NormalizedQueryTreeFactory handles mutations and subscriptions
Published by bbakerman almost 4 years ago
This is a bugfix release for the 16.0 version: Checkout the full 16.0 release notes
graphql-java shades in the Google immutable collections.
However we missed a package that was required and https://github.com/graphql-java/graphql-java/issues/2107 was the result.
This has been fixed in this 16.1 release.
Additionally it contains two other PRs:
#2113 Introspection for repeatable directive
#2111 Fixes module name
Published by bbakerman almost 4 years ago
After a very lengthy time between releases, we are happy to announce that v16.0 of graphql-java is now available.
It adds new capabilities based on updated graphql specification and as usual a mix of bug fixes and performance improvements.
The graphql specification now allows repeated directives on an element. This adds support for this. The is a breaking change because now there can be more than 1 directives for a given name and this was not true prior to this release.
We have revamped the DataFetchingFieldSelectionSet so that it can handle non concrete types such as Unions. This is a breaking change but it significantly increases the ability to look ahead at all "possible" field selections and hence allow you to
do your own data retrieval optimisations even better.
It is now easier to customise the data fetcher exception handler, without requiring you to instantiate your own execution strategies.
The validation code that ensures the schema conforms to specification has been improved. We have more SDL based validation and also we have post schema building validation to ensure types are specification compliant.
We have added more code to help better support persistent queries. This includes basic implementations of the Apollo pattern for nominating persistent queries via query input extensions.
As we worked towards releasing v16.0 we decided to attack the immutability of the objects
used in the code base. We reasoned that Immutable data structures would be more reliable
and they MAY be faster as less list / map copying needs to happen in order to pass
data around.
One thing that graphql-java does a lot of is pass a lot of lists and maps around. A graphql
engine is by specification a giant list and map generator.
We reasoned that because Immutable collections can do tricks when copying data (if its already immutable it can just no-op the copy)
then this may favour our code base.
List<Foo> fooList = ImmutableList.of("a","b","c");
//
// no actual copying takes place in this classes because
// the list is an immutable collection already
//
List<Foo> copiedFooList = ImmutableList.copyOf(fooList);
Benchmarks of the code confirmed this to be faster and also reduce memory pressure..
We have a lot of performance improvements in this release. Some of them are significant improvements for systems at high scale.
#2008 changed the error holder class
#2019 Faster Property fetching with derived classes
#2020 pre-sizing internal data structures
#2067 Support for Streams and Iterators
#2074 avoiding allocations in FieldCollectorParameters and MergedField
#2086 Use Immutable collections to avoid memory copying
#2023 ExecutionStepInfo optimisations to make it more performant
Published by andimarek over 4 years ago
This is the first bugfix release for the current LTS 14.x.
Published by andimarek over 4 years ago
This is an important release which comes with two new major features and a bunch of performance improvements:
This change allows interfaces to be implement by other interfaces instead of just objects.
This post explains the motivation and the background for it
This lets you define a specification URL for a custom Scalar, which documents how this Scalar works.
This talk explains some background.
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
It is now allowed to use directives on variable declaration.
#1804 DataFethcerResult can now be returned from subscription fetchers
#1801 Fixes the Subscription publisher so that it does not drop values at scale.
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.
Published by andimarek almost 5 years ago
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
Published by andimarek almost 5 years ago
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:
ID
scalar was changed to serialize all objects (#1693)java.util.Locale
available on the DataFetcherEnvironment
set when you start executing a query (#1576)getArgumentOrDefault
to DataFetcherEnvironment
(#1659)But the impact really depends on your specific use, so please have a look at the complete list below.
#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
#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.
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
Published by bbakerman over 5 years ago
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.
You now have to opt in to getting @defer behavior whereas before it as the default
Previously only the query string was passed to the PreparsedDocumentProvider but now it receives the full execution input
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.
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
Not all AST elements that can have directives are actually NamedNode
s so this has been changed
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.
DataFetcherResult
can now be returnedPreviously 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.
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
This makes it a bit easier to decide if sub selected fields are present
We now generate filled outgraphql.schema.GraphQLDirective
objects for the directives on a field at fetch time.
Published by bbakerman over 5 years ago
This is the next stable release of graphql-java
There are two fixes applied
Published by andimarek over 5 years ago
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 https://github.com/graphql-java/graphql-java/pull/1335#issuecomment-443476271 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.
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
)
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.
ExecutionContext was removed from DataFetcherEnvironment in favour of adding more properties to the DataFetcherEnvironment directly.
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.
This makes the schema directive wiring occur after the type has been built and hence the callback gets full access to the type hierarchy
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.
Published by andimarek over 5 years ago
Maintenance release for the stable branch 9.x with:
Full list of PRS:
https://github.com/graphql-java/graphql-java/pulls?utf8=%E2%9C%93&q=milestone%3A%229.5%22
Published by bbakerman almost 6 years ago
#1263 - DataLoader Scope changes
The dataloader support in graphql-java has been changed to encourage the right behavior. The DataLoaderRegistry
and its contained DataLoader
s 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
.
#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
Published by bbakerman about 6 years ago
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+
Published by bbakerman about 6 years ago
The biggest breaking is the mutability and the general design of Ast Nodes:
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.
#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
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.
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.
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
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
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
https://github.com/graphql-java/graphql-java/pulls?utf8=%E2%9C%93&q=+is%3Apr+milestone%3A10.0+
Published by bbakerman about 6 years ago
This is a bugfix release to address mainly the following things:
#1191 race conditions in data loader dispatching
#1182 fix null element
#1150 class cast exception in schema generation
#1142 validate input variables
#1113 npe in field tracking during dispatch
#1159 fix json encoding of values
See https://github.com/graphql-java/graphql-java/pulls?q=is%3Apr+milestone%3A9.3
Published by andimarek over 6 years ago
This releases fixes a single regression from 9.1:
https://github.com/graphql-java/graphql-java/pull/1118