Netflix / dgs-framework

GraphQL for Java with Spring Boot made easy.
https://netflix.github.io/dgs
Apache License 2.0
3.03k stars 286 forks source link

Add getSourceOrThrow helper method to DgsDataFetchingEnvironment #1947

Closed kilink closed 1 week ago

kilink commented 1 week ago

graphql-java 22.1 added nullability annotations to DataFetchingEnvironment methods such as getSource, which can make make the call-site overly verbose from Kotlin since the caller must handle the possibility of null. In this particular case, the method always returns a non-null value unless being called from the context of the root query, so having a helper that returns a non-null value is more ergonomic.