Releases: graphql-java-kickstart/graphql-java-tools
5.3.4
Support for PropertyDataFetcher behavior
When using graphql-java alone and taking the approach of writing DataFetchers, the framework will allow you to return a Map object that contains the property names and values for the corresponding GraphQL type and the framework will then map this to the appropriate GraphQL type using the PropertyDataFetcher (as described in https://graphql-java.readthedocs.io/en/latest/schema.html under DataFetcher and TypeResolver).
This same behavior was not supported when using graphql-java-tools with the GraphQLResolver approach up until now.
Here is an example:
public class Book {
private int id;
private String name;
private int authorId;
// constructor and getters/setters ...
}
public class BookResolver implements GraphQLResolver<Book> {
public Map author(Book book) {
return Collections.unmodifiableMap(new HashMap<String, Object>() {
{
put("id", "1");
put("name", "smith");
}
});
}
}
The GraphQL schema file is:
type Query {
books: [Book!]
}
type Book {
id: Int!
name: String!
author: Author!
}
type Author {
id: Int!
name: String!
}
Option for disabling introspection query
Graphql-java provides a feature to disable the introspection query: https://graphql-java.readthedocs.io/en/latest/execution.html?highlight=introspection#limiting-field-visibility. They do warn that it puts your server in contravention of the GraphQL specification and expectations of most clients so use this with caution.
5.3.3
5.3.1
Changed organization
Starting with this release the project has moved out of the graphql-java organization into graphql-java-kickstart. This because they are in fact separate projects where maintainers of the one actually weren't involved in maintenance of the other. This resulted in it becoming quite unclear what is actually graphql-java and what was a library on top. This confusion was clearly visible in the Gitter channel as well. That's why we split the projects and the Gitter channels.
Maven
<dependency>
<groupId>com.graphql-java-kickstart</groupId>
<artifactId>graphql-java-tools</artifactId>
<version>5.3.1</version>
</dependency>
Gradle
compile 'com.graphql-java-kickstart:graphql-java-tools:5.3.1'
Support for generic types
Support for generics has been improved. This makes it easier to implement pagination for example. Instead of having to create concrete classes one could now do:
import graphql.relay.Connection
import graphql.relay.SimpleListConnection
@Component
class QueryResolver implements GraphQLQueryResolver {
private UserService userService;
Connection<User> users(int first, String after, DataFetchingEnvironment env) {
return new SimpleListConnection<User>(userService.filter(page, size)).get(env);
}
}
Updated graphql-java dependency
Updated to the latest 10.0 version of graphql-java.