Skip to content

Commit b60525b

Browse files
Merge pull request #541 from Netflix/bug-fixes
Do not apply maxProjectionDepth for client V2 API, not required to limit the generation.
2 parents 0f283a0 + dd15435 commit b60525b

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/java/ClientApiGeneratorv2.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ class ClientApiGeneratorv2(private val config: CodeGenConfig, private val docume
502502
.filter { it.name == type.name }
503503
.flatMap { it.fieldDefinitions }
504504

505-
val codeGenResult = if (queryDepth < config.maxProjectionDepth || config.maxProjectionDepth == -1) {
505+
val codeGenResult =
506506
fieldDefinitions
507507
.filterSkipped()
508508
.mapNotNull {
@@ -536,7 +536,6 @@ class ClientApiGeneratorv2(private val config: CodeGenConfig, private val docume
536536
createSubProjection(typeDef, javaType.build(), root, "${typeDef.name.capitalized()}", updatedProcessedEdges, queryDepth + 1)
537537
}
538538
.fold(CodeGenResult()) { total, current -> total.merge(current) }
539-
} else CodeGenResult()
540539

541540
fieldDefinitions
542541
.filterSkipped()

graphql-dgs-codegen-core/src/test/kotlin/com/netflix/graphql/dgs/codegen/clientapi/ClientApiGenQueryTest.kt

+1
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ class ClientApiGenQueryTest {
225225
type Query {
226226
movies(filter: MovieQuery): [String]
227227
}
228+
228229
229230
input MovieQuery {
230231
booleanQuery: BooleanQuery!

graphql-dgs-codegen-core/src/test/kotlin/com/netflix/graphql/dgs/codegen/clientapiv2/ClientApiGenProjectionTestv2.kt

+4-5
Original file line numberDiff line numberDiff line change
@@ -491,17 +491,17 @@ class ClientApiGenProjectionTestv2 {
491491
CodeGenConfig(
492492
schemas = setOf(schema),
493493
packageName = basePackageName,
494-
generateClientApiv2 = true,
495-
maxProjectionDepth = 2
494+
generateClientApiv2 = true
496495
)
497496
).generate()
498497

499-
assertThat(codeGenResult.clientProjections.size).isEqualTo(5)
498+
assertThat(codeGenResult.clientProjections.size).isEqualTo(6)
500499
assertThat(codeGenResult.clientProjections[0].typeSpec.name).isEqualTo("MoviesProjectionRoot")
501500
assertThat(codeGenResult.clientProjections[1].typeSpec.name).isEqualTo("RatingProjection")
502501
assertThat(codeGenResult.clientProjections[2].typeSpec.name).isEqualTo("ReviewProjection")
503502
assertThat(codeGenResult.clientProjections[3].typeSpec.name).isEqualTo("ActorProjection")
504503
assertThat(codeGenResult.clientProjections[4].typeSpec.name).isEqualTo("AgentProjection")
504+
assertThat(codeGenResult.clientProjections[5].typeSpec.name).isEqualTo("AddressProjection")
505505

506506
assertCompilesJava(codeGenResult.clientProjections + codeGenResult.javaQueryTypes)
507507
}
@@ -711,8 +711,7 @@ class ClientApiGenProjectionTestv2 {
711711
CodeGenConfig(
712712
schemas = setOf(schema),
713713
packageName = basePackageName,
714-
generateClientApiv2 = true,
715-
maxProjectionDepth = 2
714+
generateClientApiv2 = true
716715
)
717716
).generate()
718717

0 commit comments

Comments
 (0)