-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add support for object default values to kotlin codegen
- Loading branch information
Showing
9 changed files
with
297 additions
and
6 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...om/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForObject/expected/DgsClient.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.netflix.graphql.dgs.codegen.cases.inputWithDefaultValueForObject.expected | ||
|
||
public object DgsClient |
27 changes: 27 additions & 0 deletions
27
...netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForObject/expected/DgsConstants.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.netflix.graphql.dgs.codegen.cases.inputWithDefaultValueForObject.expected | ||
|
||
import kotlin.String | ||
|
||
public object DgsConstants { | ||
public object PERSON { | ||
public const val TYPE_NAME: String = "Person" | ||
|
||
public const val Name: String = "name" | ||
|
||
public const val Age: String = "age" | ||
|
||
public const val Car: String = "car" | ||
} | ||
|
||
public object CAR { | ||
public const val TYPE_NAME: String = "Car" | ||
|
||
public const val Brand: String = "brand" | ||
} | ||
|
||
public object MOVIEFILTER { | ||
public const val TYPE_NAME: String = "MovieFilter" | ||
|
||
public const val Director: String = "director" | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...om/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForObject/expected/types/Car.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.netflix.graphql.dgs.codegen.cases.inputWithDefaultValueForObject.expected.types | ||
|
||
import com.netflix.graphql.dgs.codegen.GraphQLInput | ||
import kotlin.Any | ||
import kotlin.Pair | ||
import kotlin.String | ||
import kotlin.collections.List | ||
|
||
public class Car( | ||
public val brand: String, | ||
) : GraphQLInput() { | ||
override fun fields(): List<Pair<String, Any?>> = listOf("brand" to brand) | ||
} |
13 changes: 13 additions & 0 deletions
13
...ix/graphql/dgs/codegen/cases/inputWithDefaultValueForObject/expected/types/MovieFilter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.netflix.graphql.dgs.codegen.cases.inputWithDefaultValueForObject.expected.types | ||
|
||
import com.netflix.graphql.dgs.codegen.GraphQLInput | ||
import kotlin.Any | ||
import kotlin.Pair | ||
import kotlin.String | ||
import kotlin.collections.List | ||
|
||
public class MovieFilter( | ||
public val director: Person? = default<MovieFilter, Person?>("director"), | ||
) : GraphQLInput() { | ||
override fun fields(): List<Pair<String, Any?>> = listOf("director" to director) | ||
} |
17 changes: 17 additions & 0 deletions
17
...netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForObject/expected/types/Person.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.netflix.graphql.dgs.codegen.cases.inputWithDefaultValueForObject.expected.types | ||
|
||
import com.netflix.graphql.dgs.codegen.GraphQLInput | ||
import kotlin.Any | ||
import kotlin.Int | ||
import kotlin.Pair | ||
import kotlin.String | ||
import kotlin.collections.List | ||
|
||
public class Person( | ||
public val name: String? = default<Person, String?>("name"), | ||
public val age: Int? = default<Person, Int?>("age"), | ||
public val car: Car? = default<Person, Car?>("car"), | ||
) : GraphQLInput() { | ||
override fun fields(): List<Pair<String, Any?>> = listOf("name" to name, "age" to age, "car" to | ||
car) | ||
} |
13 changes: 13 additions & 0 deletions
13
...otlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForObject/schema.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
input Person { | ||
name: String = "" | ||
age: Int = 0 | ||
car: Car = { brand: "Ford" } | ||
} | ||
|
||
input Car { | ||
brand: String! = "BMW" | ||
} | ||
|
||
input MovieFilter { | ||
director: Person = { name: "Damian", car: { brand: "Tesla" } } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters