github Netflix/dgs-framework v3.11.0
3.11.0

latest releases: v9.0.2, v9.0.1, v9.0.0...
3 years ago

What’s Changed

Highlights

Support for Optional input arguments

Input arguments are often defined as optional in schemas.
Your datafetcher code needs to null-check arguments to check if they were provided.
Instead of null-checks you can wrap an input argument in an Optional.

public List<Show> shows(@InputArgument(collectionType = ShowFilter.class) Optional<ShowFilter> filter)

You do need to provide the type in the collectionType argument when using complex types, similar to using lists.
If the argument is not provided, the value will be Optional.empty().
It's a matter of preference to use Optional or not.

Auto-Configuration that registers graphql-java-extended-scalars' Scalars

If you use scalars from the graphql-java-extended-scalars library, such as Long, we now have a convenient way to register the scalars to your DGS. Simply add the graphql-dgs-extended-scalars module to your Gradle/Maven build and the scalars will be automatically registered.
More information about further configuration knobs can be found in the docs.

Configure the location of the GraphQL Schema Files

You can now configure the location of your GraphQL schema files via the dgs.graphql.schema-locations property.
By default it will attempt to load them from the schema directory via the Classpath, i.e. using classpath*:schema/**/*.graphql*.
Let's go through an example, let's say you want to change the directory from being schema to graphql-schemas,
you would define your configuration as follows:

dgs:
    graphql:
        schema-locations:
            - classpath*:graphql-schemas/**/*.graphql*

Now, if you want to add additional locations to look for the GraphQL Schema files you an add them to the list.
For example, let's say we want to also look into your graphql-experimental-schemas:

dgs:
    graphql:
        schema-locations:
            - classpath*:graphql-schemas/**/*.graphql*
            - classpath*:graphql-experimental-schemas/**/*.graphql*

Complete list of merged pull requests

  • Bugfix: Allow JSON Documents with DateTime scalars to be deserialized to Objects (#271) @richardcresswell
  • Use Micrometer APIs compatible with both Micrometer 1.5 and 1.6 (#268) @berngp
  • Support Optional for @InputArgument (#267) @paulbakker
  • Fix for #250, defaultValue and required arguments (#264) @paulbakker
  • Update versions for Spring, Spring Security, Spring Cloud, Kotlin, and Jackson (#263) @berngp
  • Upgrading to Spring Boot to 2.3.9.RELEASE (#261) @berngp
  • Exceptions thrown by DgsEntityFetcher should be handled (#253) @srinivasankavitha
  • Revert "Update Gradle Wrapper from 6.8.3 to 7.0" (#254) @berngp
  • Update Gradle Wrapper from 6.8.3 to 7.0 (#252) @github-actions
  • Use DgsQueryExecutor instead of MockMVC (#244) @berngp
  • Auto-Configuration that registers graphql-java-extended-scalars' Scalars (#242) @berngp
  • Define a recommendation for graphql-java-extended-scalars (#232) @berngp
  • Fix for #200. Annotations should respect @AliasFor (#227) @paulbakker
  • The Platform is exposed as API to address composite builds (#225) @berngp
  • Introduced dgs.graphql.schema-locations configuration property (#210) @marceloverdijk
  • Allow specifying the operation name and query names (#195) @lucastorri

Don't miss a new dgs-framework release

NewReleases is sending notifications on new releases.