github Netflix/dgs-framework v3.10.2

latest releases: v8.6.0, v8.5.8, v8.5.7...
3 years ago

What’s Changed

Highlights

BOM

We now have a BOM/Gradle platform defined for the framework. A BOM helps to align versions of dependencies.
We have two different BOM definitions, graphql-dgs-platform-dependencies and graphql-dgs-platform. The latter only defines version alignment for the DGS modules. graphql-dgs-platform-dependencies also defines versions for the dependencies of the DGS framework, such as Spring, Jackson and Kotlin.

In a DGS project, you can use the BOM as follows.

dependencies {
        //DGS BOM/platform dependency. This is the only place you set version of DGS
	implementation(platform("com.netflix.graphql.dgs:graphql-dgs-platform-dependencies:3.10.2"))
	
        //DGS dependencies. We don't have to specify a version here!
        implementation("com.netflix.graphql.dgs:graphql-dgs-spring-boot-starter")
	implementation("com.netflix.graphql.dgs:graphql-dgs-subscriptions-websockets-autoconfigure")

       //Additional Jackson dependency. We don't need to specify a version, because Jackson is part of the BOM/platform definition.
       implementation("com.fasterxml.jackson.datatype:jackson-datatype-joda")
        
       //Other dependencies
}

Notice that the version is only specified on the platform dependency, and not on the graphql-dgs-spring-boot-starter and graphql-dgs-subscriptions-websockets-autoconfigure. The BOM will make sure that all dependencies are the same version. Additionally, we can use the DGS chosen version of some dependencies as well, such as Jackson.

Note that the versions in the platform are recommendations. The versions can be overridden by the user, or by other platforms you might be using (such as the Spring dependency-management plugin).

Shorthand annotations

We've added shorthand annotations for defining @DgsData fields on Query/Mutation/Subscription.

The following datafetcher definitions are all equivalent.

@DgsData(parentType = "Query", field = "shows")
public List<Show> shows() { .... }

// The "field" argument is omitted. It uses the method name as the field name.
@DgsData(parentType = "Query")
public List<Show> shows() { .... }

// The parentType is "Query", the field name is derived from the method name.
@DgsQuery
public List<Show> shows() { .... }

// The parentType is "Query", the field name is explicitly specified.
@DgsQuery(field = "shows")
public List<Show> shows() { .... }

The same works for @DgsMutation and @DgsSubscription.

Support for @RequestParam

Thanks to @iuliiasobolevska you can now use the @RequestParam annotation as a datafetcher argument.
This is very similar to the @RequestHeader we previously added, but gets a request parameter.

@DgsQuery
public List<Show> shows(@RequestParam String someParameter) { ... }

Complete list of merged pull requests

  • Added @DgsMutation, @DgsQuery and @DgsSubscription (#190) @paulbakker
  • Add validation to DgsWebMvcConfigurationProperties (manual approach) (#176) @bono007
  • Fix for #130:Unsafe TypedGraphQLError constants (INTERNAL, NOT_FOUND...) (#184) @paulbakker
  • Account for custom servlet context paths in GraphiQL callback (#175) @bono007
  • DgsContextBuilder should not have state (#183) @paulbakker
  • Introduce a Platform BOM (#203) @berngp
  • Use AopUtils to find target classes for proxies (#196) @kilink
  • Add support for Spring's @RequestParam annotation (#199) @iuliiasobolevska
  • Fixing Sonatype deployment by using mathematical notation when defining versions (#224) in the BOM. @berngp

Enjoy the release, and we already have a number of features lined up for another release that will follow soon!

Don't miss a new dgs-framework release

NewReleases is sending notifications on new releases.