Skip to content

Update spring boot dgs example #254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 20 additions & 21 deletions examples/dgs-spring-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<description>Example for using neo4j-graphql-java with Spring Boot and Netflix Domain Graph Service (DGS)</description>

<properties>
<testcontainers.version>1.16.0</testcontainers.version>
<spring-boot.version>2.3.10.RELEASE</spring-boot.version>
<testcontainers.version>1.16.2</testcontainers.version>
<spring-boot.version>2.5.6</spring-boot.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -46,7 +46,12 @@
<dependency>
<groupId>com.netflix.graphql.dgs</groupId>
<artifactId>graphql-dgs-spring-boot-starter</artifactId>
<version>3.12.1</version>
<version>4.8.3</version>
</dependency>
<dependency>
<groupId>com.netflix.graphql.dgs.codegen</groupId>
<artifactId>graphql-dgs-codegen-client-core</artifactId>
<version>5.1.9</version>
</dependency>

<!-- Kotlin dependencies -->
Expand Down Expand Up @@ -100,6 +105,17 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<configuration>
<sourceDirs>
<source>src/main/kotlin</source>
<source>${project.build.directory}/generated-sources</source>
</sourceDirs>
</configuration>
</plugin>
<plugin>
<groupId>org.neo4j</groupId>
Expand Down Expand Up @@ -131,7 +147,7 @@
<plugin>
<groupId>io.github.deweyjose</groupId>
<artifactId>graphqlcodegen-maven-plugin</artifactId>
<version>1.10</version>
<version>1.14</version>
<executions>
<execution>
<goals>
Expand All @@ -150,23 +166,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import org.neo4j.graphql.examples.dgsspringboot.types.DgsConstants
import org.neo4j.graphql.examples.dgsspringboot.types.client.MoviesGraphQLQuery
import org.neo4j.graphql.examples.dgsspringboot.types.client.MoviesProjectionRoot
import org.neo4j.graphql.examples.dgsspringboot.types.types.Movie
import org.neo4j.graphql.examples.dgsspringboot.types.types.MovieOptions
import org.neo4j.graphql.examples.dgsspringboot.types.types.MovieSort
import org.neo4j.graphql.examples.dgsspringboot.types.types.SortDirection
import org.skyscreamer.jsonassert.JSONAssert
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
Expand Down Expand Up @@ -56,8 +59,9 @@ internal class AdditionalDataFetcherTest(
fun testHybridDataFetcher() {

val graphQLQueryRequest = GraphQLQueryRequest(
// there is an issue with empty fields of input type (https://github.com/Netflix/dgs-codegen/issues/140)
MoviesGraphQLQuery(),
MoviesGraphQLQuery.newRequest()
.options(MovieOptions(sort = listOf(MovieSort(title = SortDirection.DESC))))
.build(),
MoviesProjectionRoot().also { movie ->
movie.title()
movie.bar()
Expand All @@ -68,7 +72,7 @@ internal class AdditionalDataFetcherTest(
)

val request = graphQLQueryRequest.serialize()
Assertions.assertThat(request).isEqualTo("query {movies{ title bar javaData { name } } }")
Assertions.assertThat(request).isEqualTo("query {movies(options: {sort:[{title:DESC }] }){ title bar javaData { name } } }")

val response = dgsQueryExecutor.executeAndGetDocumentContext(request)

Expand All @@ -78,11 +82,11 @@ internal class AdditionalDataFetcherTest(
"data": {
"movies": [
{
"title": "The Matrix",
"title": "The Matrix Revolutions",
"bar": "foo",
"javaData": [
{
"name": "test The Matrix"
"name": "test The Matrix Revolutions"
}
]
},
Expand All @@ -96,11 +100,11 @@ internal class AdditionalDataFetcherTest(
]
},
{
"title": "The Matrix Revolutions",
"title": "The Matrix",
"bar": "foo",
"javaData": [
{
"name": "test The Matrix Revolutions"
"name": "test The Matrix"
}
]
}
Expand Down