Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Releases: graphql-java-kickstart/graphql-spring-boot

5.3.1

25 Nov 07:55
Compare
Choose a tag to compare

Only include exception handlers with return type GraphQLError

All exception handlers were attempted to be included when searching for custom GraphQLError exception handler methods. This resulted in methods being included that would not return a GraphQLError but were instead intended to be used by other Spring features. Therefore extended the filter now to only use those methods that actually return a GraphQLError or subclass.

5.3

22 Nov 17:23
Compare
Choose a tag to compare
5.3

Exception handler support

Support for Springs @ExceptionHandler annotation. By default graphql-java-servlet when an exception occurs while processing a GraphQL request the error returned to the caller is a GraphQLError with a simple message and InternalServerError type. All details regarding the exception that actually occurred are lost.

This release introduces the property graphql.servlet.exception-handlers-enabled, which is set to false by default. That ensures that the default behavior stays the same. By switching this property to true it will instead actually use the exception that was thrown to construct the GraphQLError response, e.g.:

{
  "data": null,
  "errors": [
    {
      "message": "User 'username' cannot be found at the Identity Provider",
      "type": "AccessDeniedException",
      "path": null,
      "extensions": null
    }
  ]
}

The message contains the message as represented by the exception and the type contains the simple name of the exception that was thrown.

In addition you can now add methods to your Spring beans annotated with Springs @ExceptionHandler. This way you can easily customize the errors you want to return depending on the exception that was thrown while processing a GraphQL request, e.g.:

@ExceptionHandler(Throwable.class)
GraphQLError handleException(Throwable e) {
    return new ThrowableGraphQLError(e);
}

This example would actually result in the exact same response as given in the example response above, but it shows the idea behind it. You can return any type of custom GraphQLError for this method, and you can have any number of methods annotated like this. It will select the method targeting the most concrete exception that was thrown.

5.2

17 Nov 16:47
Compare
Choose a tag to compare
5.2

Directives

Support for directives has been included now. See https://www.graphql-java-kickstart.com/spring-boot/directives/ for more details and basic usage.

Type Definition Factory

Added the type definition factory to make it possible to dynamically add type definitions after the SDL has been parsed. This is used to automatically generate Relay connection type definitions. See https://www.graphql-java-kickstart.com/spring-boot/type-definition-factory/ for more details.

Automatic generation of Relay Type Definitions

Relay Type Definitions can now be automatically generated using the @connection directive. See https://www.graphql-java-kickstart.com/tools/relay/ for more details and basic usage.

Renamed properties

Several properties have been renamed to be in line with Spring Boot standard:
graphql.tools.introspectionEnabled to graphql.tools.introspection-enabled
graphql.tools.schemaLocationPattern to graphql.tools.schema-location-pattern

GraphQL Tools Kotlin version

If you're using graphl-java-tools you need to set the kotlin.version in your Spring Boot project explicitly to version 1.3.10, because Spring Boot Starter parent currently overrides it with a 1.2.* version of Kotlin. graphql-java-tools requires 1.3.* however because of its coroutine support.

Spring Boot team has indicated the Kotlin version will be upgraded to 1.3 in Spring Boot 2.2.

Using Gradle

Set the Kotlin version in your gradle.properties

kotlin.version=1.3.10

Using Maven

Set the Kotlin version in your <properties> section

<properties>
  <kotlin.version>1.3.10</kotlin.version>
</properties>

5.1

15 Nov 20:01
Compare
Choose a tag to compare
5.1

Features

Upgraded graphql-java to the latest version, 11.0. See their release notes for more details.

Bugfix

#154: Graphiql doesn't load in offline environment

5.0.6

26 Oct 15:13
Compare
Choose a tag to compare

Support Java 11

Upgraded commons-lang3 to version 3.8.1 to support Java 11.

Fixed subscription auto configuration

Subscriptions were broken because of a change in the autoconfiguration. Reverted that change from:

@Bean 
@ConditionalOnMissingBean 
@ConditionalOnBean(ServerContainer.class) 
public ServerEndpointExporter serverEndpointExporter() { return new ServerEndpointExporter(); }

back to:

@Bean 
@ConditionalOnMissingBean 
@ConditionalOnClass(ServerContainer.class) 
public ServerEndpointExporter serverEndpointExporter() { return new ServerEndpointExporter(); }

This requires @SpringBootTest unit tests to use a webEnvironment because they won't run otherwise.

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class YourTest {
  // ...
}

5.0.5

18 Oct 18:30
Compare
Choose a tag to compare

Enhancements

Configure servlet async mode

Added property for configuring async servlet mode:

graphql:
  servlet:
    asyncModeEnabled: true

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.

If you want you can disable the introspection query now by setting the following property:

graphql:
  tools:
    introspectionEnabled: false

Bugs

Spring Object Mapper overridden by GraphQL

The default Spring Object Mapper provided by Spring through JacksonAutoConfiguration was overridden by the one provided by GraphQL.

GraphiQL stylesheet and script failed loading on custom path

When GraphiQL is run on a custom path it would fail to load its stylesheet and javascript because the base path wasn't determined correctly.

Voyager static resources not served if app context is not root

When the application has a context different than root Voyager fails to start because its static resources are not found 404. This is because the HTML is configured as they were always in the root directory which is not the case.

GraphQLTest or SpringBootTest not working

In some configurations the @GraphQLTest wouldn't load properly. The @SpringBootTest would only work if it was configured to run with a webEnvironment, because otherwise it would fail due to missing ServerContainer. Both scenarios have been fixed in this release.

5.0.4

05 Oct 06:23
Compare
Choose a tag to compare

Updated Maven coordinates in Central

The artifacts are available in Maven Central starting with this version.

Use default ObjectMapper provided by Spring Boot

GraphQLWebAutoConfiguration now uses the default ObjectMapper provided by JacksonAutoConfiguration which can be customized using Jackson2ObjectMapperBuilderCustomizer.

5.0.3

30 Sep 08:57
Compare
Choose a tag to compare

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-spring-boot</artifactId>
    <version>5.0.3</version>
</dependency>

Gradle

compile 'com.graphql-java-kickstart:graphql-spring-boot:5.0.3'