From cd71b3aaa4c183008fc841507d0ef3ff7a3cee27 Mon Sep 17 00:00:00 2001 From: kkatelia Date: Thu, 21 Mar 2024 16:43:00 -0700 Subject: [PATCH] fix linting --- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 32 +-- .../expected/client/PersonProjection.kt | 20 +- .../expected/client/QueryProjection.kt | 12 +- .../expected/types/Person.kt | 66 +++---- .../expected/types/PersonFilter.kt | 4 +- .../expected/types/Query.kt | 40 ++-- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 34 ++-- .../expected/client/PersonProjection.kt | 20 +- .../expected/client/QueryProjection.kt | 12 +- .../expected/types/Person.kt | 66 +++---- .../expected/types/PersonFilter.kt | 11 +- .../expected/types/Query.kt | 40 ++-- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 22 +-- .../expected/client/PersonProjection.kt | 20 +- .../expected/client/QueryProjection.kt | 8 +- .../expected/types/Person.kt | 24 +-- .../expected/types/Query.kt | 40 ++-- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 22 +-- .../expected/client/PersonProjection.kt | 20 +- .../expected/client/QueryProjection.kt | 16 +- .../expected/types/Person.kt | 66 +++---- .../expected/types/Query.kt | 66 +++---- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 22 +-- .../expected/client/PersonProjection.kt | 30 +-- .../expected/client/QueryProjection.kt | 8 +- .../expected/types/Person.kt | 92 +++++---- .../expected/types/Query.kt | 40 ++-- .../cases/dataClassDocs/expected/DgsClient.kt | 4 +- .../dataClassDocs/expected/DgsConstants.kt | 30 +-- .../expected/client/MovieProjection.kt | 10 +- .../expected/client/QueryProjection.kt | 10 +- .../dataClassDocs/expected/types/Movie.kt | 40 ++-- .../expected/types/MovieFilter.kt | 4 +- .../dataClassDocs/expected/types/Query.kt | 40 ++-- .../dataClassFieldDocs/expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 30 +-- .../expected/client/MovieProjection.kt | 10 +- .../expected/client/QueryProjection.kt | 10 +- .../expected/types/Movie.kt | 46 +++-- .../expected/types/MovieFilter.kt | 4 +- .../expected/types/Query.kt | 40 ++-- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 16 +- .../expected/client/QueryProjection.kt | 8 +- .../expected/types/Person.kt | 13 +- .../expected/types/Query.kt | 40 ++-- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 18 +- .../expected/client/QueryProjection.kt | 10 +- .../client/RequiredTestTypeProjection.kt | 10 +- .../expected/types/Query.kt | 40 ++-- .../expected/types/RequiredTestType.kt | 40 ++-- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 56 +++--- .../client/EntityConnectionProjection.kt | 20 +- .../expected/client/EntityEdgeProjection.kt | 18 +- .../expected/client/EntityProjection.kt | 20 +- .../expected/client/PageInfoProjection.kt | 40 ++-- .../expected/client/QueryProjection.kt | 20 +- .../expected/types/Entity.kt | 66 +++---- .../expected/types/EntityConnection.kt | 66 +++---- .../expected/types/EntityEdge.kt | 66 +++---- .../expected/types/PageInfo.kt | 118 ++++++------ .../expected/types/Query.kt | 66 +++---- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 46 ++--- .../expected/client/CarProjection.kt | 28 +-- .../expected/client/EngineProjection.kt | 40 ++-- .../expected/client/PerformanceProjection.kt | 20 +- .../expected/client/QueryProjection.kt | 8 +- .../expected/types/Car.kt | 92 +++++---- .../expected/types/Engine.kt | 118 ++++++------ .../expected/types/Performance.kt | 66 +++---- .../expected/types/Query.kt | 40 ++-- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 22 +-- .../expected/client/PersonProjection.kt | 20 +- .../expected/client/QueryProjection.kt | 8 +- .../expected/types/Person.kt | 24 +-- .../expected/types/Query.kt | 40 ++-- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 32 +-- .../expected/client/EmployeeProjection.kt | 30 +-- .../expected/client/PersonProjection.kt | 30 +-- .../expected/client/QueryProjection.kt | 8 +- .../expected/types/Employee.kt | 96 +++++---- .../expected/types/Person.kt | 26 +-- .../expected/types/Query.kt | 40 ++-- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 46 ++--- .../expected/client/EmployeeProjection.kt | 38 ++-- .../expected/client/PersonProjection.kt | 30 +-- .../expected/client/QueryProjection.kt | 8 +- .../expected/client/TalentProjection.kt | 40 ++-- .../expected/types/Employee.kt | 32 +-- .../expected/types/Person.kt | 18 +- .../expected/types/Query.kt | 40 ++-- .../expected/types/Talent.kt | 124 ++++++------ .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 20 +- .../expected/client/PersonProjection.kt | 20 +- .../expected/client/QueryProjection.kt | 8 +- .../expected/types/Person.kt | 66 +++---- .../expected/types/Query.kt | 40 ++-- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 34 ++-- .../expected/client/EntityProjection.kt | 18 +- .../expected/client/NodeProjection.kt | 26 +-- .../expected/client/ProductProjection.kt | 10 +- .../expected/client/QueryProjection.kt | 8 +- .../expected/types/Entity.kt | 20 +- .../expected/types/Product.kt | 42 ++-- .../expected/types/Query.kt | 40 ++-- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 56 +++--- .../client/EntityConnectionProjection.kt | 20 +- .../expected/client/EntityEdgeProjection.kt | 18 +- .../expected/client/EntityProjection.kt | 20 +- .../expected/client/PageInfoProjection.kt | 40 ++-- .../expected/client/QueryProjection.kt | 20 +- .../expected/types/Entity.kt | 66 +++---- .../expected/types/EntityEdge.kt | 66 +++---- .../expected/types/Query.kt | 68 +++---- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 34 ++-- .../expected/client/EmployeeProjection.kt | 30 +-- .../expected/client/PersonProjection.kt | 40 ++-- .../expected/client/QueryProjection.kt | 8 +- .../expected/types/Employee.kt | 98 +++++----- .../expected/types/Person.kt | 32 +-- .../expected/types/Query.kt | 40 ++-- .../expected/DgsConstants.kt | 16 +- .../expected/client/MyTypeProjection.kt | 8 +- .../expected/client/OtherTypeProjection.kt | 10 +- .../expected/types/MyType.kt | 40 ++-- .../expected/types/OtherType.kt | 40 ++-- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 20 +- .../expected/client/PersonProjection.kt | 20 +- .../expected/client/QueryProjection.kt | 8 +- .../expected/types/Person.kt | 66 +++---- .../expected/types/Query.kt | 40 ++-- .../expected/DgsConstants.kt | 12 +- .../expected/client/MyTypeProjection.kt | 30 +-- .../expected/types/MyType.kt | 92 +++++---- .../expected/DgsConstants.kt | 12 +- .../expected/client/MyTypeProjection.kt | 30 +-- .../expected/types/MyType.kt | 92 +++++---- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 20 +- .../expected/client/PersonProjection.kt | 20 +- .../expected/client/QueryProjection.kt | 8 +- .../expected/types/Person.kt | 66 +++---- .../expected/types/Query.kt | 40 ++-- .../expected/DgsConstants.kt | 12 +- .../expected/client/MyTypeProjection.kt | 30 +-- .../expected/types/MyType.kt | 92 +++++---- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 22 +-- .../expected/client/PersonProjection.kt | 28 +-- .../expected/client/QueryProjection.kt | 8 +- .../expected/types/Person.kt | 92 +++++---- .../expected/types/Query.kt | 40 ++-- .../expected/DgsConstants.kt | 8 +- .../expected/client/SampleTypeProjection.kt | 10 +- .../expected/types/SampleType.kt | 40 ++-- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 20 +- .../expected/client/PersonProjection.kt | 20 +- .../expected/client/QueryProjection.kt | 8 +- .../expected/types/Person.kt | 66 +++---- .../expected/types/Query.kt | 40 ++-- .../codegen/cases/enum/expected/DgsClient.kt | 4 +- .../cases/enum/expected/DgsConstants.kt | 10 +- .../enum/expected/client/QueryProjection.kt | 10 +- .../enum/expected/types/EmployeeTypes.kt | 6 +- .../cases/enum/expected/types/Query.kt | 40 ++-- .../cases/enumDocs/expected/types/Color.kt | 6 +- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 10 +- .../expected/client/QueryProjection.kt | 10 +- .../expected/types/EmployeeTypes.kt | 8 +- .../expected/types/Query.kt | 40 ++-- .../codegen/cases/input/expected/DgsClient.kt | 4 +- .../cases/input/expected/DgsConstants.kt | 22 +-- .../input/expected/client/QueryProjection.kt | 10 +- .../cases/input/expected/types/MovieFilter.kt | 4 +- .../cases/input/expected/types/Query.kt | 40 ++-- .../expected/DgsConstants.kt | 8 +- .../expected/types/Color.kt | 4 +- .../expected/types/SomeType.kt | 4 +- .../expected/DgsConstants.kt | 8 +- .../expected/types/SomeType.kt | 4 +- .../expected/DgsConstants.kt | 8 +- .../expected/types/SomeType.kt | 4 +- .../expected/DgsConstants.kt | 8 +- .../expected/types/SomeType.kt | 4 +- .../expected/DgsConstants.kt | 8 +- .../expected/types/Color.kt | 2 +- .../expected/types/ColorFilter.kt | 4 +- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 24 +-- .../expected/client/QueryProjection.kt | 10 +- .../expected/types/MovieFilter.kt | 11 +- .../expected/types/Query.kt | 40 ++-- .../expected/DgsConstants.kt | 8 +- .../expected/types/SampleInput.kt | 4 +- .../expected/DgsConstants.kt | 54 +++--- .../expected/client/BirdProjection.kt | 54 +++--- .../expected/client/DogProjection.kt | 54 +++--- .../expected/client/PetProjection.kt | 72 +++---- .../expected/types/Bird.kt | 182 ++++++++---------- .../expected/types/Dog.kt | 182 ++++++++---------- .../expected/types/Pet.kt | 52 ++--- .../expected/DgsConstants.kt | 38 ++-- .../expected/client/DietProjection.kt | 20 +- .../expected/client/DogProjection.kt | 18 +- .../expected/client/PetProjection.kt | 26 +-- .../expected/client/VegetarianProjection.kt | 20 +- .../expected/types/Diet.kt | 20 +- .../expected/types/Dog.kt | 70 ++++--- .../expected/types/Pet.kt | 26 +-- .../expected/types/Vegetarian.kt | 68 +++---- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 32 +-- .../expected/client/EmployeeProjection.kt | 30 +-- .../expected/client/PersonProjection.kt | 30 +-- .../expected/client/QueryProjection.kt | 8 +- .../expected/types/Employee.kt | 96 +++++---- .../expected/types/Person.kt | 26 +-- .../expected/types/Query.kt | 40 ++-- .../interfaceDocs/expected/DgsConstants.kt | 8 +- .../expected/client/TitledProjection.kt | 10 +- .../interfaceDocs/expected/types/Titled.kt | 12 +- .../expected/DgsConstants.kt | 8 +- .../expected/client/TitledProjection.kt | 10 +- .../expected/types/Titled.kt | 18 +- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 36 ++-- .../expected/client/FruitProjection.kt | 18 +- .../expected/client/QueryProjection.kt | 8 +- .../expected/client/SeedProjection.kt | 10 +- .../expected/client/StoneFruitProjection.kt | 18 +- .../expected/types/Fruit.kt | 12 +- .../expected/types/Query.kt | 40 ++-- .../expected/types/Seed.kt | 40 ++-- .../expected/types/StoneFruit.kt | 18 +- .../projectionWithEnum/expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 12 +- .../expected/client/QueryProjection.kt | 20 +- .../projectionWithEnum/expected/types/E.kt | 2 +- .../expected/types/Query.kt | 66 +++---- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 46 ++--- .../expected/client/QueryProjection.kt | 26 ++- .../expected/types/I1.kt | 6 +- .../expected/types/I2.kt | 6 +- .../expected/types/Query.kt | 66 +++---- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 26 +-- .../expected/client/QueryProjection.kt | 16 +- .../expected/types/I.kt | 4 +- .../expected/types/Query.kt | 40 ++-- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 12 +- .../expected/client/QueryProjection.kt | 20 +- .../expected/types/Query.kt | 66 +++---- .../projectionWithType/expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 30 +-- .../expected/client/EmployeeProjection.kt | 20 +- .../expected/client/PersonProjection.kt | 20 +- .../expected/client/QueryProjection.kt | 16 +- .../expected/types/Employee.kt | 68 +++---- .../expected/types/Person.kt | 20 +- .../expected/types/Query.kt | 66 +++---- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 44 ++--- .../expected/client/EmployeeProjection.kt | 20 +- .../expected/client/PersonProjection.kt | 20 +- .../expected/client/QueryProjection.kt | 18 +- .../expected/types/Employee.kt | 68 +++---- .../expected/types/I.kt | 4 +- .../expected/types/Person.kt | 20 +- .../expected/types/Query.kt | 40 ++-- .../projectionWithUnion/expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 36 ++-- .../expected/client/EmployeeProjection.kt | 20 +- .../expected/client/PersonProjection.kt | 20 +- .../expected/client/QueryProjection.kt | 16 +- .../expected/client/UProjection.kt | 8 +- .../expected/types/Employee.kt | 68 +++---- .../expected/types/Person.kt | 20 +- .../expected/types/Query.kt | 66 +++---- .../projectionWithUnion/expected/types/U.kt | 14 +- .../expected/DgsConstants.kt | 10 +- .../expected/client/PersonProjection.kt | 10 +- .../expected/types/Person.kt | 40 ++-- .../expected/DgsConstants.kt | 10 +- .../expected/client/PersonProjection.kt | 10 +- .../expected/types/Person.kt | 12 +- .../expected/DgsConstants.kt | 16 +- .../expected/client/PersonProjection.kt | 10 +- .../expected/types/Person.kt | 40 ++-- .../codegen/cases/union/expected/DgsClient.kt | 4 +- .../cases/union/expected/DgsConstants.kt | 32 +-- .../union/expected/client/ActorProjection.kt | 10 +- .../union/expected/client/MovieProjection.kt | 10 +- .../union/expected/client/QueryProjection.kt | 10 +- .../expected/client/SearchResultProjection.kt | 16 +- .../cases/union/expected/types/Actor.kt | 40 ++-- .../cases/union/expected/types/Movie.kt | 40 ++-- .../cases/union/expected/types/Query.kt | 40 ++-- .../union/expected/types/SearchResult.kt | 16 +- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 52 ++--- .../expected/client/DroidProjection.kt | 30 +-- .../expected/client/HumanProjection.kt | 30 +-- .../expected/client/QueryProjection.kt | 12 +- .../client/SearchResultPageProjection.kt | 10 +- .../expected/client/SearchResultProjection.kt | 16 +- .../expected/types/Droid.kt | 92 +++++---- .../expected/types/Human.kt | 92 +++++---- .../expected/types/Query.kt | 40 ++-- .../expected/types/SearchResult.kt | 16 +- .../expected/types/SearchResultPage.kt | 40 ++-- .../expected/DgsClient.kt | 4 +- .../expected/DgsConstants.kt | 40 ++-- .../expected/client/ActorProjection.kt | 10 +- .../expected/client/MovieProjection.kt | 10 +- .../expected/client/QueryProjection.kt | 10 +- .../expected/client/RatingProjection.kt | 10 +- .../expected/client/SearchResultProjection.kt | 26 +-- .../expected/types/Actor.kt | 40 ++-- .../expected/types/Movie.kt | 40 ++-- .../expected/types/Query.kt | 40 ++-- .../expected/types/Rating.kt | 40 ++-- .../expected/types/SearchResult.kt | 18 +- .../netflix/graphql/dgs/codegen/CodeGenCli.kt | 1 + .../generators/java/DataTypeGenerator.kt | 64 +++--- .../graphql/dgs/codegen/CodeGenTest.kt | 26 +-- 345 files changed, 4713 insertions(+), 4977 deletions(-) diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/DgsClient.kt index 8593f77d2..61bb6ee2a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/DgsConstants.kt index 36b049c5f..df9c58bb9 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/DgsConstants.kt @@ -3,29 +3,29 @@ package com.netflix.graphql.dgs.codegen.cases.constantsForInputTypes.expected import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val People: String = "people" + public const val People: String = "people" - public object PEOPLE_INPUT_ARGUMENT { - public const val Filter: String = "filter" + public object PEOPLE_INPUT_ARGUMENT { + public const val Filter: String = "filter" + } } - } - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Lastname: String = "lastname" - } + public const val Lastname: String = "lastname" + } - public object PERSONFILTER { - public const val TYPE_NAME: String = "PersonFilter" + public object PERSONFILTER { + public const val TYPE_NAME: String = "PersonFilter" - public const val Email: String = "email" - } + public const val Email: String = "email" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/client/PersonProjection.kt index 6d882a923..b5600de56 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/client/PersonProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.constantsForInputTypes.expected.cl import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val firstname: PersonProjection - get() { - field("firstname") - return this - } + public val firstname: PersonProjection + get() { + field("firstname") + return this + } - public val lastname: PersonProjection - get() { - field("lastname") - return this - } + public val lastname: PersonProjection + get() { + field("lastname") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/client/QueryProjection.kt index a62032cc8..7077b6345 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/client/QueryProjection.kt @@ -4,9 +4,11 @@ import com.netflix.graphql.dgs.codegen.GraphQLProjection import com.netflix.graphql.dgs.codegen.cases.constantsForInputTypes.expected.types.PersonFilter public class QueryProjection : GraphQLProjection() { - public fun people(filter: PersonFilter? = default("filter"), - _projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("people", PersonProjection(), _projection, "filter" to filter) - return this - } + public fun people( + filter: PersonFilter? = default("filter"), + _projection: PersonProjection.() -> PersonProjection + ): QueryProjection { + field("people", PersonProjection(), _projection, "filter" to filter) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/types/Person.kt index b8dbe24b8..83a726a58 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/types/Person.kt @@ -12,51 +12,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Person.Builder::class) public class Person( - firstname: () -> String? = firstnameDefault, - lastname: () -> String? = lastnameDefault, + firstname: () -> String? = firstnameDefault, + lastname: () -> String? = lastnameDefault ) { - private val _firstname: () -> String? = firstname + private val _firstname: () -> String? = firstname - private val _lastname: () -> String? = lastname + private val _lastname: () -> String? = lastname - @get:JvmName("getFirstname") - public val firstname: String? - get() = _firstname.invoke() + @get:JvmName("getFirstname") + public val firstname: String? + get() = _firstname.invoke() - @get:JvmName("getLastname") - public val lastname: String? - get() = _lastname.invoke() + @get:JvmName("getLastname") + public val lastname: String? + get() = _lastname.invoke() - public companion object { - private val firstnameDefault: () -> String? = - { throw IllegalStateException("Field `firstname` was not requested") } + public companion object { + private val firstnameDefault: () -> String? = { throw IllegalStateException("Field `firstname` was not requested") } + private val lastnameDefault: () -> String? = { throw IllegalStateException("Field `lastname` was not requested") } + } - private val lastnameDefault: () -> String? = - { throw IllegalStateException("Field `lastname` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var firstname: () -> String? = firstnameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var firstname: () -> String? = firstnameDefault + private var lastname: () -> String? = lastnameDefault - private var lastname: () -> String? = lastnameDefault + @JsonProperty("firstname") + public fun withFirstname(firstname: String?): Builder = this.apply { + this.firstname = { firstname } + } - @JsonProperty("firstname") - public fun withFirstname(firstname: String?): Builder = this.apply { - this.firstname = { firstname } - } + @JsonProperty("lastname") + public fun withLastname(lastname: String?): Builder = this.apply { + this.lastname = { lastname } + } - @JsonProperty("lastname") - public fun withLastname(lastname: String?): Builder = this.apply { - this.lastname = { lastname } + public fun build(): Person = Person( + firstname = firstname, + lastname = lastname + ) } - - public fun build(): Person = Person( - firstname = firstname, - lastname = lastname, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/types/PersonFilter.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/types/PersonFilter.kt index bdf96ca0d..a7f3831a6 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/types/PersonFilter.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/types/PersonFilter.kt @@ -7,7 +7,7 @@ import kotlin.String import kotlin.collections.List public class PersonFilter( - public val email: String? = default("email"), + public val email: String? = default("email") ) : GraphQLInput() { - override fun fields(): List> = listOf("email" to email) + override fun fields(): List> = listOf("email" to email) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/types/Query.kt index b45d9187c..369703705 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsForInputTypes/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - people: () -> List? = peopleDefault, + people: () -> List? = peopleDefault ) { - private val _people: () -> List? = people + private val _people: () -> List? = people - @get:JvmName("getPeople") - public val people: List? - get() = _people.invoke() + @get:JvmName("getPeople") + public val people: List? + get() = _people.invoke() - public companion object { - private val peopleDefault: () -> List? = - { throw IllegalStateException("Field `people` was not requested") } + public companion object { + private val peopleDefault: () -> List? = { throw IllegalStateException("Field `people` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var people: () -> List? = peopleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var people: () -> List? = peopleDefault + @JsonProperty("people") + public fun withPeople(people: List?): Builder = this.apply { + this.people = { people } + } - @JsonProperty("people") - public fun withPeople(people: List?): Builder = this.apply { - this.people = { people } + public fun build(): Query = Query( + people = people + ) } - - public fun build(): Query = Query( - people = people, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/DgsClient.kt index 64fdf6bc1..503887ba0 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/DgsConstants.kt index 50119d7ca..c3a316729 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/DgsConstants.kt @@ -3,31 +3,31 @@ package com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedInputTypes.ex import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val People: String = "people" + public const val People: String = "people" - public object PEOPLE_INPUT_ARGUMENT { - public const val Filter: String = "filter" + public object PEOPLE_INPUT_ARGUMENT { + public const val Filter: String = "filter" + } } - } - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Lastname: String = "lastname" - } + public const val Lastname: String = "lastname" + } - public object PERSONFILTER { - public const val TYPE_NAME: String = "PersonFilter" + public object PERSONFILTER { + public const val TYPE_NAME: String = "PersonFilter" - public const val Email: String = "email" + public const val Email: String = "email" - public const val BirthYear: String = "birthYear" - } + public const val BirthYear: String = "birthYear" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/client/PersonProjection.kt index b3f92b267..0b6867b75 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/client/PersonProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedInputTypes.ex import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val firstname: PersonProjection - get() { - field("firstname") - return this - } + public val firstname: PersonProjection + get() { + field("firstname") + return this + } - public val lastname: PersonProjection - get() { - field("lastname") - return this - } + public val lastname: PersonProjection + get() { + field("lastname") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/client/QueryProjection.kt index a3a1f28b0..0bda2449a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/client/QueryProjection.kt @@ -4,9 +4,11 @@ import com.netflix.graphql.dgs.codegen.GraphQLProjection import com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedInputTypes.expected.types.PersonFilter public class QueryProjection : GraphQLProjection() { - public fun people(filter: PersonFilter? = default("filter"), - _projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("people", PersonProjection(), _projection, "filter" to filter) - return this - } + public fun people( + filter: PersonFilter? = default("filter"), + _projection: PersonProjection.() -> PersonProjection + ): QueryProjection { + field("people", PersonProjection(), _projection, "filter" to filter) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/types/Person.kt index f3f451d04..215c65dce 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/types/Person.kt @@ -12,51 +12,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Person.Builder::class) public class Person( - firstname: () -> String? = firstnameDefault, - lastname: () -> String? = lastnameDefault, + firstname: () -> String? = firstnameDefault, + lastname: () -> String? = lastnameDefault ) { - private val _firstname: () -> String? = firstname + private val _firstname: () -> String? = firstname - private val _lastname: () -> String? = lastname + private val _lastname: () -> String? = lastname - @get:JvmName("getFirstname") - public val firstname: String? - get() = _firstname.invoke() + @get:JvmName("getFirstname") + public val firstname: String? + get() = _firstname.invoke() - @get:JvmName("getLastname") - public val lastname: String? - get() = _lastname.invoke() + @get:JvmName("getLastname") + public val lastname: String? + get() = _lastname.invoke() - public companion object { - private val firstnameDefault: () -> String? = - { throw IllegalStateException("Field `firstname` was not requested") } + public companion object { + private val firstnameDefault: () -> String? = { throw IllegalStateException("Field `firstname` was not requested") } + private val lastnameDefault: () -> String? = { throw IllegalStateException("Field `lastname` was not requested") } + } - private val lastnameDefault: () -> String? = - { throw IllegalStateException("Field `lastname` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var firstname: () -> String? = firstnameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var firstname: () -> String? = firstnameDefault + private var lastname: () -> String? = lastnameDefault - private var lastname: () -> String? = lastnameDefault + @JsonProperty("firstname") + public fun withFirstname(firstname: String?): Builder = this.apply { + this.firstname = { firstname } + } - @JsonProperty("firstname") - public fun withFirstname(firstname: String?): Builder = this.apply { - this.firstname = { firstname } - } + @JsonProperty("lastname") + public fun withLastname(lastname: String?): Builder = this.apply { + this.lastname = { lastname } + } - @JsonProperty("lastname") - public fun withLastname(lastname: String?): Builder = this.apply { - this.lastname = { lastname } + public fun build(): Person = Person( + firstname = firstname, + lastname = lastname + ) } - - public fun build(): Person = Person( - firstname = firstname, - lastname = lastname, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/types/PersonFilter.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/types/PersonFilter.kt index ae0d4063a..7145522cc 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/types/PersonFilter.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/types/PersonFilter.kt @@ -8,9 +8,12 @@ import kotlin.String import kotlin.collections.List public class PersonFilter( - public val email: String? = default("email"), - public val birthYear: Int? = default("birthYear"), + public val email: String? = default("email"), + public val birthYear: Int? = default("birthYear") ) : GraphQLInput() { - override fun fields(): List> = listOf("email" to email, "birthYear" to - birthYear) + override fun fields(): List> = listOf( + "email" to email, + "birthYear" to + birthYear + ) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/types/Query.kt index db774346d..0561e16d3 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInputTypes/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - people: () -> List? = peopleDefault, + people: () -> List? = peopleDefault ) { - private val _people: () -> List? = people + private val _people: () -> List? = people - @get:JvmName("getPeople") - public val people: List? - get() = _people.invoke() + @get:JvmName("getPeople") + public val people: List? + get() = _people.invoke() - public companion object { - private val peopleDefault: () -> List? = - { throw IllegalStateException("Field `people` was not requested") } + public companion object { + private val peopleDefault: () -> List? = { throw IllegalStateException("Field `people` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var people: () -> List? = peopleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var people: () -> List? = peopleDefault + @JsonProperty("people") + public fun withPeople(people: List?): Builder = this.apply { + this.people = { people } + } - @JsonProperty("people") - public fun withPeople(people: List?): Builder = this.apply { - this.people = { people } + public fun build(): Query = Query( + people = people + ) } - - public fun build(): Query = Query( - people = people, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/DgsClient.kt index 852fd2ff7..1b4048ac8 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/DgsConstants.kt index 82d6a66e0..a407a93cb 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/DgsConstants.kt @@ -3,21 +3,21 @@ package com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedInterface.exp import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val People: String = "people" - } + public const val People: String = "people" + } - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Lastname: String = "lastname" + public const val Lastname: String = "lastname" - public const val Age: String = "age" - } + public const val Age: String = "age" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/client/PersonProjection.kt index 2964f5451..499562128 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/client/PersonProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedInterface.exp import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val firstname: PersonProjection - get() { - field("firstname") - return this - } + public val firstname: PersonProjection + get() { + field("firstname") + return this + } - public val lastname: PersonProjection - get() { - field("lastname") - return this - } + public val lastname: PersonProjection + get() { + field("lastname") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/client/QueryProjection.kt index 8e4bd0a10..3a5b5abf2 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/client/QueryProjection.kt @@ -3,8 +3,8 @@ package com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedInterface.exp import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("people", PersonProjection(), _projection) - return this - } + public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { + field("people", PersonProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/types/Person.kt index 92a402f7b..967b69b9a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/types/Person.kt @@ -7,20 +7,20 @@ import kotlin.Suppress import kotlin.jvm.JvmName @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" ) public sealed interface Person { - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFirstname") - public val firstname: String + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFirstname") + public val firstname: String - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getLastname") - public val lastname: String? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getLastname") + public val lastname: String? - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getAge") - public val age: Int? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getAge") + public val age: Int? } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/types/Query.kt index a6f85dbe2..24c349d89 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedInterface/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - people: () -> List? = peopleDefault, + people: () -> List? = peopleDefault ) { - private val _people: () -> List? = people + private val _people: () -> List? = people - @get:JvmName("getPeople") - public val people: List? - get() = _people.invoke() + @get:JvmName("getPeople") + public val people: List? + get() = _people.invoke() - public companion object { - private val peopleDefault: () -> List? = - { throw IllegalStateException("Field `people` was not requested") } + public companion object { + private val peopleDefault: () -> List? = { throw IllegalStateException("Field `people` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var people: () -> List? = peopleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var people: () -> List? = peopleDefault + @JsonProperty("people") + public fun withPeople(people: List?): Builder = this.apply { + this.people = { people } + } - @JsonProperty("people") - public fun withPeople(people: List?): Builder = this.apply { - this.people = { people } + public fun build(): Query = Query( + people = people + ) } - - public fun build(): Query = Query( - people = people, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/DgsClient.kt index ce70c40d4..7d7dc5171 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/DgsConstants.kt index e726f8519..8f90602ef 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/DgsConstants.kt @@ -3,21 +3,21 @@ package com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedQuery.expecte import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val People: String = "people" + public const val People: String = "people" - public const val Friends: String = "friends" - } + public const val Friends: String = "friends" + } - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Lastname: String = "lastname" - } + public const val Lastname: String = "lastname" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/client/PersonProjection.kt index a9ccab13c..4705a17bd 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/client/PersonProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedQuery.expecte import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val firstname: PersonProjection - get() { - field("firstname") - return this - } + public val firstname: PersonProjection + get() { + field("firstname") + return this + } - public val lastname: PersonProjection - get() { - field("lastname") - return this - } + public val lastname: PersonProjection + get() { + field("lastname") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/client/QueryProjection.kt index 5f03cb2c4..2c13f53fc 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/client/QueryProjection.kt @@ -3,13 +3,13 @@ package com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedQuery.expecte import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("people", PersonProjection(), _projection) - return this - } + public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { + field("people", PersonProjection(), _projection) + return this + } - public fun friends(_projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("friends", PersonProjection(), _projection) - return this - } + public fun friends(_projection: PersonProjection.() -> PersonProjection): QueryProjection { + field("friends", PersonProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/types/Person.kt index 07631731b..6a535d635 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/types/Person.kt @@ -12,51 +12,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Person.Builder::class) public class Person( - firstname: () -> String? = firstnameDefault, - lastname: () -> String? = lastnameDefault, + firstname: () -> String? = firstnameDefault, + lastname: () -> String? = lastnameDefault ) { - private val _firstname: () -> String? = firstname + private val _firstname: () -> String? = firstname - private val _lastname: () -> String? = lastname + private val _lastname: () -> String? = lastname - @get:JvmName("getFirstname") - public val firstname: String? - get() = _firstname.invoke() + @get:JvmName("getFirstname") + public val firstname: String? + get() = _firstname.invoke() - @get:JvmName("getLastname") - public val lastname: String? - get() = _lastname.invoke() + @get:JvmName("getLastname") + public val lastname: String? + get() = _lastname.invoke() - public companion object { - private val firstnameDefault: () -> String? = - { throw IllegalStateException("Field `firstname` was not requested") } + public companion object { + private val firstnameDefault: () -> String? = { throw IllegalStateException("Field `firstname` was not requested") } + private val lastnameDefault: () -> String? = { throw IllegalStateException("Field `lastname` was not requested") } + } - private val lastnameDefault: () -> String? = - { throw IllegalStateException("Field `lastname` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var firstname: () -> String? = firstnameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var firstname: () -> String? = firstnameDefault + private var lastname: () -> String? = lastnameDefault - private var lastname: () -> String? = lastnameDefault + @JsonProperty("firstname") + public fun withFirstname(firstname: String?): Builder = this.apply { + this.firstname = { firstname } + } - @JsonProperty("firstname") - public fun withFirstname(firstname: String?): Builder = this.apply { - this.firstname = { firstname } - } + @JsonProperty("lastname") + public fun withLastname(lastname: String?): Builder = this.apply { + this.lastname = { lastname } + } - @JsonProperty("lastname") - public fun withLastname(lastname: String?): Builder = this.apply { - this.lastname = { lastname } + public fun build(): Person = Person( + firstname = firstname, + lastname = lastname + ) } - - public fun build(): Person = Person( - firstname = firstname, - lastname = lastname, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/types/Query.kt index 437b8d4da..e012e9e43 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedQuery/expected/types/Query.kt @@ -12,51 +12,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - people: () -> List? = peopleDefault, - friends: () -> List? = friendsDefault, + people: () -> List? = peopleDefault, + friends: () -> List? = friendsDefault ) { - private val _people: () -> List? = people + private val _people: () -> List? = people - private val _friends: () -> List? = friends + private val _friends: () -> List? = friends - @get:JvmName("getPeople") - public val people: List? - get() = _people.invoke() + @get:JvmName("getPeople") + public val people: List? + get() = _people.invoke() - @get:JvmName("getFriends") - public val friends: List? - get() = _friends.invoke() + @get:JvmName("getFriends") + public val friends: List? + get() = _friends.invoke() - public companion object { - private val peopleDefault: () -> List? = - { throw IllegalStateException("Field `people` was not requested") } + public companion object { + private val peopleDefault: () -> List? = { throw IllegalStateException("Field `people` was not requested") } + private val friendsDefault: () -> List? = { throw IllegalStateException("Field `friends` was not requested") } + } - private val friendsDefault: () -> List? = - { throw IllegalStateException("Field `friends` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var people: () -> List? = peopleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var people: () -> List? = peopleDefault + private var friends: () -> List? = friendsDefault - private var friends: () -> List? = friendsDefault + @JsonProperty("people") + public fun withPeople(people: List?): Builder = this.apply { + this.people = { people } + } - @JsonProperty("people") - public fun withPeople(people: List?): Builder = this.apply { - this.people = { people } - } + @JsonProperty("friends") + public fun withFriends(friends: List?): Builder = this.apply { + this.friends = { friends } + } - @JsonProperty("friends") - public fun withFriends(friends: List?): Builder = this.apply { - this.friends = { friends } + public fun build(): Query = Query( + people = people, + friends = friends + ) } - - public fun build(): Query = Query( - people = people, - friends = friends, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/DgsClient.kt index 4202f53f9..d2524b60b 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/DgsConstants.kt index 8b6ca5986..cf150286a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/DgsConstants.kt @@ -3,21 +3,21 @@ package com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedTypes.expecte import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val People: String = "people" - } + public const val People: String = "people" + } - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Lastname: String = "lastname" + public const val Lastname: String = "lastname" - public const val Email: String = "email" - } + public const val Email: String = "email" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/client/PersonProjection.kt index f95022065..6bbbc1c87 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/client/PersonProjection.kt @@ -3,21 +3,21 @@ package com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedTypes.expecte import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val firstname: PersonProjection - get() { - field("firstname") - return this - } + public val firstname: PersonProjection + get() { + field("firstname") + return this + } - public val lastname: PersonProjection - get() { - field("lastname") - return this - } + public val lastname: PersonProjection + get() { + field("lastname") + return this + } - public val email: PersonProjection - get() { - field("email") - return this - } + public val email: PersonProjection + get() { + field("email") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/client/QueryProjection.kt index 58fe18140..a86ae8537 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/client/QueryProjection.kt @@ -3,8 +3,8 @@ package com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedTypes.expecte import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("people", PersonProjection(), _projection) - return this - } + public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { + field("people", PersonProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/types/Person.kt index df6395f5e..d86f2bce7 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/types/Person.kt @@ -12,70 +12,64 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Person.Builder::class) public class Person( - firstname: () -> String? = firstnameDefault, - lastname: () -> String? = lastnameDefault, - email: () -> String? = emailDefault, + firstname: () -> String? = firstnameDefault, + lastname: () -> String? = lastnameDefault, + email: () -> String? = emailDefault ) { - private val _firstname: () -> String? = firstname + private val _firstname: () -> String? = firstname - private val _lastname: () -> String? = lastname + private val _lastname: () -> String? = lastname - private val _email: () -> String? = email + private val _email: () -> String? = email - @get:JvmName("getFirstname") - public val firstname: String? - get() = _firstname.invoke() + @get:JvmName("getFirstname") + public val firstname: String? + get() = _firstname.invoke() - @get:JvmName("getLastname") - public val lastname: String? - get() = _lastname.invoke() + @get:JvmName("getLastname") + public val lastname: String? + get() = _lastname.invoke() - @get:JvmName("getEmail") - public val email: String? - get() = _email.invoke() + @get:JvmName("getEmail") + public val email: String? + get() = _email.invoke() - public companion object { - private val firstnameDefault: () -> String? = - { throw IllegalStateException("Field `firstname` was not requested") } + public companion object { + private val firstnameDefault: () -> String? = { throw IllegalStateException("Field `firstname` was not requested") } + private val lastnameDefault: () -> String? = { throw IllegalStateException("Field `lastname` was not requested") } - private val lastnameDefault: () -> String? = - { throw IllegalStateException("Field `lastname` was not requested") } - - - private val emailDefault: () -> String? = - { throw IllegalStateException("Field `email` was not requested") } + private val emailDefault: () -> String? = { throw IllegalStateException("Field `email` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var firstname: () -> String? = firstnameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var firstname: () -> String? = firstnameDefault + private var lastname: () -> String? = lastnameDefault - private var lastname: () -> String? = lastnameDefault + private var email: () -> String? = emailDefault - private var email: () -> String? = emailDefault + @JsonProperty("firstname") + public fun withFirstname(firstname: String?): Builder = this.apply { + this.firstname = { firstname } + } - @JsonProperty("firstname") - public fun withFirstname(firstname: String?): Builder = this.apply { - this.firstname = { firstname } - } + @JsonProperty("lastname") + public fun withLastname(lastname: String?): Builder = this.apply { + this.lastname = { lastname } + } - @JsonProperty("lastname") - public fun withLastname(lastname: String?): Builder = this.apply { - this.lastname = { lastname } - } + @JsonProperty("email") + public fun withEmail(email: String?): Builder = this.apply { + this.email = { email } + } - @JsonProperty("email") - public fun withEmail(email: String?): Builder = this.apply { - this.email = { email } + public fun build(): Person = Person( + firstname = firstname, + lastname = lastname, + email = email + ) } - - public fun build(): Person = Person( - firstname = firstname, - lastname = lastname, - email = email, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/types/Query.kt index 55fd914e7..cf1514080 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/constantsWithExtendedTypes/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - people: () -> List? = peopleDefault, + people: () -> List? = peopleDefault ) { - private val _people: () -> List? = people + private val _people: () -> List? = people - @get:JvmName("getPeople") - public val people: List? - get() = _people.invoke() + @get:JvmName("getPeople") + public val people: List? + get() = _people.invoke() - public companion object { - private val peopleDefault: () -> List? = - { throw IllegalStateException("Field `people` was not requested") } + public companion object { + private val peopleDefault: () -> List? = { throw IllegalStateException("Field `people` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var people: () -> List? = peopleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var people: () -> List? = peopleDefault + @JsonProperty("people") + public fun withPeople(people: List?): Builder = this.apply { + this.people = { people } + } - @JsonProperty("people") - public fun withPeople(people: List?): Builder = this.apply { - this.people = { people } + public fun build(): Query = Query( + people = people + ) } - - public fun build(): Query = Query( - people = people, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/DgsClient.kt index d4bdf4e57..b3c7e96b9 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/DgsConstants.kt index c470db1f7..40d5d552b 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/DgsConstants.kt @@ -3,27 +3,27 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassDocs.expected import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Search: String = "search" + public const val Search: String = "search" - public object SEARCH_INPUT_ARGUMENT { - public const val MovieFilter: String = "movieFilter" + public object SEARCH_INPUT_ARGUMENT { + public const val MovieFilter: String = "movieFilter" + } } - } - public object MOVIE { - public const val TYPE_NAME: String = "Movie" + public object MOVIE { + public const val TYPE_NAME: String = "Movie" - public const val Title: String = "title" - } + public const val Title: String = "title" + } - public object MOVIEFILTER { - public const val TYPE_NAME: String = "MovieFilter" + public object MOVIEFILTER { + public const val TYPE_NAME: String = "MovieFilter" - public const val TitleFilter: String = "titleFilter" - } + public const val TitleFilter: String = "titleFilter" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/client/MovieProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/client/MovieProjection.kt index f13be26ab..d12ff6ae5 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/client/MovieProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/client/MovieProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassDocs.expected.client import com.netflix.graphql.dgs.codegen.GraphQLProjection public class MovieProjection : GraphQLProjection() { - public val title: MovieProjection - get() { - field("title") - return this - } + public val title: MovieProjection + get() { + field("title") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/client/QueryProjection.kt index 1f095908c..ace065611 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/client/QueryProjection.kt @@ -4,9 +4,9 @@ import com.netflix.graphql.dgs.codegen.GraphQLProjection import com.netflix.graphql.dgs.codegen.cases.dataClassDocs.expected.types.MovieFilter public class QueryProjection : GraphQLProjection() { - public fun search(movieFilter: MovieFilter, _projection: MovieProjection.() -> MovieProjection): - QueryProjection { - field("search", MovieProjection(), _projection, "movieFilter" to movieFilter) - return this - } + public fun search(movieFilter: MovieFilter, _projection: MovieProjection.() -> MovieProjection): + QueryProjection { + field("search", MovieProjection(), _projection, "movieFilter" to movieFilter) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/types/Movie.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/types/Movie.kt index e5d8856fa..92ca1bc75 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/types/Movie.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/types/Movie.kt @@ -16,32 +16,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Movie.Builder::class) public class Movie( - title: () -> String? = titleDefault, + title: () -> String? = titleDefault ) { - private val _title: () -> String? = title + private val _title: () -> String? = title - @get:JvmName("getTitle") - public val title: String? - get() = _title.invoke() + @get:JvmName("getTitle") + public val title: String? + get() = _title.invoke() - public companion object { - private val titleDefault: () -> String? = - { throw IllegalStateException("Field `title` was not requested") } + public companion object { + private val titleDefault: () -> String? = { throw IllegalStateException("Field `title` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var title: () -> String? = titleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var title: () -> String? = titleDefault + @JsonProperty("title") + public fun withTitle(title: String?): Builder = this.apply { + this.title = { title } + } - @JsonProperty("title") - public fun withTitle(title: String?): Builder = this.apply { - this.title = { title } + public fun build(): Movie = Movie( + title = title + ) } - - public fun build(): Movie = Movie( - title = title, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/types/MovieFilter.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/types/MovieFilter.kt index 345ba511c..057e2f6c9 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/types/MovieFilter.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/types/MovieFilter.kt @@ -12,7 +12,7 @@ import kotlin.collections.List * It takes a title and such. */ public class MovieFilter( - public val titleFilter: String? = default("titleFilter"), + public val titleFilter: String? = default("titleFilter") ) : GraphQLInput() { - override fun fields(): List> = listOf("titleFilter" to titleFilter) + override fun fields(): List> = listOf("titleFilter" to titleFilter) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/types/Query.kt index 8a6523386..64ea5d1a3 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassDocs/expected/types/Query.kt @@ -11,32 +11,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - search: () -> Movie? = searchDefault, + search: () -> Movie? = searchDefault ) { - private val _search: () -> Movie? = search + private val _search: () -> Movie? = search - @get:JvmName("getSearch") - public val search: Movie? - get() = _search.invoke() + @get:JvmName("getSearch") + public val search: Movie? + get() = _search.invoke() - public companion object { - private val searchDefault: () -> Movie? = - { throw IllegalStateException("Field `search` was not requested") } + public companion object { + private val searchDefault: () -> Movie? = { throw IllegalStateException("Field `search` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var search: () -> Movie? = searchDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var search: () -> Movie? = searchDefault + @JsonProperty("search") + public fun withSearch(search: Movie?): Builder = this.apply { + this.search = { search } + } - @JsonProperty("search") - public fun withSearch(search: Movie?): Builder = this.apply { - this.search = { search } + public fun build(): Query = Query( + search = search + ) } - - public fun build(): Query = Query( - search = search, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/DgsClient.kt index d8577e5a9..ef6a5006e 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/DgsConstants.kt index 94b2cd0fe..5b6d18a67 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/DgsConstants.kt @@ -3,27 +3,27 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassFieldDocs.expected import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Search: String = "search" + public const val Search: String = "search" - public object SEARCH_INPUT_ARGUMENT { - public const val MovieFilter: String = "movieFilter" + public object SEARCH_INPUT_ARGUMENT { + public const val MovieFilter: String = "movieFilter" + } } - } - public object MOVIE { - public const val TYPE_NAME: String = "Movie" + public object MOVIE { + public const val TYPE_NAME: String = "Movie" - public const val Title: String = "title" - } + public const val Title: String = "title" + } - public object MOVIEFILTER { - public const val TYPE_NAME: String = "MovieFilter" + public object MOVIEFILTER { + public const val TYPE_NAME: String = "MovieFilter" - public const val TitleFilter: String = "titleFilter" - } + public const val TitleFilter: String = "titleFilter" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/client/MovieProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/client/MovieProjection.kt index 4e0b67555..82fb62375 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/client/MovieProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/client/MovieProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassFieldDocs.expected.client import com.netflix.graphql.dgs.codegen.GraphQLProjection public class MovieProjection : GraphQLProjection() { - public val title: MovieProjection - get() { - field("title") - return this - } + public val title: MovieProjection + get() { + field("title") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/client/QueryProjection.kt index 0568b1af4..53b776d30 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/client/QueryProjection.kt @@ -4,9 +4,9 @@ import com.netflix.graphql.dgs.codegen.GraphQLProjection import com.netflix.graphql.dgs.codegen.cases.dataClassFieldDocs.expected.types.MovieFilter public class QueryProjection : GraphQLProjection() { - public fun search(movieFilter: MovieFilter, _projection: MovieProjection.() -> MovieProjection): - QueryProjection { - field("search", MovieProjection(), _projection, "movieFilter" to movieFilter) - return this - } + public fun search(movieFilter: MovieFilter, _projection: MovieProjection.() -> MovieProjection): + QueryProjection { + field("search", MovieProjection(), _projection, "movieFilter" to movieFilter) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/types/Movie.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/types/Movie.kt index f7fcef821..029934308 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/types/Movie.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/types/Movie.kt @@ -12,35 +12,33 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Movie.Builder::class) public class Movie( - title: () -> String? = titleDefault, + title: () -> String? = titleDefault ) { - private val _title: () -> String? = title + private val _title: () -> String? = title - /** - * The original, non localized title with some specials characters : %!({[*$,.:;. - */ - @get:JvmName("getTitle") - public val title: String? - get() = _title.invoke() + /** + * The original, non localized title with some specials characters : %!({[*$,.:;. + */ + @get:JvmName("getTitle") + public val title: String? + get() = _title.invoke() - public companion object { - private val titleDefault: () -> String? = - { throw IllegalStateException("Field `title` was not requested") } + public companion object { + private val titleDefault: () -> String? = { throw IllegalStateException("Field `title` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var title: () -> String? = titleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var title: () -> String? = titleDefault + @JsonProperty("title") + public fun withTitle(title: String?): Builder = this.apply { + this.title = { title } + } - @JsonProperty("title") - public fun withTitle(title: String?): Builder = this.apply { - this.title = { title } + public fun build(): Movie = Movie( + title = title + ) } - - public fun build(): Movie = Movie( - title = title, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/types/MovieFilter.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/types/MovieFilter.kt index 4a4e7f588..0a9571c5f 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/types/MovieFilter.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/types/MovieFilter.kt @@ -7,7 +7,7 @@ import kotlin.String import kotlin.collections.List public class MovieFilter( - public val titleFilter: String? = default("titleFilter"), + public val titleFilter: String? = default("titleFilter") ) : GraphQLInput() { - override fun fields(): List> = listOf("titleFilter" to titleFilter) + override fun fields(): List> = listOf("titleFilter" to titleFilter) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/types/Query.kt index 8f5978f66..d7d7c1290 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassFieldDocs/expected/types/Query.kt @@ -11,32 +11,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - search: () -> Movie? = searchDefault, + search: () -> Movie? = searchDefault ) { - private val _search: () -> Movie? = search + private val _search: () -> Movie? = search - @get:JvmName("getSearch") - public val search: Movie? - get() = _search.invoke() + @get:JvmName("getSearch") + public val search: Movie? + get() = _search.invoke() - public companion object { - private val searchDefault: () -> Movie? = - { throw IllegalStateException("Field `search` was not requested") } + public companion object { + private val searchDefault: () -> Movie? = { throw IllegalStateException("Field `search` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var search: () -> Movie? = searchDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var search: () -> Movie? = searchDefault + @JsonProperty("search") + public fun withSearch(search: Movie?): Builder = this.apply { + this.search = { search } + } - @JsonProperty("search") - public fun withSearch(search: Movie?): Builder = this.apply { - this.search = { search } + public fun build(): Query = Query( + search = search + ) } - - public fun build(): Query = Query( - search = search, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/DgsClient.kt index 080940266..9e99e0e8c 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/DgsConstants.kt index aac43b021..cc1e751e4 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/DgsConstants.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWIthNoFields.expected import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Me: String = "me" - } + public const val Me: String = "me" + } - public object PERSON { - public const val TYPE_NAME: String = "Person" - } + public object PERSON { + public const val TYPE_NAME: String = "Person" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/client/QueryProjection.kt index 8c211655e..4819af0cf 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/client/QueryProjection.kt @@ -3,8 +3,8 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWIthNoFields.expected.cli import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun me(_projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("me", PersonProjection(), _projection) - return this - } + public fun me(_projection: PersonProjection.() -> PersonProjection): QueryProjection { + field("me", PersonProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/types/Person.kt index 0b969e337..6211b2690 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/types/Person.kt @@ -8,12 +8,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Person.Builder::class) public class Person() { - public companion object + public companion object - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - public fun build(): Person = Person( - ) - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + public fun build(): Person = Person() + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/types/Query.kt index fce6a02a7..abc12c493 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWIthNoFields/expected/types/Query.kt @@ -11,32 +11,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - me: () -> Person? = meDefault, + me: () -> Person? = meDefault ) { - private val _me: () -> Person? = me + private val _me: () -> Person? = me - @get:JvmName("getMe") - public val me: Person? - get() = _me.invoke() + @get:JvmName("getMe") + public val me: Person? + get() = _me.invoke() - public companion object { - private val meDefault: () -> Person? = - { throw IllegalStateException("Field `me` was not requested") } + public companion object { + private val meDefault: () -> Person? = { throw IllegalStateException("Field `me` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var me: () -> Person? = meDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var me: () -> Person? = meDefault + @JsonProperty("me") + public fun withMe(me: Person?): Builder = this.apply { + this.me = { me } + } - @JsonProperty("me") - public fun withMe(me: Person?): Builder = this.apply { - this.me = { me } + public fun build(): Query = Query( + me = me + ) } - - public fun build(): Query = Query( - me = me, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/DgsClient.kt index 55c496a98..4e4d14218 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/DgsConstants.kt index f60193cdc..cf93aebb8 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/DgsConstants.kt @@ -3,17 +3,17 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithBooleanField.expected import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Test: String = "test" - } + public const val Test: String = "test" + } - public object REQUIREDTESTTYPE { - public const val TYPE_NAME: String = "RequiredTestType" + public object REQUIREDTESTTYPE { + public const val TYPE_NAME: String = "RequiredTestType" - public const val IsRequired: String = "isRequired" - } + public const val IsRequired: String = "isRequired" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/client/QueryProjection.kt index be5af3f9e..cb22c935f 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/client/QueryProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithBooleanField.expected import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun test(_projection: RequiredTestTypeProjection.() -> RequiredTestTypeProjection): - QueryProjection { - field("test", RequiredTestTypeProjection(), _projection) - return this - } + public fun test(_projection: RequiredTestTypeProjection.() -> RequiredTestTypeProjection): + QueryProjection { + field("test", RequiredTestTypeProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/client/RequiredTestTypeProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/client/RequiredTestTypeProjection.kt index 6020d1d55..6bc3a35c9 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/client/RequiredTestTypeProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/client/RequiredTestTypeProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithBooleanField.expected import com.netflix.graphql.dgs.codegen.GraphQLProjection public class RequiredTestTypeProjection : GraphQLProjection() { - public val isRequired: RequiredTestTypeProjection - get() { - field("isRequired") - return this - } + public val isRequired: RequiredTestTypeProjection + get() { + field("isRequired") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/types/Query.kt index 89244579f..5e1cb0785 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/types/Query.kt @@ -11,32 +11,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - test: () -> RequiredTestType? = testDefault, + test: () -> RequiredTestType? = testDefault ) { - private val _test: () -> RequiredTestType? = test + private val _test: () -> RequiredTestType? = test - @get:JvmName("getTest") - public val test: RequiredTestType? - get() = _test.invoke() + @get:JvmName("getTest") + public val test: RequiredTestType? + get() = _test.invoke() - public companion object { - private val testDefault: () -> RequiredTestType? = - { throw IllegalStateException("Field `test` was not requested") } + public companion object { + private val testDefault: () -> RequiredTestType? = { throw IllegalStateException("Field `test` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var test: () -> RequiredTestType? = testDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var test: () -> RequiredTestType? = testDefault + @JsonProperty("test") + public fun withTest(test: RequiredTestType?): Builder = this.apply { + this.test = { test } + } - @JsonProperty("test") - public fun withTest(test: RequiredTestType?): Builder = this.apply { - this.test = { test } + public fun build(): Query = Query( + test = test + ) } - - public fun build(): Query = Query( - test = test, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/types/RequiredTestType.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/types/RequiredTestType.kt index d7d9adb6e..27ad647b1 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/types/RequiredTestType.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithBooleanField/expected/types/RequiredTestType.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = RequiredTestType.Builder::class) public class RequiredTestType( - isRequired: () -> Boolean = isRequiredDefault, + isRequired: () -> Boolean = isRequiredDefault ) { - private val _isRequired: () -> Boolean = isRequired + private val _isRequired: () -> Boolean = isRequired - @get:JvmName("getIsRequired") - public val isRequired: Boolean - get() = _isRequired.invoke() + @get:JvmName("getIsRequired") + public val isRequired: Boolean + get() = _isRequired.invoke() - public companion object { - private val isRequiredDefault: () -> Boolean = - { throw IllegalStateException("Field `isRequired` was not requested") } + public companion object { + private val isRequiredDefault: () -> Boolean = { throw IllegalStateException("Field `isRequired` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var isRequired: () -> Boolean = isRequiredDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var isRequired: () -> Boolean = isRequiredDefault + @JsonProperty("isRequired") + public fun withIsRequired(isRequired: Boolean): Builder = this.apply { + this.isRequired = { isRequired } + } - @JsonProperty("isRequired") - public fun withIsRequired(isRequired: Boolean): Builder = this.apply { - this.isRequired = { isRequired } + public fun build(): RequiredTestType = RequiredTestType( + isRequired = isRequired + ) } - - public fun build(): RequiredTestType = RequiredTestType( - isRequired = isRequired, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/DgsClient.kt index 22bd67302..2e64028d0 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/DgsConstants.kt index 747c2920a..3a567c399 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/DgsConstants.kt @@ -3,49 +3,49 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expec import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Entity: String = "entity" + public const val Entity: String = "entity" - public const val EntityConnection: String = "entityConnection" - } + public const val EntityConnection: String = "entityConnection" + } - public object ENTITY { - public const val TYPE_NAME: String = "Entity" + public object ENTITY { + public const val TYPE_NAME: String = "Entity" - public const val Long: String = "long" + public const val Long: String = "long" - public const val DateTime: String = "dateTime" - } + public const val DateTime: String = "dateTime" + } - public object ENTITYCONNECTION { - public const val TYPE_NAME: String = "EntityConnection" + public object ENTITYCONNECTION { + public const val TYPE_NAME: String = "EntityConnection" - public const val PageInfo: String = "pageInfo" + public const val PageInfo: String = "pageInfo" - public const val Edges: String = "edges" - } + public const val Edges: String = "edges" + } - public object ENTITYEDGE { - public const val TYPE_NAME: String = "EntityEdge" + public object ENTITYEDGE { + public const val TYPE_NAME: String = "EntityEdge" - public const val Cursor: String = "cursor" + public const val Cursor: String = "cursor" - public const val Node: String = "node" - } + public const val Node: String = "node" + } - public object PAGEINFO { - public const val TYPE_NAME: String = "PageInfo" + public object PAGEINFO { + public const val TYPE_NAME: String = "PageInfo" - public const val StartCursor: String = "startCursor" + public const val StartCursor: String = "startCursor" - public const val EndCursor: String = "endCursor" + public const val EndCursor: String = "endCursor" - public const val HasNextPage: String = "hasNextPage" + public const val HasNextPage: String = "hasNextPage" - public const val HasPreviousPage: String = "hasPreviousPage" - } + public const val HasPreviousPage: String = "hasPreviousPage" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/EntityConnectionProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/EntityConnectionProjection.kt index 3e266ae39..56d2e9a07 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/EntityConnectionProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/EntityConnectionProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expec import com.netflix.graphql.dgs.codegen.GraphQLProjection public class EntityConnectionProjection : GraphQLProjection() { - public fun pageInfo(_projection: PageInfoProjection.() -> PageInfoProjection): - EntityConnectionProjection { - field("pageInfo", PageInfoProjection(), _projection) - return this - } + public fun pageInfo(_projection: PageInfoProjection.() -> PageInfoProjection): + EntityConnectionProjection { + field("pageInfo", PageInfoProjection(), _projection) + return this + } - public fun edges(_projection: EntityEdgeProjection.() -> EntityEdgeProjection): - EntityConnectionProjection { - field("edges", EntityEdgeProjection(), _projection) - return this - } + public fun edges(_projection: EntityEdgeProjection.() -> EntityEdgeProjection): + EntityConnectionProjection { + field("edges", EntityEdgeProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/EntityEdgeProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/EntityEdgeProjection.kt index afbeb21c7..22a4f1013 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/EntityEdgeProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/EntityEdgeProjection.kt @@ -3,14 +3,14 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expec import com.netflix.graphql.dgs.codegen.GraphQLProjection public class EntityEdgeProjection : GraphQLProjection() { - public val cursor: EntityEdgeProjection - get() { - field("cursor") - return this - } + public val cursor: EntityEdgeProjection + get() { + field("cursor") + return this + } - public fun node(_projection: EntityProjection.() -> EntityProjection): EntityEdgeProjection { - field("node", EntityProjection(), _projection) - return this - } + public fun node(_projection: EntityProjection.() -> EntityProjection): EntityEdgeProjection { + field("node", EntityProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/EntityProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/EntityProjection.kt index 039cb95e6..15e96bddc 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/EntityProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/EntityProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expec import com.netflix.graphql.dgs.codegen.GraphQLProjection public class EntityProjection : GraphQLProjection() { - public val long: EntityProjection - get() { - field("long") - return this - } + public val long: EntityProjection + get() { + field("long") + return this + } - public val dateTime: EntityProjection - get() { - field("dateTime") - return this - } + public val dateTime: EntityProjection + get() { + field("dateTime") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/PageInfoProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/PageInfoProjection.kt index 81bc2a5f3..e8d4ddc11 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/PageInfoProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/PageInfoProjection.kt @@ -3,27 +3,27 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expec import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PageInfoProjection : GraphQLProjection() { - public val startCursor: PageInfoProjection - get() { - field("startCursor") - return this - } + public val startCursor: PageInfoProjection + get() { + field("startCursor") + return this + } - public val endCursor: PageInfoProjection - get() { - field("endCursor") - return this - } + public val endCursor: PageInfoProjection + get() { + field("endCursor") + return this + } - public val hasNextPage: PageInfoProjection - get() { - field("hasNextPage") - return this - } + public val hasNextPage: PageInfoProjection + get() { + field("hasNextPage") + return this + } - public val hasPreviousPage: PageInfoProjection - get() { - field("hasPreviousPage") - return this - } + public val hasPreviousPage: PageInfoProjection + get() { + field("hasPreviousPage") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/QueryProjection.kt index cd45546d4..e40dd1977 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/client/QueryProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expec import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun entity(_projection: EntityProjection.() -> EntityProjection): QueryProjection { - field("entity", EntityProjection(), _projection) - return this - } + public fun entity(_projection: EntityProjection.() -> EntityProjection): QueryProjection { + field("entity", EntityProjection(), _projection) + return this + } - public - fun entityConnection(_projection: EntityConnectionProjection.() -> EntityConnectionProjection): - QueryProjection { - field("entityConnection", EntityConnectionProjection(), _projection) - return this - } + public + fun entityConnection(_projection: EntityConnectionProjection.() -> EntityConnectionProjection): + QueryProjection { + field("entityConnection", EntityConnectionProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/Entity.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/Entity.kt index d80130622..84cdbea80 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/Entity.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/Entity.kt @@ -13,51 +13,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Entity.Builder::class) public class Entity( - long: () -> Long? = longDefault, - dateTime: () -> OffsetDateTime? = dateTimeDefault, + long: () -> Long? = longDefault, + dateTime: () -> OffsetDateTime? = dateTimeDefault ) { - private val _long: () -> Long? = long + private val _long: () -> Long? = long - private val _dateTime: () -> OffsetDateTime? = dateTime + private val _dateTime: () -> OffsetDateTime? = dateTime - @get:JvmName("getLong") - public val long: Long? - get() = _long.invoke() + @get:JvmName("getLong") + public val long: Long? + get() = _long.invoke() - @get:JvmName("getDateTime") - public val dateTime: OffsetDateTime? - get() = _dateTime.invoke() + @get:JvmName("getDateTime") + public val dateTime: OffsetDateTime? + get() = _dateTime.invoke() - public companion object { - private val longDefault: () -> Long? = - { throw IllegalStateException("Field `long` was not requested") } + public companion object { + private val longDefault: () -> Long? = { throw IllegalStateException("Field `long` was not requested") } + private val dateTimeDefault: () -> OffsetDateTime? = { throw IllegalStateException("Field `dateTime` was not requested") } + } - private val dateTimeDefault: () -> OffsetDateTime? = - { throw IllegalStateException("Field `dateTime` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var long: () -> Long? = longDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var long: () -> Long? = longDefault + private var dateTime: () -> OffsetDateTime? = dateTimeDefault - private var dateTime: () -> OffsetDateTime? = dateTimeDefault + @JsonProperty("long") + public fun withLong(long: Long?): Builder = this.apply { + this.long = { long } + } - @JsonProperty("long") - public fun withLong(long: Long?): Builder = this.apply { - this.long = { long } - } + @JsonProperty("dateTime") + public fun withDateTime(dateTime: OffsetDateTime?): Builder = this.apply { + this.dateTime = { dateTime } + } - @JsonProperty("dateTime") - public fun withDateTime(dateTime: OffsetDateTime?): Builder = this.apply { - this.dateTime = { dateTime } + public fun build(): Entity = Entity( + long = long, + dateTime = dateTime + ) } - - public fun build(): Entity = Entity( - long = long, - dateTime = dateTime, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/EntityConnection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/EntityConnection.kt index 9a73b05fb..1abbf9ceb 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/EntityConnection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/EntityConnection.kt @@ -12,51 +12,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = EntityConnection.Builder::class) public class EntityConnection( - pageInfo: () -> PageInfo = pageInfoDefault, - edges: () -> List? = edgesDefault, + pageInfo: () -> PageInfo = pageInfoDefault, + edges: () -> List? = edgesDefault ) { - private val _pageInfo: () -> PageInfo = pageInfo + private val _pageInfo: () -> PageInfo = pageInfo - private val _edges: () -> List? = edges + private val _edges: () -> List? = edges - @get:JvmName("getPageInfo") - public val pageInfo: PageInfo - get() = _pageInfo.invoke() + @get:JvmName("getPageInfo") + public val pageInfo: PageInfo + get() = _pageInfo.invoke() - @get:JvmName("getEdges") - public val edges: List? - get() = _edges.invoke() + @get:JvmName("getEdges") + public val edges: List? + get() = _edges.invoke() - public companion object { - private val pageInfoDefault: () -> PageInfo = - { throw IllegalStateException("Field `pageInfo` was not requested") } + public companion object { + private val pageInfoDefault: () -> PageInfo = { throw IllegalStateException("Field `pageInfo` was not requested") } + private val edgesDefault: () -> List? = { throw IllegalStateException("Field `edges` was not requested") } + } - private val edgesDefault: () -> List? = - { throw IllegalStateException("Field `edges` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var pageInfo: () -> PageInfo = pageInfoDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var pageInfo: () -> PageInfo = pageInfoDefault + private var edges: () -> List? = edgesDefault - private var edges: () -> List? = edgesDefault + @JsonProperty("pageInfo") + public fun withPageInfo(pageInfo: PageInfo): Builder = this.apply { + this.pageInfo = { pageInfo } + } - @JsonProperty("pageInfo") - public fun withPageInfo(pageInfo: PageInfo): Builder = this.apply { - this.pageInfo = { pageInfo } - } + @JsonProperty("edges") + public fun withEdges(edges: List?): Builder = this.apply { + this.edges = { edges } + } - @JsonProperty("edges") - public fun withEdges(edges: List?): Builder = this.apply { - this.edges = { edges } + public fun build(): EntityConnection = EntityConnection( + pageInfo = pageInfo, + edges = edges + ) } - - public fun build(): EntityConnection = EntityConnection( - pageInfo = pageInfo, - edges = edges, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/EntityEdge.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/EntityEdge.kt index 70a35ce7d..1392a54b8 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/EntityEdge.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/EntityEdge.kt @@ -12,51 +12,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = EntityEdge.Builder::class) public class EntityEdge( - cursor: () -> String = cursorDefault, - node: () -> Entity? = nodeDefault, + cursor: () -> String = cursorDefault, + node: () -> Entity? = nodeDefault ) { - private val _cursor: () -> String = cursor + private val _cursor: () -> String = cursor - private val _node: () -> Entity? = node + private val _node: () -> Entity? = node - @get:JvmName("getCursor") - public val cursor: String - get() = _cursor.invoke() + @get:JvmName("getCursor") + public val cursor: String + get() = _cursor.invoke() - @get:JvmName("getNode") - public val node: Entity? - get() = _node.invoke() + @get:JvmName("getNode") + public val node: Entity? + get() = _node.invoke() - public companion object { - private val cursorDefault: () -> String = - { throw IllegalStateException("Field `cursor` was not requested") } + public companion object { + private val cursorDefault: () -> String = { throw IllegalStateException("Field `cursor` was not requested") } + private val nodeDefault: () -> Entity? = { throw IllegalStateException("Field `node` was not requested") } + } - private val nodeDefault: () -> Entity? = - { throw IllegalStateException("Field `node` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var cursor: () -> String = cursorDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var cursor: () -> String = cursorDefault + private var node: () -> Entity? = nodeDefault - private var node: () -> Entity? = nodeDefault + @JsonProperty("cursor") + public fun withCursor(cursor: String): Builder = this.apply { + this.cursor = { cursor } + } - @JsonProperty("cursor") - public fun withCursor(cursor: String): Builder = this.apply { - this.cursor = { cursor } - } + @JsonProperty("node") + public fun withNode(node: Entity?): Builder = this.apply { + this.node = { node } + } - @JsonProperty("node") - public fun withNode(node: Entity?): Builder = this.apply { - this.node = { node } + public fun build(): EntityEdge = EntityEdge( + cursor = cursor, + node = node + ) } - - public fun build(): EntityEdge = EntityEdge( - cursor = cursor, - node = node, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/PageInfo.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/PageInfo.kt index a615b83bf..aa2d90510 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/PageInfo.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/PageInfo.kt @@ -13,89 +13,81 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = PageInfo.Builder::class) public class PageInfo( - startCursor: () -> String? = startCursorDefault, - endCursor: () -> String? = endCursorDefault, - hasNextPage: () -> Boolean = hasNextPageDefault, - hasPreviousPage: () -> Boolean = hasPreviousPageDefault, + startCursor: () -> String? = startCursorDefault, + endCursor: () -> String? = endCursorDefault, + hasNextPage: () -> Boolean = hasNextPageDefault, + hasPreviousPage: () -> Boolean = hasPreviousPageDefault ) { - private val _startCursor: () -> String? = startCursor + private val _startCursor: () -> String? = startCursor - private val _endCursor: () -> String? = endCursor + private val _endCursor: () -> String? = endCursor - private val _hasNextPage: () -> Boolean = hasNextPage + private val _hasNextPage: () -> Boolean = hasNextPage - private val _hasPreviousPage: () -> Boolean = hasPreviousPage + private val _hasPreviousPage: () -> Boolean = hasPreviousPage - @get:JvmName("getStartCursor") - public val startCursor: String? - get() = _startCursor.invoke() + @get:JvmName("getStartCursor") + public val startCursor: String? + get() = _startCursor.invoke() - @get:JvmName("getEndCursor") - public val endCursor: String? - get() = _endCursor.invoke() + @get:JvmName("getEndCursor") + public val endCursor: String? + get() = _endCursor.invoke() - @get:JvmName("getHasNextPage") - public val hasNextPage: Boolean - get() = _hasNextPage.invoke() + @get:JvmName("getHasNextPage") + public val hasNextPage: Boolean + get() = _hasNextPage.invoke() - @get:JvmName("getHasPreviousPage") - public val hasPreviousPage: Boolean - get() = _hasPreviousPage.invoke() + @get:JvmName("getHasPreviousPage") + public val hasPreviousPage: Boolean + get() = _hasPreviousPage.invoke() - public companion object { - private val startCursorDefault: () -> String? = - { throw IllegalStateException("Field `startCursor` was not requested") } + public companion object { + private val startCursorDefault: () -> String? = { throw IllegalStateException("Field `startCursor` was not requested") } + private val endCursorDefault: () -> String? = { throw IllegalStateException("Field `endCursor` was not requested") } - private val endCursorDefault: () -> String? = - { throw IllegalStateException("Field `endCursor` was not requested") } + private val hasNextPageDefault: () -> Boolean = { throw IllegalStateException("Field `hasNextPage` was not requested") } + private val hasPreviousPageDefault: () -> Boolean = { throw IllegalStateException("Field `hasPreviousPage` was not requested") } + } - private val hasNextPageDefault: () -> Boolean = - { throw IllegalStateException("Field `hasNextPage` was not requested") } - - - private val hasPreviousPageDefault: () -> Boolean = - { throw IllegalStateException("Field `hasPreviousPage` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var startCursor: () -> String? = startCursorDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var startCursor: () -> String? = startCursorDefault + private var endCursor: () -> String? = endCursorDefault - private var endCursor: () -> String? = endCursorDefault + private var hasNextPage: () -> Boolean = hasNextPageDefault - private var hasNextPage: () -> Boolean = hasNextPageDefault + private var hasPreviousPage: () -> Boolean = hasPreviousPageDefault - private var hasPreviousPage: () -> Boolean = hasPreviousPageDefault + @JsonProperty("startCursor") + public fun withStartCursor(startCursor: String?): Builder = this.apply { + this.startCursor = { startCursor } + } - @JsonProperty("startCursor") - public fun withStartCursor(startCursor: String?): Builder = this.apply { - this.startCursor = { startCursor } - } + @JsonProperty("endCursor") + public fun withEndCursor(endCursor: String?): Builder = this.apply { + this.endCursor = { endCursor } + } - @JsonProperty("endCursor") - public fun withEndCursor(endCursor: String?): Builder = this.apply { - this.endCursor = { endCursor } - } + @JsonProperty("hasNextPage") + public fun withHasNextPage(hasNextPage: Boolean): Builder = this.apply { + this.hasNextPage = { hasNextPage } + } - @JsonProperty("hasNextPage") - public fun withHasNextPage(hasNextPage: Boolean): Builder = this.apply { - this.hasNextPage = { hasNextPage } - } + @JsonProperty("hasPreviousPage") + public fun withHasPreviousPage(hasPreviousPage: Boolean): Builder = this.apply { + this.hasPreviousPage = { hasPreviousPage } + } - @JsonProperty("hasPreviousPage") - public fun withHasPreviousPage(hasPreviousPage: Boolean): Builder = this.apply { - this.hasPreviousPage = { hasPreviousPage } + public fun build(): PageInfo = PageInfo( + startCursor = startCursor, + endCursor = endCursor, + hasNextPage = hasNextPage, + hasPreviousPage = hasPreviousPage + ) } - - public fun build(): PageInfo = PageInfo( - startCursor = startCursor, - endCursor = endCursor, - hasNextPage = hasNextPage, - hasPreviousPage = hasPreviousPage, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/Query.kt index 14fc197ac..464b1eedf 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeclaredScalars/expected/types/Query.kt @@ -12,51 +12,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - entity: () -> List? = entityDefault, - entityConnection: () -> EntityConnection? = entityConnectionDefault, + entity: () -> List? = entityDefault, + entityConnection: () -> EntityConnection? = entityConnectionDefault ) { - private val _entity: () -> List? = entity + private val _entity: () -> List? = entity - private val _entityConnection: () -> EntityConnection? = entityConnection + private val _entityConnection: () -> EntityConnection? = entityConnection - @get:JvmName("getEntity") - public val entity: List? - get() = _entity.invoke() + @get:JvmName("getEntity") + public val entity: List? + get() = _entity.invoke() - @get:JvmName("getEntityConnection") - public val entityConnection: EntityConnection? - get() = _entityConnection.invoke() + @get:JvmName("getEntityConnection") + public val entityConnection: EntityConnection? + get() = _entityConnection.invoke() - public companion object { - private val entityDefault: () -> List? = - { throw IllegalStateException("Field `entity` was not requested") } + public companion object { + private val entityDefault: () -> List? = { throw IllegalStateException("Field `entity` was not requested") } + private val entityConnectionDefault: () -> EntityConnection? = { throw IllegalStateException("Field `entityConnection` was not requested") } + } - private val entityConnectionDefault: () -> EntityConnection? = - { throw IllegalStateException("Field `entityConnection` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var entity: () -> List? = entityDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var entity: () -> List? = entityDefault + private var entityConnection: () -> EntityConnection? = entityConnectionDefault - private var entityConnection: () -> EntityConnection? = entityConnectionDefault + @JsonProperty("entity") + public fun withEntity(entity: List?): Builder = this.apply { + this.entity = { entity } + } - @JsonProperty("entity") - public fun withEntity(entity: List?): Builder = this.apply { - this.entity = { entity } - } + @JsonProperty("entityConnection") + public fun withEntityConnection(entityConnection: EntityConnection?): Builder = this.apply { + this.entityConnection = { entityConnection } + } - @JsonProperty("entityConnection") - public fun withEntityConnection(entityConnection: EntityConnection?): Builder = this.apply { - this.entityConnection = { entityConnection } + public fun build(): Query = Query( + entity = entity, + entityConnection = entityConnection + ) } - - public fun build(): Query = Query( - entity = entity, - entityConnection = entityConnection, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/DgsClient.kt index d45ad1210..ca735c930 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/DgsConstants.kt index 73bce8552..e3b784741 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/DgsConstants.kt @@ -3,41 +3,41 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithDeeplyNestedComplexFi import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Cars: String = "cars" - } + public const val Cars: String = "cars" + } - public object CAR { - public const val TYPE_NAME: String = "Car" + public object CAR { + public const val TYPE_NAME: String = "Car" - public const val Make: String = "make" + public const val Make: String = "make" - public const val Model: String = "model" + public const val Model: String = "model" - public const val Engine: String = "engine" - } + public const val Engine: String = "engine" + } - public object ENGINE { - public const val TYPE_NAME: String = "Engine" + public object ENGINE { + public const val TYPE_NAME: String = "Engine" - public const val Type: String = "type" + public const val Type: String = "type" - public const val Bhp: String = "bhp" + public const val Bhp: String = "bhp" - public const val Size: String = "size" + public const val Size: String = "size" - public const val Performance: String = "performance" - } + public const val Performance: String = "performance" + } - public object PERFORMANCE { - public const val TYPE_NAME: String = "Performance" + public object PERFORMANCE { + public const val TYPE_NAME: String = "Performance" - public const val ZeroToSixty: String = "zeroToSixty" + public const val ZeroToSixty: String = "zeroToSixty" - public const val QuarterMile: String = "quarterMile" - } + public const val QuarterMile: String = "quarterMile" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/client/CarProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/client/CarProjection.kt index be3f36c41..9fdea1cfb 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/client/CarProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/client/CarProjection.kt @@ -3,20 +3,20 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithDeeplyNestedComplexFi import com.netflix.graphql.dgs.codegen.GraphQLProjection public class CarProjection : GraphQLProjection() { - public val make: CarProjection - get() { - field("make") - return this - } + public val make: CarProjection + get() { + field("make") + return this + } - public val model: CarProjection - get() { - field("model") - return this - } + public val model: CarProjection + get() { + field("model") + return this + } - public fun engine(_projection: EngineProjection.() -> EngineProjection): CarProjection { - field("engine", EngineProjection(), _projection) - return this - } + public fun engine(_projection: EngineProjection.() -> EngineProjection): CarProjection { + field("engine", EngineProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/client/EngineProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/client/EngineProjection.kt index 3d24bd5e1..6bec7c53d 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/client/EngineProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/client/EngineProjection.kt @@ -3,27 +3,27 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithDeeplyNestedComplexFi import com.netflix.graphql.dgs.codegen.GraphQLProjection public class EngineProjection : GraphQLProjection() { - public val type: EngineProjection - get() { - field("type") - return this - } + public val type: EngineProjection + get() { + field("type") + return this + } - public val bhp: EngineProjection - get() { - field("bhp") - return this - } + public val bhp: EngineProjection + get() { + field("bhp") + return this + } - public val size: EngineProjection - get() { - field("size") - return this - } + public val size: EngineProjection + get() { + field("size") + return this + } - public fun performance(_projection: PerformanceProjection.() -> PerformanceProjection): - EngineProjection { - field("performance", PerformanceProjection(), _projection) - return this - } + public fun performance(_projection: PerformanceProjection.() -> PerformanceProjection): + EngineProjection { + field("performance", PerformanceProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/client/PerformanceProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/client/PerformanceProjection.kt index 53de97a96..b7946bdc1 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/client/PerformanceProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/client/PerformanceProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithDeeplyNestedComplexFi import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PerformanceProjection : GraphQLProjection() { - public val zeroToSixty: PerformanceProjection - get() { - field("zeroToSixty") - return this - } + public val zeroToSixty: PerformanceProjection + get() { + field("zeroToSixty") + return this + } - public val quarterMile: PerformanceProjection - get() { - field("quarterMile") - return this - } + public val quarterMile: PerformanceProjection + get() { + field("quarterMile") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/client/QueryProjection.kt index 7acb3b439..86b186761 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/client/QueryProjection.kt @@ -3,8 +3,8 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithDeeplyNestedComplexFi import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun cars(_projection: CarProjection.() -> CarProjection): QueryProjection { - field("cars", CarProjection(), _projection) - return this - } + public fun cars(_projection: CarProjection.() -> CarProjection): QueryProjection { + field("cars", CarProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/types/Car.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/types/Car.kt index eb4fcd8f8..f4963361a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/types/Car.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/types/Car.kt @@ -12,70 +12,64 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Car.Builder::class) public class Car( - make: () -> String? = makeDefault, - model: () -> String? = modelDefault, - engine: () -> Engine? = engineDefault, + make: () -> String? = makeDefault, + model: () -> String? = modelDefault, + engine: () -> Engine? = engineDefault ) { - private val _make: () -> String? = make + private val _make: () -> String? = make - private val _model: () -> String? = model + private val _model: () -> String? = model - private val _engine: () -> Engine? = engine + private val _engine: () -> Engine? = engine - @get:JvmName("getMake") - public val make: String? - get() = _make.invoke() + @get:JvmName("getMake") + public val make: String? + get() = _make.invoke() - @get:JvmName("getModel") - public val model: String? - get() = _model.invoke() + @get:JvmName("getModel") + public val model: String? + get() = _model.invoke() - @get:JvmName("getEngine") - public val engine: Engine? - get() = _engine.invoke() + @get:JvmName("getEngine") + public val engine: Engine? + get() = _engine.invoke() - public companion object { - private val makeDefault: () -> String? = - { throw IllegalStateException("Field `make` was not requested") } + public companion object { + private val makeDefault: () -> String? = { throw IllegalStateException("Field `make` was not requested") } + private val modelDefault: () -> String? = { throw IllegalStateException("Field `model` was not requested") } - private val modelDefault: () -> String? = - { throw IllegalStateException("Field `model` was not requested") } - - - private val engineDefault: () -> Engine? = - { throw IllegalStateException("Field `engine` was not requested") } + private val engineDefault: () -> Engine? = { throw IllegalStateException("Field `engine` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var make: () -> String? = makeDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var make: () -> String? = makeDefault + private var model: () -> String? = modelDefault - private var model: () -> String? = modelDefault + private var engine: () -> Engine? = engineDefault - private var engine: () -> Engine? = engineDefault + @JsonProperty("make") + public fun withMake(make: String?): Builder = this.apply { + this.make = { make } + } - @JsonProperty("make") - public fun withMake(make: String?): Builder = this.apply { - this.make = { make } - } + @JsonProperty("model") + public fun withModel(model: String?): Builder = this.apply { + this.model = { model } + } - @JsonProperty("model") - public fun withModel(model: String?): Builder = this.apply { - this.model = { model } - } + @JsonProperty("engine") + public fun withEngine(engine: Engine?): Builder = this.apply { + this.engine = { engine } + } - @JsonProperty("engine") - public fun withEngine(engine: Engine?): Builder = this.apply { - this.engine = { engine } + public fun build(): Car = Car( + make = make, + model = model, + engine = engine + ) } - - public fun build(): Car = Car( - make = make, - model = model, - engine = engine, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/types/Engine.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/types/Engine.kt index 6580218ac..7dc88881f 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/types/Engine.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/types/Engine.kt @@ -14,89 +14,81 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Engine.Builder::class) public class Engine( - type: () -> String? = typeDefault, - bhp: () -> Int? = bhpDefault, - size: () -> Double? = sizeDefault, - performance: () -> Performance? = performanceDefault, + type: () -> String? = typeDefault, + bhp: () -> Int? = bhpDefault, + size: () -> Double? = sizeDefault, + performance: () -> Performance? = performanceDefault ) { - private val _type: () -> String? = type + private val _type: () -> String? = type - private val _bhp: () -> Int? = bhp + private val _bhp: () -> Int? = bhp - private val _size: () -> Double? = size + private val _size: () -> Double? = size - private val _performance: () -> Performance? = performance + private val _performance: () -> Performance? = performance - @get:JvmName("getType") - public val type: String? - get() = _type.invoke() + @get:JvmName("getType") + public val type: String? + get() = _type.invoke() - @get:JvmName("getBhp") - public val bhp: Int? - get() = _bhp.invoke() + @get:JvmName("getBhp") + public val bhp: Int? + get() = _bhp.invoke() - @get:JvmName("getSize") - public val size: Double? - get() = _size.invoke() + @get:JvmName("getSize") + public val size: Double? + get() = _size.invoke() - @get:JvmName("getPerformance") - public val performance: Performance? - get() = _performance.invoke() + @get:JvmName("getPerformance") + public val performance: Performance? + get() = _performance.invoke() - public companion object { - private val typeDefault: () -> String? = - { throw IllegalStateException("Field `type` was not requested") } + public companion object { + private val typeDefault: () -> String? = { throw IllegalStateException("Field `type` was not requested") } + private val bhpDefault: () -> Int? = { throw IllegalStateException("Field `bhp` was not requested") } - private val bhpDefault: () -> Int? = - { throw IllegalStateException("Field `bhp` was not requested") } + private val sizeDefault: () -> Double? = { throw IllegalStateException("Field `size` was not requested") } + private val performanceDefault: () -> Performance? = { throw IllegalStateException("Field `performance` was not requested") } + } - private val sizeDefault: () -> Double? = - { throw IllegalStateException("Field `size` was not requested") } - - - private val performanceDefault: () -> Performance? = - { throw IllegalStateException("Field `performance` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var type: () -> String? = typeDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var type: () -> String? = typeDefault + private var bhp: () -> Int? = bhpDefault - private var bhp: () -> Int? = bhpDefault + private var size: () -> Double? = sizeDefault - private var size: () -> Double? = sizeDefault + private var performance: () -> Performance? = performanceDefault - private var performance: () -> Performance? = performanceDefault + @JsonProperty("type") + public fun withType(type: String?): Builder = this.apply { + this.type = { type } + } - @JsonProperty("type") - public fun withType(type: String?): Builder = this.apply { - this.type = { type } - } + @JsonProperty("bhp") + public fun withBhp(bhp: Int?): Builder = this.apply { + this.bhp = { bhp } + } - @JsonProperty("bhp") - public fun withBhp(bhp: Int?): Builder = this.apply { - this.bhp = { bhp } - } + @JsonProperty("size") + public fun withSize(size: Double?): Builder = this.apply { + this.size = { size } + } - @JsonProperty("size") - public fun withSize(size: Double?): Builder = this.apply { - this.size = { size } - } + @JsonProperty("performance") + public fun withPerformance(performance: Performance?): Builder = this.apply { + this.performance = { performance } + } - @JsonProperty("performance") - public fun withPerformance(performance: Performance?): Builder = this.apply { - this.performance = { performance } + public fun build(): Engine = Engine( + type = type, + bhp = bhp, + size = size, + performance = performance + ) } - - public fun build(): Engine = Engine( - type = type, - bhp = bhp, - size = size, - performance = performance, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/types/Performance.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/types/Performance.kt index 78b85ad20..da0ead692 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/types/Performance.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/types/Performance.kt @@ -12,51 +12,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Performance.Builder::class) public class Performance( - zeroToSixty: () -> Double? = zeroToSixtyDefault, - quarterMile: () -> Double? = quarterMileDefault, + zeroToSixty: () -> Double? = zeroToSixtyDefault, + quarterMile: () -> Double? = quarterMileDefault ) { - private val _zeroToSixty: () -> Double? = zeroToSixty + private val _zeroToSixty: () -> Double? = zeroToSixty - private val _quarterMile: () -> Double? = quarterMile + private val _quarterMile: () -> Double? = quarterMile - @get:JvmName("getZeroToSixty") - public val zeroToSixty: Double? - get() = _zeroToSixty.invoke() + @get:JvmName("getZeroToSixty") + public val zeroToSixty: Double? + get() = _zeroToSixty.invoke() - @get:JvmName("getQuarterMile") - public val quarterMile: Double? - get() = _quarterMile.invoke() + @get:JvmName("getQuarterMile") + public val quarterMile: Double? + get() = _quarterMile.invoke() - public companion object { - private val zeroToSixtyDefault: () -> Double? = - { throw IllegalStateException("Field `zeroToSixty` was not requested") } + public companion object { + private val zeroToSixtyDefault: () -> Double? = { throw IllegalStateException("Field `zeroToSixty` was not requested") } + private val quarterMileDefault: () -> Double? = { throw IllegalStateException("Field `quarterMile` was not requested") } + } - private val quarterMileDefault: () -> Double? = - { throw IllegalStateException("Field `quarterMile` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var zeroToSixty: () -> Double? = zeroToSixtyDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var zeroToSixty: () -> Double? = zeroToSixtyDefault + private var quarterMile: () -> Double? = quarterMileDefault - private var quarterMile: () -> Double? = quarterMileDefault + @JsonProperty("zeroToSixty") + public fun withZeroToSixty(zeroToSixty: Double?): Builder = this.apply { + this.zeroToSixty = { zeroToSixty } + } - @JsonProperty("zeroToSixty") - public fun withZeroToSixty(zeroToSixty: Double?): Builder = this.apply { - this.zeroToSixty = { zeroToSixty } - } + @JsonProperty("quarterMile") + public fun withQuarterMile(quarterMile: Double?): Builder = this.apply { + this.quarterMile = { quarterMile } + } - @JsonProperty("quarterMile") - public fun withQuarterMile(quarterMile: Double?): Builder = this.apply { - this.quarterMile = { quarterMile } + public fun build(): Performance = Performance( + zeroToSixty = zeroToSixty, + quarterMile = quarterMile + ) } - - public fun build(): Performance = Performance( - zeroToSixty = zeroToSixty, - quarterMile = quarterMile, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/types/Query.kt index d1a4a477d..f44be57d4 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithDeeplyNestedComplexField/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - cars: () -> List? = carsDefault, + cars: () -> List? = carsDefault ) { - private val _cars: () -> List? = cars + private val _cars: () -> List? = cars - @get:JvmName("getCars") - public val cars: List? - get() = _cars.invoke() + @get:JvmName("getCars") + public val cars: List? + get() = _cars.invoke() - public companion object { - private val carsDefault: () -> List? = - { throw IllegalStateException("Field `cars` was not requested") } + public companion object { + private val carsDefault: () -> List? = { throw IllegalStateException("Field `cars` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var cars: () -> List? = carsDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var cars: () -> List? = carsDefault + @JsonProperty("cars") + public fun withCars(cars: List?): Builder = this.apply { + this.cars = { cars } + } - @JsonProperty("cars") - public fun withCars(cars: List?): Builder = this.apply { - this.cars = { cars } + public fun build(): Query = Query( + cars = cars + ) } - - public fun build(): Query = Query( - cars = cars, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/DgsClient.kt index 0a451b275..58d00c292 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/DgsConstants.kt index 447d9c152..4061228bc 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/DgsConstants.kt @@ -3,21 +3,21 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithExtendedInterface.exp import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val People: String = "people" - } + public const val People: String = "people" + } - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Lastname: String = "lastname" + public const val Lastname: String = "lastname" - public const val Age: String = "age" - } + public const val Age: String = "age" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/client/PersonProjection.kt index fb39eedf3..9027ead81 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/client/PersonProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithExtendedInterface.exp import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val firstname: PersonProjection - get() { - field("firstname") - return this - } + public val firstname: PersonProjection + get() { + field("firstname") + return this + } - public val lastname: PersonProjection - get() { - field("lastname") - return this - } + public val lastname: PersonProjection + get() { + field("lastname") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/client/QueryProjection.kt index a69f168d1..699e1d584 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/client/QueryProjection.kt @@ -3,8 +3,8 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithExtendedInterface.exp import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("people", PersonProjection(), _projection) - return this - } + public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { + field("people", PersonProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/types/Person.kt index 113449f84..d13fceddf 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/types/Person.kt @@ -7,20 +7,20 @@ import kotlin.Suppress import kotlin.jvm.JvmName @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" ) public sealed interface Person { - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFirstname") - public val firstname: String + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFirstname") + public val firstname: String - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getLastname") - public val lastname: String? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getLastname") + public val lastname: String? - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getAge") - public val age: Int? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getAge") + public val age: Int? } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/types/Query.kt index f90860317..f4941a39e 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterface/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - people: () -> List? = peopleDefault, + people: () -> List? = peopleDefault ) { - private val _people: () -> List? = people + private val _people: () -> List? = people - @get:JvmName("getPeople") - public val people: List? - get() = _people.invoke() + @get:JvmName("getPeople") + public val people: List? + get() = _people.invoke() - public companion object { - private val peopleDefault: () -> List? = - { throw IllegalStateException("Field `people` was not requested") } + public companion object { + private val peopleDefault: () -> List? = { throw IllegalStateException("Field `people` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var people: () -> List? = peopleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var people: () -> List? = peopleDefault + @JsonProperty("people") + public fun withPeople(people: List?): Builder = this.apply { + this.people = { people } + } - @JsonProperty("people") - public fun withPeople(people: List?): Builder = this.apply { - this.people = { people } + public fun build(): Query = Query( + people = people + ) } - - public fun build(): Query = Query( - people = people, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/DgsClient.kt index 78d29b4d8..18d88e9b6 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/DgsConstants.kt index d28ba953f..8af9451a7 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/DgsConstants.kt @@ -3,29 +3,29 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithInterface.expected import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val People: String = "people" - } + public const val People: String = "people" + } - public object EMPLOYEE { - public const val TYPE_NAME: String = "Employee" + public object EMPLOYEE { + public const val TYPE_NAME: String = "Employee" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Lastname: String = "lastname" + public const val Lastname: String = "lastname" - public const val Company: String = "company" - } + public const val Company: String = "company" + } - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Lastname: String = "lastname" - } + public const val Lastname: String = "lastname" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/client/EmployeeProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/client/EmployeeProjection.kt index c6a1bd789..2b7910633 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/client/EmployeeProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/client/EmployeeProjection.kt @@ -3,21 +3,21 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithInterface.expected.cl import com.netflix.graphql.dgs.codegen.GraphQLProjection public class EmployeeProjection : GraphQLProjection() { - public val firstname: EmployeeProjection - get() { - field("firstname") - return this - } + public val firstname: EmployeeProjection + get() { + field("firstname") + return this + } - public val lastname: EmployeeProjection - get() { - field("lastname") - return this - } + public val lastname: EmployeeProjection + get() { + field("lastname") + return this + } - public val company: EmployeeProjection - get() { - field("company") - return this - } + public val company: EmployeeProjection + get() { + field("company") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/client/PersonProjection.kt index acb719f50..aa1c4bb08 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/client/PersonProjection.kt @@ -3,21 +3,21 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithInterface.expected.cl import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val firstname: PersonProjection - get() { - field("firstname") - return this - } + public val firstname: PersonProjection + get() { + field("firstname") + return this + } - public val lastname: PersonProjection - get() { - field("lastname") - return this - } + public val lastname: PersonProjection + get() { + field("lastname") + return this + } - public fun onEmployee(_projection: EmployeeProjection.() -> EmployeeProjection): - PersonProjection { - fragment("Employee", EmployeeProjection(), _projection) - return this - } + public fun onEmployee(_projection: EmployeeProjection.() -> EmployeeProjection): + PersonProjection { + fragment("Employee", EmployeeProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/client/QueryProjection.kt index 224bab404..877291ad8 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/client/QueryProjection.kt @@ -3,8 +3,8 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithInterface.expected.cl import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("people", PersonProjection(), _projection) - return this - } + public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { + field("people", PersonProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/types/Employee.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/types/Employee.kt index ee992c7be..1058ceb04 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/types/Employee.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/types/Employee.kt @@ -13,72 +13,66 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Employee.Builder::class) public class Employee( - firstname: () -> String? = firstnameDefault, - lastname: () -> String? = lastnameDefault, - company: () -> String? = companyDefault, + firstname: () -> String? = firstnameDefault, + lastname: () -> String? = lastnameDefault, + company: () -> String? = companyDefault ) : Person { - private val _firstname: () -> String? = firstname + private val _firstname: () -> String? = firstname - private val _lastname: () -> String? = lastname + private val _lastname: () -> String? = lastname - private val _company: () -> String? = company + private val _company: () -> String? = company - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFirstname") - override val firstname: String? - get() = _firstname.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFirstname") + override val firstname: String? + get() = _firstname.invoke() - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getLastname") - override val lastname: String? - get() = _lastname.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getLastname") + override val lastname: String? + get() = _lastname.invoke() - @get:JvmName("getCompany") - public val company: String? - get() = _company.invoke() + @get:JvmName("getCompany") + public val company: String? + get() = _company.invoke() - public companion object { - private val firstnameDefault: () -> String? = - { throw IllegalStateException("Field `firstname` was not requested") } + public companion object { + private val firstnameDefault: () -> String? = { throw IllegalStateException("Field `firstname` was not requested") } + private val lastnameDefault: () -> String? = { throw IllegalStateException("Field `lastname` was not requested") } - private val lastnameDefault: () -> String? = - { throw IllegalStateException("Field `lastname` was not requested") } - - - private val companyDefault: () -> String? = - { throw IllegalStateException("Field `company` was not requested") } + private val companyDefault: () -> String? = { throw IllegalStateException("Field `company` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var firstname: () -> String? = firstnameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var firstname: () -> String? = firstnameDefault + private var lastname: () -> String? = lastnameDefault - private var lastname: () -> String? = lastnameDefault + private var company: () -> String? = companyDefault - private var company: () -> String? = companyDefault + @JsonProperty("firstname") + public fun withFirstname(firstname: String?): Builder = this.apply { + this.firstname = { firstname } + } - @JsonProperty("firstname") - public fun withFirstname(firstname: String?): Builder = this.apply { - this.firstname = { firstname } - } + @JsonProperty("lastname") + public fun withLastname(lastname: String?): Builder = this.apply { + this.lastname = { lastname } + } - @JsonProperty("lastname") - public fun withLastname(lastname: String?): Builder = this.apply { - this.lastname = { lastname } - } + @JsonProperty("company") + public fun withCompany(company: String?): Builder = this.apply { + this.company = { company } + } - @JsonProperty("company") - public fun withCompany(company: String?): Builder = this.apply { - this.company = { company } + public fun build(): Employee = Employee( + firstname = firstname, + lastname = lastname, + company = company + ) } - - public fun build(): Employee = Employee( - firstname = firstname, - lastname = lastname, - company = company, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/types/Person.kt index 5c165998a..17ec6633e 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/types/Person.kt @@ -7,19 +7,21 @@ import kotlin.Suppress import kotlin.jvm.JvmName @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" +) +@JsonSubTypes( + value = [ + JsonSubTypes.Type(value = Employee::class, name = "Employee") + ] ) -@JsonSubTypes(value = [ - JsonSubTypes.Type(value = Employee::class, name = "Employee") -]) public sealed interface Person { - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFirstname") - public val firstname: String? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFirstname") + public val firstname: String? - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getLastname") - public val lastname: String? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getLastname") + public val lastname: String? } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/types/Query.kt index 1e66b0eb4..48c72728d 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterface/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - people: () -> List? = peopleDefault, + people: () -> List? = peopleDefault ) { - private val _people: () -> List? = people + private val _people: () -> List? = people - @get:JvmName("getPeople") - public val people: List? - get() = _people.invoke() + @get:JvmName("getPeople") + public val people: List? + get() = _people.invoke() - public companion object { - private val peopleDefault: () -> List? = - { throw IllegalStateException("Field `people` was not requested") } + public companion object { + private val peopleDefault: () -> List? = { throw IllegalStateException("Field `people` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var people: () -> List? = peopleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var people: () -> List? = peopleDefault + @JsonProperty("people") + public fun withPeople(people: List?): Builder = this.apply { + this.people = { people } + } - @JsonProperty("people") - public fun withPeople(people: List?): Builder = this.apply { - this.people = { people } + public fun build(): Query = Query( + people = people + ) } - - public fun build(): Query = Query( - people = people, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/DgsClient.kt index 3daa80d05..ea0430337 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/DgsConstants.kt index d3f0d776f..ffc07a99f 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/DgsConstants.kt @@ -3,41 +3,41 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithInterfaceInheritance. import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val People: String = "people" - } + public const val People: String = "people" + } - public object TALENT { - public const val TYPE_NAME: String = "Talent" + public object TALENT { + public const val TYPE_NAME: String = "Talent" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Lastname: String = "lastname" + public const val Lastname: String = "lastname" - public const val Company: String = "company" + public const val Company: String = "company" - public const val ImdbProfile: String = "imdbProfile" - } + public const val ImdbProfile: String = "imdbProfile" + } - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Lastname: String = "lastname" - } + public const val Lastname: String = "lastname" + } - public object EMPLOYEE { - public const val TYPE_NAME: String = "Employee" + public object EMPLOYEE { + public const val TYPE_NAME: String = "Employee" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Lastname: String = "lastname" + public const val Lastname: String = "lastname" - public const val Company: String = "company" - } + public const val Company: String = "company" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/client/EmployeeProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/client/EmployeeProjection.kt index b2465b78d..f5a3a1f68 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/client/EmployeeProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/client/EmployeeProjection.kt @@ -3,26 +3,26 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithInterfaceInheritance. import com.netflix.graphql.dgs.codegen.GraphQLProjection public class EmployeeProjection : GraphQLProjection() { - public val firstname: EmployeeProjection - get() { - field("firstname") - return this - } + public val firstname: EmployeeProjection + get() { + field("firstname") + return this + } - public val lastname: EmployeeProjection - get() { - field("lastname") - return this - } + public val lastname: EmployeeProjection + get() { + field("lastname") + return this + } - public val company: EmployeeProjection - get() { - field("company") - return this - } + public val company: EmployeeProjection + get() { + field("company") + return this + } - public fun onTalent(_projection: TalentProjection.() -> TalentProjection): EmployeeProjection { - fragment("Talent", TalentProjection(), _projection) - return this - } + public fun onTalent(_projection: TalentProjection.() -> TalentProjection): EmployeeProjection { + fragment("Talent", TalentProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/client/PersonProjection.kt index 22bd9d0d5..5b7c1d5f1 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/client/PersonProjection.kt @@ -3,21 +3,21 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithInterfaceInheritance. import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val firstname: PersonProjection - get() { - field("firstname") - return this - } + public val firstname: PersonProjection + get() { + field("firstname") + return this + } - public val lastname: PersonProjection - get() { - field("lastname") - return this - } + public val lastname: PersonProjection + get() { + field("lastname") + return this + } - public fun onEmployee(_projection: EmployeeProjection.() -> EmployeeProjection): - PersonProjection { - fragment("Employee", EmployeeProjection(), _projection) - return this - } + public fun onEmployee(_projection: EmployeeProjection.() -> EmployeeProjection): + PersonProjection { + fragment("Employee", EmployeeProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/client/QueryProjection.kt index dfaa2a460..b10bf4e41 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/client/QueryProjection.kt @@ -3,8 +3,8 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithInterfaceInheritance. import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("people", PersonProjection(), _projection) - return this - } + public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { + field("people", PersonProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/client/TalentProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/client/TalentProjection.kt index d908e3dcb..34f2bf28c 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/client/TalentProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/client/TalentProjection.kt @@ -3,27 +3,27 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithInterfaceInheritance. import com.netflix.graphql.dgs.codegen.GraphQLProjection public class TalentProjection : GraphQLProjection() { - public val firstname: TalentProjection - get() { - field("firstname") - return this - } + public val firstname: TalentProjection + get() { + field("firstname") + return this + } - public val lastname: TalentProjection - get() { - field("lastname") - return this - } + public val lastname: TalentProjection + get() { + field("lastname") + return this + } - public val company: TalentProjection - get() { - field("company") - return this - } + public val company: TalentProjection + get() { + field("company") + return this + } - public val imdbProfile: TalentProjection - get() { - field("imdbProfile") - return this - } + public val imdbProfile: TalentProjection + get() { + field("imdbProfile") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/types/Employee.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/types/Employee.kt index ff83ea205..94ce30424 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/types/Employee.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/types/Employee.kt @@ -7,23 +7,25 @@ import kotlin.Suppress import kotlin.jvm.JvmName @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" +) +@JsonSubTypes( + value = [ + JsonSubTypes.Type(value = Talent::class, name = "Talent") + ] ) -@JsonSubTypes(value = [ - JsonSubTypes.Type(value = Talent::class, name = "Talent") -]) public sealed interface Employee : Person { - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFirstname") - override val firstname: String + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFirstname") + override val firstname: String - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getLastname") - override val lastname: String? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getLastname") + override val lastname: String? - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getCompany") - public val company: String? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getCompany") + public val company: String? } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/types/Person.kt index 838bf60ee..4cfa3df3d 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/types/Person.kt @@ -6,16 +6,16 @@ import kotlin.Suppress import kotlin.jvm.JvmName @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" ) public sealed interface Person { - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFirstname") - public val firstname: String + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFirstname") + public val firstname: String - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getLastname") - public val lastname: String? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getLastname") + public val lastname: String? } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/types/Query.kt index 14b5114da..4f032aa49 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - people: () -> List? = peopleDefault, + people: () -> List? = peopleDefault ) { - private val _people: () -> List? = people + private val _people: () -> List? = people - @get:JvmName("getPeople") - public val people: List? - get() = _people.invoke() + @get:JvmName("getPeople") + public val people: List? + get() = _people.invoke() - public companion object { - private val peopleDefault: () -> List? = - { throw IllegalStateException("Field `people` was not requested") } + public companion object { + private val peopleDefault: () -> List? = { throw IllegalStateException("Field `people` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var people: () -> List? = peopleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var people: () -> List? = peopleDefault + @JsonProperty("people") + public fun withPeople(people: List?): Builder = this.apply { + this.people = { people } + } - @JsonProperty("people") - public fun withPeople(people: List?): Builder = this.apply { - this.people = { people } + public fun build(): Query = Query( + people = people + ) } - - public fun build(): Query = Query( - people = people, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/types/Talent.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/types/Talent.kt index 3f82268e0..d532a3dc7 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/types/Talent.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithInterfaceInheritance/expected/types/Talent.kt @@ -13,92 +13,84 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Talent.Builder::class) public class Talent( - firstname: () -> String = firstnameDefault, - lastname: () -> String? = lastnameDefault, - company: () -> String? = companyDefault, - imdbProfile: () -> String? = imdbProfileDefault, + firstname: () -> String = firstnameDefault, + lastname: () -> String? = lastnameDefault, + company: () -> String? = companyDefault, + imdbProfile: () -> String? = imdbProfileDefault ) : Employee { - private val _firstname: () -> String = firstname + private val _firstname: () -> String = firstname - private val _lastname: () -> String? = lastname + private val _lastname: () -> String? = lastname - private val _company: () -> String? = company + private val _company: () -> String? = company - private val _imdbProfile: () -> String? = imdbProfile + private val _imdbProfile: () -> String? = imdbProfile - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFirstname") - override val firstname: String - get() = _firstname.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFirstname") + override val firstname: String + get() = _firstname.invoke() - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getLastname") - override val lastname: String? - get() = _lastname.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getLastname") + override val lastname: String? + get() = _lastname.invoke() - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getCompany") - override val company: String? - get() = _company.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getCompany") + override val company: String? + get() = _company.invoke() - @get:JvmName("getImdbProfile") - public val imdbProfile: String? - get() = _imdbProfile.invoke() + @get:JvmName("getImdbProfile") + public val imdbProfile: String? + get() = _imdbProfile.invoke() - public companion object { - private val firstnameDefault: () -> String = - { throw IllegalStateException("Field `firstname` was not requested") } + public companion object { + private val firstnameDefault: () -> String = { throw IllegalStateException("Field `firstname` was not requested") } + private val lastnameDefault: () -> String? = { throw IllegalStateException("Field `lastname` was not requested") } - private val lastnameDefault: () -> String? = - { throw IllegalStateException("Field `lastname` was not requested") } + private val companyDefault: () -> String? = { throw IllegalStateException("Field `company` was not requested") } + private val imdbProfileDefault: () -> String? = { throw IllegalStateException("Field `imdbProfile` was not requested") } + } - private val companyDefault: () -> String? = - { throw IllegalStateException("Field `company` was not requested") } - - - private val imdbProfileDefault: () -> String? = - { throw IllegalStateException("Field `imdbProfile` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var firstname: () -> String = firstnameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var firstname: () -> String = firstnameDefault + private var lastname: () -> String? = lastnameDefault - private var lastname: () -> String? = lastnameDefault + private var company: () -> String? = companyDefault - private var company: () -> String? = companyDefault + private var imdbProfile: () -> String? = imdbProfileDefault - private var imdbProfile: () -> String? = imdbProfileDefault + @JsonProperty("firstname") + public fun withFirstname(firstname: String): Builder = this.apply { + this.firstname = { firstname } + } - @JsonProperty("firstname") - public fun withFirstname(firstname: String): Builder = this.apply { - this.firstname = { firstname } - } + @JsonProperty("lastname") + public fun withLastname(lastname: String?): Builder = this.apply { + this.lastname = { lastname } + } - @JsonProperty("lastname") - public fun withLastname(lastname: String?): Builder = this.apply { - this.lastname = { lastname } - } + @JsonProperty("company") + public fun withCompany(company: String?): Builder = this.apply { + this.company = { company } + } - @JsonProperty("company") - public fun withCompany(company: String?): Builder = this.apply { - this.company = { company } - } + @JsonProperty("imdbProfile") + public fun withImdbProfile(imdbProfile: String?): Builder = this.apply { + this.imdbProfile = { imdbProfile } + } - @JsonProperty("imdbProfile") - public fun withImdbProfile(imdbProfile: String?): Builder = this.apply { - this.imdbProfile = { imdbProfile } + public fun build(): Talent = Talent( + firstname = firstname, + lastname = lastname, + company = company, + imdbProfile = imdbProfile + ) } - - public fun build(): Talent = Talent( - firstname = firstname, - lastname = lastname, - company = company, - imdbProfile = imdbProfile, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/DgsClient.kt index 5e0eab427..d1af8b522 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/DgsConstants.kt index e96be4092..07acb847f 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/DgsConstants.kt @@ -3,19 +3,19 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithListProperties.expect import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val People: String = "people" - } + public const val People: String = "people" + } - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Name: String = "name" + public const val Name: String = "name" - public const val Email: String = "email" - } + public const val Email: String = "email" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/client/PersonProjection.kt index 56112e7dd..15ed4a281 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/client/PersonProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithListProperties.expect import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val name: PersonProjection - get() { - field("name") - return this - } + public val name: PersonProjection + get() { + field("name") + return this + } - public val email: PersonProjection - get() { - field("email") - return this - } + public val email: PersonProjection + get() { + field("email") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/client/QueryProjection.kt index 717af733a..4f07605f4 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/client/QueryProjection.kt @@ -3,8 +3,8 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithListProperties.expect import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("people", PersonProjection(), _projection) - return this - } + public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { + field("people", PersonProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/types/Person.kt index fb3e4bae0..23ea35f07 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/types/Person.kt @@ -13,51 +13,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Person.Builder::class) public class Person( - name: () -> String? = nameDefault, - email: () -> List? = emailDefault, + name: () -> String? = nameDefault, + email: () -> List? = emailDefault ) { - private val _name: () -> String? = name + private val _name: () -> String? = name - private val _email: () -> List? = email + private val _email: () -> List? = email - @get:JvmName("getName") - public val name: String? - get() = _name.invoke() + @get:JvmName("getName") + public val name: String? + get() = _name.invoke() - @get:JvmName("getEmail") - public val email: List? - get() = _email.invoke() + @get:JvmName("getEmail") + public val email: List? + get() = _email.invoke() - public companion object { - private val nameDefault: () -> String? = - { throw IllegalStateException("Field `name` was not requested") } + public companion object { + private val nameDefault: () -> String? = { throw IllegalStateException("Field `name` was not requested") } + private val emailDefault: () -> List? = { throw IllegalStateException("Field `email` was not requested") } + } - private val emailDefault: () -> List? = - { throw IllegalStateException("Field `email` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var name: () -> String? = nameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var name: () -> String? = nameDefault + private var email: () -> List? = emailDefault - private var email: () -> List? = emailDefault + @JsonProperty("name") + public fun withName(name: String?): Builder = this.apply { + this.name = { name } + } - @JsonProperty("name") - public fun withName(name: String?): Builder = this.apply { - this.name = { name } - } + @JsonProperty("email") + public fun withEmail(email: List?): Builder = this.apply { + this.email = { email } + } - @JsonProperty("email") - public fun withEmail(email: List?): Builder = this.apply { - this.email = { email } + public fun build(): Person = Person( + name = name, + email = email + ) } - - public fun build(): Person = Person( - name = name, - email = email, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/types/Query.kt index 402f323cb..dff07d674 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithListProperties/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - people: () -> List? = peopleDefault, + people: () -> List? = peopleDefault ) { - private val _people: () -> List? = people + private val _people: () -> List? = people - @get:JvmName("getPeople") - public val people: List? - get() = _people.invoke() + @get:JvmName("getPeople") + public val people: List? + get() = _people.invoke() - public companion object { - private val peopleDefault: () -> List? = - { throw IllegalStateException("Field `people` was not requested") } + public companion object { + private val peopleDefault: () -> List? = { throw IllegalStateException("Field `people` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var people: () -> List? = peopleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var people: () -> List? = peopleDefault + @JsonProperty("people") + public fun withPeople(people: List?): Builder = this.apply { + this.people = { people } + } - @JsonProperty("people") - public fun withPeople(people: List?): Builder = this.apply { - this.people = { people } + public fun build(): Query = Query( + people = people + ) } - - public fun build(): Query = Query( - people = people, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/DgsClient.kt index a08871a6f..4cf0b5726 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/DgsConstants.kt index 1b97c1f34..7a317f30e 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/DgsConstants.kt @@ -3,29 +3,29 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedInterfaces.expe import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Products: String = "products" - } + public const val Products: String = "products" + } - public object PRODUCT { - public const val TYPE_NAME: String = "Product" + public object PRODUCT { + public const val TYPE_NAME: String = "Product" - public const val Id: String = "id" - } + public const val Id: String = "id" + } - public object NODE { - public const val TYPE_NAME: String = "Node" + public object NODE { + public const val TYPE_NAME: String = "Node" - public const val Id: String = "id" - } + public const val Id: String = "id" + } - public object ENTITY { - public const val TYPE_NAME: String = "Entity" + public object ENTITY { + public const val TYPE_NAME: String = "Entity" - public const val Id: String = "id" - } + public const val Id: String = "id" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/client/EntityProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/client/EntityProjection.kt index 411fc4bc2..099639efc 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/client/EntityProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/client/EntityProjection.kt @@ -3,14 +3,14 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedInterfaces.expe import com.netflix.graphql.dgs.codegen.GraphQLProjection public class EntityProjection : GraphQLProjection() { - public val id: EntityProjection - get() { - field("id") - return this - } + public val id: EntityProjection + get() { + field("id") + return this + } - public fun onProduct(_projection: ProductProjection.() -> ProductProjection): EntityProjection { - fragment("Product", ProductProjection(), _projection) - return this - } + public fun onProduct(_projection: ProductProjection.() -> ProductProjection): EntityProjection { + fragment("Product", ProductProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/client/NodeProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/client/NodeProjection.kt index 10f457f6a..4d29945f4 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/client/NodeProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/client/NodeProjection.kt @@ -3,19 +3,19 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedInterfaces.expe import com.netflix.graphql.dgs.codegen.GraphQLProjection public class NodeProjection : GraphQLProjection() { - public val id: NodeProjection - get() { - field("id") - return this - } + public val id: NodeProjection + get() { + field("id") + return this + } - public fun onEntity(_projection: EntityProjection.() -> EntityProjection): NodeProjection { - fragment("Entity", EntityProjection(), _projection) - return this - } + public fun onEntity(_projection: EntityProjection.() -> EntityProjection): NodeProjection { + fragment("Entity", EntityProjection(), _projection) + return this + } - public fun onProduct(_projection: ProductProjection.() -> ProductProjection): NodeProjection { - fragment("Product", ProductProjection(), _projection) - return this - } + public fun onProduct(_projection: ProductProjection.() -> ProductProjection): NodeProjection { + fragment("Product", ProductProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/client/ProductProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/client/ProductProjection.kt index b919450f5..ba5789f69 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/client/ProductProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/client/ProductProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedInterfaces.expe import com.netflix.graphql.dgs.codegen.GraphQLProjection public class ProductProjection : GraphQLProjection() { - public val id: ProductProjection - get() { - field("id") - return this - } + public val id: ProductProjection + get() { + field("id") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/client/QueryProjection.kt index 7749ffa85..15992e5d0 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/client/QueryProjection.kt @@ -3,8 +3,8 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedInterfaces.expe import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun products(_projection: ProductProjection.() -> ProductProjection): QueryProjection { - field("products", ProductProjection(), _projection) - return this - } + public fun products(_projection: ProductProjection.() -> ProductProjection): QueryProjection { + field("products", ProductProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/types/Entity.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/types/Entity.kt index 21395800a..9147b846d 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/types/Entity.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/types/Entity.kt @@ -8,15 +8,17 @@ import kotlin.Suppress import kotlin.jvm.JvmName @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" +) +@JsonSubTypes( + value = [ + JsonSubTypes.Type(value = Product::class, name = "Product") + ] ) -@JsonSubTypes(value = [ - JsonSubTypes.Type(value = Product::class, name = "Product") -]) public sealed interface Entity : Node { - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getId") - override val id: String + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getId") + override val id: String } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/types/Product.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/types/Product.kt index 5c91eead8..5f4fd5bad 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/types/Product.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/types/Product.kt @@ -14,33 +14,31 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Product.Builder::class) public class Product( - id: () -> String = idDefault, + id: () -> String = idDefault ) : Entity, Node { - private val _id: () -> String = id + private val _id: () -> String = id - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getId") - override val id: String - get() = _id.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getId") + override val id: String + get() = _id.invoke() - public companion object { - private val idDefault: () -> String = - { throw IllegalStateException("Field `id` was not requested") } + public companion object { + private val idDefault: () -> String = { throw IllegalStateException("Field `id` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var id: () -> String = idDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var id: () -> String = idDefault + @JsonProperty("id") + public fun withId(id: String): Builder = this.apply { + this.id = { id } + } - @JsonProperty("id") - public fun withId(id: String): Builder = this.apply { - this.id = { id } + public fun build(): Product = Product( + id = id + ) } - - public fun build(): Product = Product( - id = id, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/types/Query.kt index 85dc7937c..7449cab64 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedInterfaces/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - products: () -> List? = productsDefault, + products: () -> List? = productsDefault ) { - private val _products: () -> List? = products + private val _products: () -> List? = products - @get:JvmName("getProducts") - public val products: List? - get() = _products.invoke() + @get:JvmName("getProducts") + public val products: List? + get() = _products.invoke() - public companion object { - private val productsDefault: () -> List? = - { throw IllegalStateException("Field `products` was not requested") } + public companion object { + private val productsDefault: () -> List? = { throw IllegalStateException("Field `products` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var products: () -> List? = productsDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var products: () -> List? = productsDefault + @JsonProperty("products") + public fun withProducts(products: List?): Builder = this.apply { + this.products = { products } + } - @JsonProperty("products") - public fun withProducts(products: List?): Builder = this.apply { - this.products = { products } + public fun build(): Query = Query( + products = products + ) } - - public fun build(): Query = Query( - products = products, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/DgsClient.kt index 4dcdf5bb8..8d6c41176 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/DgsConstants.kt index 54f7d67e2..55b42acf6 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/DgsConstants.kt @@ -3,49 +3,49 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedTypes.expected import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Entity: String = "entity" + public const val Entity: String = "entity" - public const val EntityConnection: String = "entityConnection" - } + public const val EntityConnection: String = "entityConnection" + } - public object ENTITY { - public const val TYPE_NAME: String = "Entity" + public object ENTITY { + public const val TYPE_NAME: String = "Entity" - public const val Long: String = "long" + public const val Long: String = "long" - public const val DateTime: String = "dateTime" - } + public const val DateTime: String = "dateTime" + } - public object ENTITYCONNECTION { - public const val TYPE_NAME: String = "EntityConnection" + public object ENTITYCONNECTION { + public const val TYPE_NAME: String = "EntityConnection" - public const val PageInfo: String = "pageInfo" + public const val PageInfo: String = "pageInfo" - public const val Edges: String = "edges" - } + public const val Edges: String = "edges" + } - public object ENTITYEDGE { - public const val TYPE_NAME: String = "EntityEdge" + public object ENTITYEDGE { + public const val TYPE_NAME: String = "EntityEdge" - public const val Cursor: String = "cursor" + public const val Cursor: String = "cursor" - public const val Node: String = "node" - } + public const val Node: String = "node" + } - public object PAGEINFO { - public const val TYPE_NAME: String = "PageInfo" + public object PAGEINFO { + public const val TYPE_NAME: String = "PageInfo" - public const val StartCursor: String = "startCursor" + public const val StartCursor: String = "startCursor" - public const val EndCursor: String = "endCursor" + public const val EndCursor: String = "endCursor" - public const val HasNextPage: String = "hasNextPage" + public const val HasNextPage: String = "hasNextPage" - public const val HasPreviousPage: String = "hasPreviousPage" - } + public const val HasPreviousPage: String = "hasPreviousPage" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/EntityConnectionProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/EntityConnectionProjection.kt index e48ea36d9..08f5c8706 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/EntityConnectionProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/EntityConnectionProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedTypes.expected. import com.netflix.graphql.dgs.codegen.GraphQLProjection public class EntityConnectionProjection : GraphQLProjection() { - public fun pageInfo(_projection: PageInfoProjection.() -> PageInfoProjection): - EntityConnectionProjection { - field("pageInfo", PageInfoProjection(), _projection) - return this - } + public fun pageInfo(_projection: PageInfoProjection.() -> PageInfoProjection): + EntityConnectionProjection { + field("pageInfo", PageInfoProjection(), _projection) + return this + } - public fun edges(_projection: EntityEdgeProjection.() -> EntityEdgeProjection): - EntityConnectionProjection { - field("edges", EntityEdgeProjection(), _projection) - return this - } + public fun edges(_projection: EntityEdgeProjection.() -> EntityEdgeProjection): + EntityConnectionProjection { + field("edges", EntityEdgeProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/EntityEdgeProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/EntityEdgeProjection.kt index 897cb9c22..10a84ecca 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/EntityEdgeProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/EntityEdgeProjection.kt @@ -3,14 +3,14 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedTypes.expected. import com.netflix.graphql.dgs.codegen.GraphQLProjection public class EntityEdgeProjection : GraphQLProjection() { - public val cursor: EntityEdgeProjection - get() { - field("cursor") - return this - } + public val cursor: EntityEdgeProjection + get() { + field("cursor") + return this + } - public fun node(_projection: EntityProjection.() -> EntityProjection): EntityEdgeProjection { - field("node", EntityProjection(), _projection) - return this - } + public fun node(_projection: EntityProjection.() -> EntityProjection): EntityEdgeProjection { + field("node", EntityProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/EntityProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/EntityProjection.kt index 70625f94d..696a740ac 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/EntityProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/EntityProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedTypes.expected. import com.netflix.graphql.dgs.codegen.GraphQLProjection public class EntityProjection : GraphQLProjection() { - public val long: EntityProjection - get() { - field("long") - return this - } + public val long: EntityProjection + get() { + field("long") + return this + } - public val dateTime: EntityProjection - get() { - field("dateTime") - return this - } + public val dateTime: EntityProjection + get() { + field("dateTime") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/PageInfoProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/PageInfoProjection.kt index 089001f36..90e838a72 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/PageInfoProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/PageInfoProjection.kt @@ -3,27 +3,27 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedTypes.expected. import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PageInfoProjection : GraphQLProjection() { - public val startCursor: PageInfoProjection - get() { - field("startCursor") - return this - } + public val startCursor: PageInfoProjection + get() { + field("startCursor") + return this + } - public val endCursor: PageInfoProjection - get() { - field("endCursor") - return this - } + public val endCursor: PageInfoProjection + get() { + field("endCursor") + return this + } - public val hasNextPage: PageInfoProjection - get() { - field("hasNextPage") - return this - } + public val hasNextPage: PageInfoProjection + get() { + field("hasNextPage") + return this + } - public val hasPreviousPage: PageInfoProjection - get() { - field("hasPreviousPage") - return this - } + public val hasPreviousPage: PageInfoProjection + get() { + field("hasPreviousPage") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/QueryProjection.kt index a83aff410..79fed8441 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/client/QueryProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedTypes.expected. import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun entity(_projection: EntityProjection.() -> EntityProjection): QueryProjection { - field("entity", EntityProjection(), _projection) - return this - } + public fun entity(_projection: EntityProjection.() -> EntityProjection): QueryProjection { + field("entity", EntityProjection(), _projection) + return this + } - public - fun entityConnection(_projection: EntityConnectionProjection.() -> EntityConnectionProjection): - QueryProjection { - field("entityConnection", EntityConnectionProjection(), _projection) - return this - } + public + fun entityConnection(_projection: EntityConnectionProjection.() -> EntityConnectionProjection): + QueryProjection { + field("entityConnection", EntityConnectionProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/types/Entity.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/types/Entity.kt index 5e6bb926c..ffc11263d 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/types/Entity.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/types/Entity.kt @@ -13,51 +13,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Entity.Builder::class) public class Entity( - long: () -> Long? = longDefault, - dateTime: () -> OffsetDateTime? = dateTimeDefault, + long: () -> Long? = longDefault, + dateTime: () -> OffsetDateTime? = dateTimeDefault ) { - private val _long: () -> Long? = long + private val _long: () -> Long? = long - private val _dateTime: () -> OffsetDateTime? = dateTime + private val _dateTime: () -> OffsetDateTime? = dateTime - @get:JvmName("getLong") - public val long: Long? - get() = _long.invoke() + @get:JvmName("getLong") + public val long: Long? + get() = _long.invoke() - @get:JvmName("getDateTime") - public val dateTime: OffsetDateTime? - get() = _dateTime.invoke() + @get:JvmName("getDateTime") + public val dateTime: OffsetDateTime? + get() = _dateTime.invoke() - public companion object { - private val longDefault: () -> Long? = - { throw IllegalStateException("Field `long` was not requested") } + public companion object { + private val longDefault: () -> Long? = { throw IllegalStateException("Field `long` was not requested") } + private val dateTimeDefault: () -> OffsetDateTime? = { throw IllegalStateException("Field `dateTime` was not requested") } + } - private val dateTimeDefault: () -> OffsetDateTime? = - { throw IllegalStateException("Field `dateTime` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var long: () -> Long? = longDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var long: () -> Long? = longDefault + private var dateTime: () -> OffsetDateTime? = dateTimeDefault - private var dateTime: () -> OffsetDateTime? = dateTimeDefault + @JsonProperty("long") + public fun withLong(long: Long?): Builder = this.apply { + this.long = { long } + } - @JsonProperty("long") - public fun withLong(long: Long?): Builder = this.apply { - this.long = { long } - } + @JsonProperty("dateTime") + public fun withDateTime(dateTime: OffsetDateTime?): Builder = this.apply { + this.dateTime = { dateTime } + } - @JsonProperty("dateTime") - public fun withDateTime(dateTime: OffsetDateTime?): Builder = this.apply { - this.dateTime = { dateTime } + public fun build(): Entity = Entity( + long = long, + dateTime = dateTime + ) } - - public fun build(): Entity = Entity( - long = long, - dateTime = dateTime, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/types/EntityEdge.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/types/EntityEdge.kt index f15a0df86..41c2cf4fa 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/types/EntityEdge.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/types/EntityEdge.kt @@ -12,51 +12,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = EntityEdge.Builder::class) public class EntityEdge( - cursor: () -> String = cursorDefault, - node: () -> Entity? = nodeDefault, + cursor: () -> String = cursorDefault, + node: () -> Entity? = nodeDefault ) { - private val _cursor: () -> String = cursor + private val _cursor: () -> String = cursor - private val _node: () -> Entity? = node + private val _node: () -> Entity? = node - @get:JvmName("getCursor") - public val cursor: String - get() = _cursor.invoke() + @get:JvmName("getCursor") + public val cursor: String + get() = _cursor.invoke() - @get:JvmName("getNode") - public val node: Entity? - get() = _node.invoke() + @get:JvmName("getNode") + public val node: Entity? + get() = _node.invoke() - public companion object { - private val cursorDefault: () -> String = - { throw IllegalStateException("Field `cursor` was not requested") } + public companion object { + private val cursorDefault: () -> String = { throw IllegalStateException("Field `cursor` was not requested") } + private val nodeDefault: () -> Entity? = { throw IllegalStateException("Field `node` was not requested") } + } - private val nodeDefault: () -> Entity? = - { throw IllegalStateException("Field `node` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var cursor: () -> String = cursorDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var cursor: () -> String = cursorDefault + private var node: () -> Entity? = nodeDefault - private var node: () -> Entity? = nodeDefault + @JsonProperty("cursor") + public fun withCursor(cursor: String): Builder = this.apply { + this.cursor = { cursor } + } - @JsonProperty("cursor") - public fun withCursor(cursor: String): Builder = this.apply { - this.cursor = { cursor } - } + @JsonProperty("node") + public fun withNode(node: Entity?): Builder = this.apply { + this.node = { node } + } - @JsonProperty("node") - public fun withNode(node: Entity?): Builder = this.apply { - this.node = { node } + public fun build(): EntityEdge = EntityEdge( + cursor = cursor, + node = node + ) } - - public fun build(): EntityEdge = EntityEdge( - cursor = cursor, - node = node, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/types/Query.kt index 09c9e59db..579393759 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithMappedTypes/expected/types/Query.kt @@ -13,52 +13,48 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - entity: () -> List? = entityDefault, - entityConnection: () -> SimpleListConnection? = entityConnectionDefault, + entity: () -> List? = entityDefault, + entityConnection: () -> SimpleListConnection? = entityConnectionDefault ) { - private val _entity: () -> List? = entity + private val _entity: () -> List? = entity - private val _entityConnection: () -> SimpleListConnection? = entityConnection + private val _entityConnection: () -> SimpleListConnection? = entityConnection - @get:JvmName("getEntity") - public val entity: List? - get() = _entity.invoke() + @get:JvmName("getEntity") + public val entity: List? + get() = _entity.invoke() - @get:JvmName("getEntityConnection") - public val entityConnection: SimpleListConnection? - get() = _entityConnection.invoke() + @get:JvmName("getEntityConnection") + public val entityConnection: SimpleListConnection? + get() = _entityConnection.invoke() - public companion object { - private val entityDefault: () -> List? = - { throw IllegalStateException("Field `entity` was not requested") } + public companion object { + private val entityDefault: () -> List? = { throw IllegalStateException("Field `entity` was not requested") } + private val entityConnectionDefault: () -> SimpleListConnection? = { throw IllegalStateException("Field `entityConnection` was not requested") } + } - private val entityConnectionDefault: () -> SimpleListConnection? = - { throw IllegalStateException("Field `entityConnection` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var entity: () -> List? = entityDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var entity: () -> List? = entityDefault + private var entityConnection: () -> SimpleListConnection? = entityConnectionDefault - private var entityConnection: () -> SimpleListConnection? = entityConnectionDefault + @JsonProperty("entity") + public fun withEntity(entity: List?): Builder = this.apply { + this.entity = { entity } + } - @JsonProperty("entity") - public fun withEntity(entity: List?): Builder = this.apply { - this.entity = { entity } - } + @JsonProperty("entityConnection") + public fun withEntityConnection(entityConnection: SimpleListConnection?): Builder = + this.apply { + this.entityConnection = { entityConnection } + } - @JsonProperty("entityConnection") - public fun withEntityConnection(entityConnection: SimpleListConnection?): Builder = - this.apply { - this.entityConnection = { entityConnection } + public fun build(): Query = Query( + entity = entity, + entityConnection = entityConnection + ) } - - public fun build(): Query = Query( - entity = entity, - entityConnection = entityConnection, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/DgsClient.kt index facb4fd65..06082a85d 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/DgsConstants.kt index 0a68713f2..1365a584e 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/DgsConstants.kt @@ -3,31 +3,31 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableAndInterfa import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val People: String = "people" - } + public const val People: String = "people" + } - public object EMPLOYEE { - public const val TYPE_NAME: String = "Employee" + public object EMPLOYEE { + public const val TYPE_NAME: String = "Employee" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Lastname: String = "lastname" + public const val Lastname: String = "lastname" - public const val Company: String = "company" - } + public const val Company: String = "company" + } - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Lastname: String = "lastname" + public const val Lastname: String = "lastname" - public const val Company: String = "company" - } + public const val Company: String = "company" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/client/EmployeeProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/client/EmployeeProjection.kt index b7f57caa9..cdbf09346 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/client/EmployeeProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/client/EmployeeProjection.kt @@ -3,21 +3,21 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableAndInterfa import com.netflix.graphql.dgs.codegen.GraphQLProjection public class EmployeeProjection : GraphQLProjection() { - public val firstname: EmployeeProjection - get() { - field("firstname") - return this - } + public val firstname: EmployeeProjection + get() { + field("firstname") + return this + } - public val lastname: EmployeeProjection - get() { - field("lastname") - return this - } + public val lastname: EmployeeProjection + get() { + field("lastname") + return this + } - public val company: EmployeeProjection - get() { - field("company") - return this - } + public val company: EmployeeProjection + get() { + field("company") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/client/PersonProjection.kt index 71eb76005..85e62a7bf 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/client/PersonProjection.kt @@ -3,27 +3,27 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableAndInterfa import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val firstname: PersonProjection - get() { - field("firstname") - return this - } + public val firstname: PersonProjection + get() { + field("firstname") + return this + } - public val lastname: PersonProjection - get() { - field("lastname") - return this - } + public val lastname: PersonProjection + get() { + field("lastname") + return this + } - public val company: PersonProjection - get() { - field("company") - return this - } + public val company: PersonProjection + get() { + field("company") + return this + } - public fun onEmployee(_projection: EmployeeProjection.() -> EmployeeProjection): - PersonProjection { - fragment("Employee", EmployeeProjection(), _projection) - return this - } + public fun onEmployee(_projection: EmployeeProjection.() -> EmployeeProjection): + PersonProjection { + fragment("Employee", EmployeeProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/client/QueryProjection.kt index aeae84bab..a71216090 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/client/QueryProjection.kt @@ -3,8 +3,8 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableAndInterfa import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("people", PersonProjection(), _projection) - return this - } + public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { + field("people", PersonProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/types/Employee.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/types/Employee.kt index 99670238a..a51df40f3 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/types/Employee.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/types/Employee.kt @@ -13,73 +13,67 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Employee.Builder::class) public class Employee( - firstname: () -> String = firstnameDefault, - lastname: () -> String = lastnameDefault, - company: () -> String? = companyDefault, + firstname: () -> String = firstnameDefault, + lastname: () -> String = lastnameDefault, + company: () -> String? = companyDefault ) : Person { - private val _firstname: () -> String = firstname + private val _firstname: () -> String = firstname - private val _lastname: () -> String = lastname + private val _lastname: () -> String = lastname - private val _company: () -> String? = company + private val _company: () -> String? = company - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFirstname") - override val firstname: String - get() = _firstname.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFirstname") + override val firstname: String + get() = _firstname.invoke() - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getLastname") - override val lastname: String - get() = _lastname.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getLastname") + override val lastname: String + get() = _lastname.invoke() - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getCompany") - override val company: String? - get() = _company.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getCompany") + override val company: String? + get() = _company.invoke() - public companion object { - private val firstnameDefault: () -> String = - { throw IllegalStateException("Field `firstname` was not requested") } + public companion object { + private val firstnameDefault: () -> String = { throw IllegalStateException("Field `firstname` was not requested") } + private val lastnameDefault: () -> String = { throw IllegalStateException("Field `lastname` was not requested") } - private val lastnameDefault: () -> String = - { throw IllegalStateException("Field `lastname` was not requested") } - - - private val companyDefault: () -> String? = - { throw IllegalStateException("Field `company` was not requested") } + private val companyDefault: () -> String? = { throw IllegalStateException("Field `company` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var firstname: () -> String = firstnameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var firstname: () -> String = firstnameDefault + private var lastname: () -> String = lastnameDefault - private var lastname: () -> String = lastnameDefault + private var company: () -> String? = companyDefault - private var company: () -> String? = companyDefault + @JsonProperty("firstname") + public fun withFirstname(firstname: String): Builder = this.apply { + this.firstname = { firstname } + } - @JsonProperty("firstname") - public fun withFirstname(firstname: String): Builder = this.apply { - this.firstname = { firstname } - } + @JsonProperty("lastname") + public fun withLastname(lastname: String): Builder = this.apply { + this.lastname = { lastname } + } - @JsonProperty("lastname") - public fun withLastname(lastname: String): Builder = this.apply { - this.lastname = { lastname } - } + @JsonProperty("company") + public fun withCompany(company: String?): Builder = this.apply { + this.company = { company } + } - @JsonProperty("company") - public fun withCompany(company: String?): Builder = this.apply { - this.company = { company } + public fun build(): Employee = Employee( + firstname = firstname, + lastname = lastname, + company = company + ) } - - public fun build(): Employee = Employee( - firstname = firstname, - lastname = lastname, - company = company, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/types/Person.kt index 20902a8b7..e35d92c5a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/types/Person.kt @@ -7,23 +7,25 @@ import kotlin.Suppress import kotlin.jvm.JvmName @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" +) +@JsonSubTypes( + value = [ + JsonSubTypes.Type(value = Employee::class, name = "Employee") + ] ) -@JsonSubTypes(value = [ - JsonSubTypes.Type(value = Employee::class, name = "Employee") -]) public sealed interface Person { - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFirstname") - public val firstname: String + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFirstname") + public val firstname: String - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getLastname") - public val lastname: String + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getLastname") + public val lastname: String - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getCompany") - public val company: String? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getCompany") + public val company: String? } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/types/Query.kt index bfe86af37..e46499064 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableAndInterface/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - people: () -> List? = peopleDefault, + people: () -> List? = peopleDefault ) { - private val _people: () -> List? = people + private val _people: () -> List? = people - @get:JvmName("getPeople") - public val people: List? - get() = _people.invoke() + @get:JvmName("getPeople") + public val people: List? + get() = _people.invoke() - public companion object { - private val peopleDefault: () -> List? = - { throw IllegalStateException("Field `people` was not requested") } + public companion object { + private val peopleDefault: () -> List? = { throw IllegalStateException("Field `people` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var people: () -> List? = peopleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var people: () -> List? = peopleDefault + @JsonProperty("people") + public fun withPeople(people: List?): Builder = this.apply { + this.people = { people } + } - @JsonProperty("people") - public fun withPeople(people: List?): Builder = this.apply { - this.people = { people } + public fun build(): Query = Query( + people = people + ) } - - public fun build(): Query = Query( - people = people, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/DgsConstants.kt index bef5ce142..4ed07d593 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/DgsConstants.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableComplexTyp import kotlin.String public object DgsConstants { - public object MYTYPE { - public const val TYPE_NAME: String = "MyType" + public object MYTYPE { + public const val TYPE_NAME: String = "MyType" - public const val Other: String = "other" - } + public const val Other: String = "other" + } - public object OTHERTYPE { - public const val TYPE_NAME: String = "OtherType" + public object OTHERTYPE { + public const val TYPE_NAME: String = "OtherType" - public const val Name: String = "name" - } + public const val Name: String = "name" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/client/MyTypeProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/client/MyTypeProjection.kt index 7bd55c787..3f7f618c9 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/client/MyTypeProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/client/MyTypeProjection.kt @@ -3,8 +3,8 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableComplexTyp import com.netflix.graphql.dgs.codegen.GraphQLProjection public class MyTypeProjection : GraphQLProjection() { - public fun other(_projection: OtherTypeProjection.() -> OtherTypeProjection): MyTypeProjection { - field("other", OtherTypeProjection(), _projection) - return this - } + public fun other(_projection: OtherTypeProjection.() -> OtherTypeProjection): MyTypeProjection { + field("other", OtherTypeProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/client/OtherTypeProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/client/OtherTypeProjection.kt index 0ae4567bd..c33141da3 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/client/OtherTypeProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/client/OtherTypeProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableComplexTyp import com.netflix.graphql.dgs.codegen.GraphQLProjection public class OtherTypeProjection : GraphQLProjection() { - public val name: OtherTypeProjection - get() { - field("name") - return this - } + public val name: OtherTypeProjection + get() { + field("name") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/types/MyType.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/types/MyType.kt index 255edab51..7670c73fd 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/types/MyType.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/types/MyType.kt @@ -11,32 +11,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = MyType.Builder::class) public class MyType( - other: () -> OtherType = otherDefault, + other: () -> OtherType = otherDefault ) { - private val _other: () -> OtherType = other + private val _other: () -> OtherType = other - @get:JvmName("getOther") - public val other: OtherType - get() = _other.invoke() + @get:JvmName("getOther") + public val other: OtherType + get() = _other.invoke() - public companion object { - private val otherDefault: () -> OtherType = - { throw IllegalStateException("Field `other` was not requested") } + public companion object { + private val otherDefault: () -> OtherType = { throw IllegalStateException("Field `other` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var other: () -> OtherType = otherDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var other: () -> OtherType = otherDefault + @JsonProperty("other") + public fun withOther(other: OtherType): Builder = this.apply { + this.other = { other } + } - @JsonProperty("other") - public fun withOther(other: OtherType): Builder = this.apply { - this.other = { other } + public fun build(): MyType = MyType( + other = other + ) } - - public fun build(): MyType = MyType( - other = other, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/types/OtherType.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/types/OtherType.kt index 1684514cb..b07f45a8d 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/types/OtherType.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableComplexType/expected/types/OtherType.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = OtherType.Builder::class) public class OtherType( - name: () -> String = nameDefault, + name: () -> String = nameDefault ) { - private val _name: () -> String = name + private val _name: () -> String = name - @get:JvmName("getName") - public val name: String - get() = _name.invoke() + @get:JvmName("getName") + public val name: String + get() = _name.invoke() - public companion object { - private val nameDefault: () -> String = - { throw IllegalStateException("Field `name` was not requested") } + public companion object { + private val nameDefault: () -> String = { throw IllegalStateException("Field `name` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var name: () -> String = nameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var name: () -> String = nameDefault + @JsonProperty("name") + public fun withName(name: String): Builder = this.apply { + this.name = { name } + } - @JsonProperty("name") - public fun withName(name: String): Builder = this.apply { - this.name = { name } + public fun build(): OtherType = OtherType( + name = name + ) } - - public fun build(): OtherType = OtherType( - name = name, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/DgsClient.kt index 39bd2401b..59fdd3dd5 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/DgsConstants.kt index 41a5c3e4b..fe845bb9a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/DgsConstants.kt @@ -3,19 +3,19 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableListOfNull import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val People: String = "people" - } + public const val People: String = "people" + } - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Name: String = "name" + public const val Name: String = "name" - public const val Email: String = "email" - } + public const val Email: String = "email" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/client/PersonProjection.kt index 58cb124a7..a92f976e3 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/client/PersonProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableListOfNull import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val name: PersonProjection - get() { - field("name") - return this - } + public val name: PersonProjection + get() { + field("name") + return this + } - public val email: PersonProjection - get() { - field("email") - return this - } + public val email: PersonProjection + get() { + field("email") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/client/QueryProjection.kt index 80cf787d2..7a8387244 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/client/QueryProjection.kt @@ -3,8 +3,8 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableListOfNull import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("people", PersonProjection(), _projection) - return this - } + public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { + field("people", PersonProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/types/Person.kt index 0e0b9adf9..211cf3031 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/types/Person.kt @@ -13,51 +13,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Person.Builder::class) public class Person( - name: () -> String = nameDefault, - email: () -> List = emailDefault, + name: () -> String = nameDefault, + email: () -> List = emailDefault ) { - private val _name: () -> String = name + private val _name: () -> String = name - private val _email: () -> List = email + private val _email: () -> List = email - @get:JvmName("getName") - public val name: String - get() = _name.invoke() + @get:JvmName("getName") + public val name: String + get() = _name.invoke() - @get:JvmName("getEmail") - public val email: List - get() = _email.invoke() + @get:JvmName("getEmail") + public val email: List + get() = _email.invoke() - public companion object { - private val nameDefault: () -> String = - { throw IllegalStateException("Field `name` was not requested") } + public companion object { + private val nameDefault: () -> String = { throw IllegalStateException("Field `name` was not requested") } + private val emailDefault: () -> List = { throw IllegalStateException("Field `email` was not requested") } + } - private val emailDefault: () -> List = - { throw IllegalStateException("Field `email` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var name: () -> String = nameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var name: () -> String = nameDefault + private var email: () -> List = emailDefault - private var email: () -> List = emailDefault + @JsonProperty("name") + public fun withName(name: String): Builder = this.apply { + this.name = { name } + } - @JsonProperty("name") - public fun withName(name: String): Builder = this.apply { - this.name = { name } - } + @JsonProperty("email") + public fun withEmail(email: List): Builder = this.apply { + this.email = { email } + } - @JsonProperty("email") - public fun withEmail(email: List): Builder = this.apply { - this.email = { email } + public fun build(): Person = Person( + name = name, + email = email + ) } - - public fun build(): Person = Person( - name = name, - email = email, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/types/Query.kt index 5cc99d579..87279f1a1 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableListOfNullableValues/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - people: () -> List? = peopleDefault, + people: () -> List? = peopleDefault ) { - private val _people: () -> List? = people + private val _people: () -> List? = people - @get:JvmName("getPeople") - public val people: List? - get() = _people.invoke() + @get:JvmName("getPeople") + public val people: List? + get() = _people.invoke() - public companion object { - private val peopleDefault: () -> List? = - { throw IllegalStateException("Field `people` was not requested") } + public companion object { + private val peopleDefault: () -> List? = { throw IllegalStateException("Field `people` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var people: () -> List? = peopleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var people: () -> List? = peopleDefault + @JsonProperty("people") + public fun withPeople(people: List?): Builder = this.apply { + this.people = { people } + } - @JsonProperty("people") - public fun withPeople(people: List?): Builder = this.apply { - this.people = { people } + public fun build(): Query = Query( + people = people + ) } - - public fun build(): Query = Query( - people = people, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitive/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitive/expected/DgsConstants.kt index a17b7e5b4..7dda685bd 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitive/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitive/expected/DgsConstants.kt @@ -3,13 +3,13 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullablePrimitive. import kotlin.String public object DgsConstants { - public object MYTYPE { - public const val TYPE_NAME: String = "MyType" + public object MYTYPE { + public const val TYPE_NAME: String = "MyType" - public const val Count: String = "count" + public const val Count: String = "count" - public const val Truth: String = "truth" + public const val Truth: String = "truth" - public const val Floaty: String = "floaty" - } + public const val Floaty: String = "floaty" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitive/expected/client/MyTypeProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitive/expected/client/MyTypeProjection.kt index 7be322dc6..9a62bd00a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitive/expected/client/MyTypeProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitive/expected/client/MyTypeProjection.kt @@ -3,21 +3,21 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullablePrimitive. import com.netflix.graphql.dgs.codegen.GraphQLProjection public class MyTypeProjection : GraphQLProjection() { - public val count: MyTypeProjection - get() { - field("count") - return this - } + public val count: MyTypeProjection + get() { + field("count") + return this + } - public val truth: MyTypeProjection - get() { - field("truth") - return this - } + public val truth: MyTypeProjection + get() { + field("truth") + return this + } - public val floaty: MyTypeProjection - get() { - field("floaty") - return this - } + public val floaty: MyTypeProjection + get() { + field("floaty") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitive/expected/types/MyType.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitive/expected/types/MyType.kt index a6d7a0ba8..63601824f 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitive/expected/types/MyType.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitive/expected/types/MyType.kt @@ -14,70 +14,64 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = MyType.Builder::class) public class MyType( - count: () -> Int = countDefault, - truth: () -> Boolean = truthDefault, - floaty: () -> Double = floatyDefault, + count: () -> Int = countDefault, + truth: () -> Boolean = truthDefault, + floaty: () -> Double = floatyDefault ) { - private val _count: () -> Int = count + private val _count: () -> Int = count - private val _truth: () -> Boolean = truth + private val _truth: () -> Boolean = truth - private val _floaty: () -> Double = floaty + private val _floaty: () -> Double = floaty - @get:JvmName("getCount") - public val count: Int - get() = _count.invoke() + @get:JvmName("getCount") + public val count: Int + get() = _count.invoke() - @get:JvmName("getTruth") - public val truth: Boolean - get() = _truth.invoke() + @get:JvmName("getTruth") + public val truth: Boolean + get() = _truth.invoke() - @get:JvmName("getFloaty") - public val floaty: Double - get() = _floaty.invoke() + @get:JvmName("getFloaty") + public val floaty: Double + get() = _floaty.invoke() - public companion object { - private val countDefault: () -> Int = - { throw IllegalStateException("Field `count` was not requested") } + public companion object { + private val countDefault: () -> Int = { throw IllegalStateException("Field `count` was not requested") } + private val truthDefault: () -> Boolean = { throw IllegalStateException("Field `truth` was not requested") } - private val truthDefault: () -> Boolean = - { throw IllegalStateException("Field `truth` was not requested") } - - - private val floatyDefault: () -> Double = - { throw IllegalStateException("Field `floaty` was not requested") } + private val floatyDefault: () -> Double = { throw IllegalStateException("Field `floaty` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var count: () -> Int = countDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var count: () -> Int = countDefault + private var truth: () -> Boolean = truthDefault - private var truth: () -> Boolean = truthDefault + private var floaty: () -> Double = floatyDefault - private var floaty: () -> Double = floatyDefault + @JsonProperty("count") + public fun withCount(count: Int): Builder = this.apply { + this.count = { count } + } - @JsonProperty("count") - public fun withCount(count: Int): Builder = this.apply { - this.count = { count } - } + @JsonProperty("truth") + public fun withTruth(truth: Boolean): Builder = this.apply { + this.truth = { truth } + } - @JsonProperty("truth") - public fun withTruth(truth: Boolean): Builder = this.apply { - this.truth = { truth } - } + @JsonProperty("floaty") + public fun withFloaty(floaty: Double): Builder = this.apply { + this.floaty = { floaty } + } - @JsonProperty("floaty") - public fun withFloaty(floaty: Double): Builder = this.apply { - this.floaty = { floaty } + public fun build(): MyType = MyType( + count = count, + truth = truth, + floaty = floaty + ) } - - public fun build(): MyType = MyType( - count = count, - truth = truth, - floaty = floaty, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitiveInList/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitiveInList/expected/DgsConstants.kt index 2e069615e..09f2300ee 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitiveInList/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitiveInList/expected/DgsConstants.kt @@ -3,13 +3,13 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullablePrimitiveI import kotlin.String public object DgsConstants { - public object MYTYPE { - public const val TYPE_NAME: String = "MyType" + public object MYTYPE { + public const val TYPE_NAME: String = "MyType" - public const val Count: String = "count" + public const val Count: String = "count" - public const val Truth: String = "truth" + public const val Truth: String = "truth" - public const val Floaty: String = "floaty" - } + public const val Floaty: String = "floaty" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitiveInList/expected/client/MyTypeProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitiveInList/expected/client/MyTypeProjection.kt index 4a905ed79..a0413dc14 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitiveInList/expected/client/MyTypeProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitiveInList/expected/client/MyTypeProjection.kt @@ -3,21 +3,21 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullablePrimitiveI import com.netflix.graphql.dgs.codegen.GraphQLProjection public class MyTypeProjection : GraphQLProjection() { - public val count: MyTypeProjection - get() { - field("count") - return this - } + public val count: MyTypeProjection + get() { + field("count") + return this + } - public val truth: MyTypeProjection - get() { - field("truth") - return this - } + public val truth: MyTypeProjection + get() { + field("truth") + return this + } - public val floaty: MyTypeProjection - get() { - field("floaty") - return this - } + public val floaty: MyTypeProjection + get() { + field("floaty") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitiveInList/expected/types/MyType.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitiveInList/expected/types/MyType.kt index f51738fdb..25283f631 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitiveInList/expected/types/MyType.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullablePrimitiveInList/expected/types/MyType.kt @@ -15,70 +15,64 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = MyType.Builder::class) public class MyType( - count: () -> List? = countDefault, - truth: () -> List? = truthDefault, - floaty: () -> List? = floatyDefault, + count: () -> List? = countDefault, + truth: () -> List? = truthDefault, + floaty: () -> List? = floatyDefault ) { - private val _count: () -> List? = count + private val _count: () -> List? = count - private val _truth: () -> List? = truth + private val _truth: () -> List? = truth - private val _floaty: () -> List? = floaty + private val _floaty: () -> List? = floaty - @get:JvmName("getCount") - public val count: List? - get() = _count.invoke() + @get:JvmName("getCount") + public val count: List? + get() = _count.invoke() - @get:JvmName("getTruth") - public val truth: List? - get() = _truth.invoke() + @get:JvmName("getTruth") + public val truth: List? + get() = _truth.invoke() - @get:JvmName("getFloaty") - public val floaty: List? - get() = _floaty.invoke() + @get:JvmName("getFloaty") + public val floaty: List? + get() = _floaty.invoke() - public companion object { - private val countDefault: () -> List? = - { throw IllegalStateException("Field `count` was not requested") } + public companion object { + private val countDefault: () -> List? = { throw IllegalStateException("Field `count` was not requested") } + private val truthDefault: () -> List? = { throw IllegalStateException("Field `truth` was not requested") } - private val truthDefault: () -> List? = - { throw IllegalStateException("Field `truth` was not requested") } - - - private val floatyDefault: () -> List? = - { throw IllegalStateException("Field `floaty` was not requested") } + private val floatyDefault: () -> List? = { throw IllegalStateException("Field `floaty` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var count: () -> List? = countDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var count: () -> List? = countDefault + private var truth: () -> List? = truthDefault - private var truth: () -> List? = truthDefault + private var floaty: () -> List? = floatyDefault - private var floaty: () -> List? = floatyDefault + @JsonProperty("count") + public fun withCount(count: List?): Builder = this.apply { + this.count = { count } + } - @JsonProperty("count") - public fun withCount(count: List?): Builder = this.apply { - this.count = { count } - } + @JsonProperty("truth") + public fun withTruth(truth: List?): Builder = this.apply { + this.truth = { truth } + } - @JsonProperty("truth") - public fun withTruth(truth: List?): Builder = this.apply { - this.truth = { truth } - } + @JsonProperty("floaty") + public fun withFloaty(floaty: List?): Builder = this.apply { + this.floaty = { floaty } + } - @JsonProperty("floaty") - public fun withFloaty(floaty: List?): Builder = this.apply { - this.floaty = { floaty } + public fun build(): MyType = MyType( + count = count, + truth = truth, + floaty = floaty + ) } - - public fun build(): MyType = MyType( - count = count, - truth = truth, - floaty = floaty, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/DgsClient.kt index 6566a9dc5..6d586bbce 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/DgsConstants.kt index 0f46156c4..5373cc8fd 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/DgsConstants.kt @@ -3,19 +3,19 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableProperties import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val People: String = "people" - } + public const val People: String = "people" + } - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Name: String = "name" + public const val Name: String = "name" - public const val Email: String = "email" - } + public const val Email: String = "email" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/client/PersonProjection.kt index a226b74e8..64695ebe8 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/client/PersonProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableProperties import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val name: PersonProjection - get() { - field("name") - return this - } + public val name: PersonProjection + get() { + field("name") + return this + } - public val email: PersonProjection - get() { - field("email") - return this - } + public val email: PersonProjection + get() { + field("email") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/client/QueryProjection.kt index b1ddf513c..01ad7679a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/client/QueryProjection.kt @@ -3,8 +3,8 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableProperties import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("people", PersonProjection(), _projection) - return this - } + public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { + field("people", PersonProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/types/Person.kt index 2b91cee5b..f85048316 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/types/Person.kt @@ -13,51 +13,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Person.Builder::class) public class Person( - name: () -> String = nameDefault, - email: () -> List = emailDefault, + name: () -> String = nameDefault, + email: () -> List = emailDefault ) { - private val _name: () -> String = name + private val _name: () -> String = name - private val _email: () -> List = email + private val _email: () -> List = email - @get:JvmName("getName") - public val name: String - get() = _name.invoke() + @get:JvmName("getName") + public val name: String + get() = _name.invoke() - @get:JvmName("getEmail") - public val email: List - get() = _email.invoke() + @get:JvmName("getEmail") + public val email: List + get() = _email.invoke() - public companion object { - private val nameDefault: () -> String = - { throw IllegalStateException("Field `name` was not requested") } + public companion object { + private val nameDefault: () -> String = { throw IllegalStateException("Field `name` was not requested") } + private val emailDefault: () -> List = { throw IllegalStateException("Field `email` was not requested") } + } - private val emailDefault: () -> List = - { throw IllegalStateException("Field `email` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var name: () -> String = nameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var name: () -> String = nameDefault + private var email: () -> List = emailDefault - private var email: () -> List = emailDefault + @JsonProperty("name") + public fun withName(name: String): Builder = this.apply { + this.name = { name } + } - @JsonProperty("name") - public fun withName(name: String): Builder = this.apply { - this.name = { name } - } + @JsonProperty("email") + public fun withEmail(email: List): Builder = this.apply { + this.email = { email } + } - @JsonProperty("email") - public fun withEmail(email: List): Builder = this.apply { - this.email = { email } + public fun build(): Person = Person( + name = name, + email = email + ) } - - public fun build(): Person = Person( - name = name, - email = email, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/types/Query.kt index 483375ba2..125512027 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNonNullableProperties/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - people: () -> List? = peopleDefault, + people: () -> List? = peopleDefault ) { - private val _people: () -> List? = people + private val _people: () -> List? = people - @get:JvmName("getPeople") - public val people: List? - get() = _people.invoke() + @get:JvmName("getPeople") + public val people: List? + get() = _people.invoke() - public companion object { - private val peopleDefault: () -> List? = - { throw IllegalStateException("Field `people` was not requested") } + public companion object { + private val peopleDefault: () -> List? = { throw IllegalStateException("Field `people` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var people: () -> List? = peopleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var people: () -> List? = peopleDefault + @JsonProperty("people") + public fun withPeople(people: List?): Builder = this.apply { + this.people = { people } + } - @JsonProperty("people") - public fun withPeople(people: List?): Builder = this.apply { - this.people = { people } + public fun build(): Query = Query( + people = people + ) } - - public fun build(): Query = Query( - people = people, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNullablePrimitive/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNullablePrimitive/expected/DgsConstants.kt index a84490f00..23a319d87 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNullablePrimitive/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNullablePrimitive/expected/DgsConstants.kt @@ -3,13 +3,13 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNullablePrimitive.exp import kotlin.String public object DgsConstants { - public object MYTYPE { - public const val TYPE_NAME: String = "MyType" + public object MYTYPE { + public const val TYPE_NAME: String = "MyType" - public const val Count: String = "count" + public const val Count: String = "count" - public const val Truth: String = "truth" + public const val Truth: String = "truth" - public const val Floaty: String = "floaty" - } + public const val Floaty: String = "floaty" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNullablePrimitive/expected/client/MyTypeProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNullablePrimitive/expected/client/MyTypeProjection.kt index f7b27d52c..599ba813d 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNullablePrimitive/expected/client/MyTypeProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNullablePrimitive/expected/client/MyTypeProjection.kt @@ -3,21 +3,21 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithNullablePrimitive.exp import com.netflix.graphql.dgs.codegen.GraphQLProjection public class MyTypeProjection : GraphQLProjection() { - public val count: MyTypeProjection - get() { - field("count") - return this - } + public val count: MyTypeProjection + get() { + field("count") + return this + } - public val truth: MyTypeProjection - get() { - field("truth") - return this - } + public val truth: MyTypeProjection + get() { + field("truth") + return this + } - public val floaty: MyTypeProjection - get() { - field("floaty") - return this - } + public val floaty: MyTypeProjection + get() { + field("floaty") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNullablePrimitive/expected/types/MyType.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNullablePrimitive/expected/types/MyType.kt index c20e98857..7425a3936 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNullablePrimitive/expected/types/MyType.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithNullablePrimitive/expected/types/MyType.kt @@ -14,70 +14,64 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = MyType.Builder::class) public class MyType( - count: () -> Int? = countDefault, - truth: () -> Boolean? = truthDefault, - floaty: () -> Double? = floatyDefault, + count: () -> Int? = countDefault, + truth: () -> Boolean? = truthDefault, + floaty: () -> Double? = floatyDefault ) { - private val _count: () -> Int? = count + private val _count: () -> Int? = count - private val _truth: () -> Boolean? = truth + private val _truth: () -> Boolean? = truth - private val _floaty: () -> Double? = floaty + private val _floaty: () -> Double? = floaty - @get:JvmName("getCount") - public val count: Int? - get() = _count.invoke() + @get:JvmName("getCount") + public val count: Int? + get() = _count.invoke() - @get:JvmName("getTruth") - public val truth: Boolean? - get() = _truth.invoke() + @get:JvmName("getTruth") + public val truth: Boolean? + get() = _truth.invoke() - @get:JvmName("getFloaty") - public val floaty: Double? - get() = _floaty.invoke() + @get:JvmName("getFloaty") + public val floaty: Double? + get() = _floaty.invoke() - public companion object { - private val countDefault: () -> Int? = - { throw IllegalStateException("Field `count` was not requested") } + public companion object { + private val countDefault: () -> Int? = { throw IllegalStateException("Field `count` was not requested") } + private val truthDefault: () -> Boolean? = { throw IllegalStateException("Field `truth` was not requested") } - private val truthDefault: () -> Boolean? = - { throw IllegalStateException("Field `truth` was not requested") } - - - private val floatyDefault: () -> Double? = - { throw IllegalStateException("Field `floaty` was not requested") } + private val floatyDefault: () -> Double? = { throw IllegalStateException("Field `floaty` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var count: () -> Int? = countDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var count: () -> Int? = countDefault + private var truth: () -> Boolean? = truthDefault - private var truth: () -> Boolean? = truthDefault + private var floaty: () -> Double? = floatyDefault - private var floaty: () -> Double? = floatyDefault + @JsonProperty("count") + public fun withCount(count: Int?): Builder = this.apply { + this.count = { count } + } - @JsonProperty("count") - public fun withCount(count: Int?): Builder = this.apply { - this.count = { count } - } + @JsonProperty("truth") + public fun withTruth(truth: Boolean?): Builder = this.apply { + this.truth = { truth } + } - @JsonProperty("truth") - public fun withTruth(truth: Boolean?): Builder = this.apply { - this.truth = { truth } - } + @JsonProperty("floaty") + public fun withFloaty(floaty: Double?): Builder = this.apply { + this.floaty = { floaty } + } - @JsonProperty("floaty") - public fun withFloaty(floaty: Double?): Builder = this.apply { - this.floaty = { floaty } + public fun build(): MyType = MyType( + count = count, + truth = truth, + floaty = floaty + ) } - - public fun build(): MyType = MyType( - count = count, - truth = truth, - floaty = floaty, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/DgsClient.kt index 137dd6747..6f858f9d0 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/DgsConstants.kt index 70ab9f82d..9c5bfb3b8 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/DgsConstants.kt @@ -3,21 +3,21 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithRecursiveField.expect import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val People: String = "people" - } + public const val People: String = "people" + } - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Lastname: String = "lastname" + public const val Lastname: String = "lastname" - public const val Friends: String = "friends" - } + public const val Friends: String = "friends" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/client/PersonProjection.kt index 83796a3ce..8273ca65a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/client/PersonProjection.kt @@ -3,20 +3,20 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithRecursiveField.expect import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val firstname: PersonProjection - get() { - field("firstname") - return this - } + public val firstname: PersonProjection + get() { + field("firstname") + return this + } - public val lastname: PersonProjection - get() { - field("lastname") - return this - } + public val lastname: PersonProjection + get() { + field("lastname") + return this + } - public fun friends(_projection: PersonProjection.() -> PersonProjection): PersonProjection { - field("friends", PersonProjection(), _projection) - return this - } + public fun friends(_projection: PersonProjection.() -> PersonProjection): PersonProjection { + field("friends", PersonProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/client/QueryProjection.kt index 99daaeed3..b6f70ac34 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/client/QueryProjection.kt @@ -3,8 +3,8 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithRecursiveField.expect import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("people", PersonProjection(), _projection) - return this - } + public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { + field("people", PersonProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/types/Person.kt index 05d8e5563..fea39d96a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/types/Person.kt @@ -13,70 +13,64 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Person.Builder::class) public class Person( - firstname: () -> String? = firstnameDefault, - lastname: () -> String? = lastnameDefault, - friends: () -> List? = friendsDefault, + firstname: () -> String? = firstnameDefault, + lastname: () -> String? = lastnameDefault, + friends: () -> List? = friendsDefault ) { - private val _firstname: () -> String? = firstname + private val _firstname: () -> String? = firstname - private val _lastname: () -> String? = lastname + private val _lastname: () -> String? = lastname - private val _friends: () -> List? = friends + private val _friends: () -> List? = friends - @get:JvmName("getFirstname") - public val firstname: String? - get() = _firstname.invoke() + @get:JvmName("getFirstname") + public val firstname: String? + get() = _firstname.invoke() - @get:JvmName("getLastname") - public val lastname: String? - get() = _lastname.invoke() + @get:JvmName("getLastname") + public val lastname: String? + get() = _lastname.invoke() - @get:JvmName("getFriends") - public val friends: List? - get() = _friends.invoke() + @get:JvmName("getFriends") + public val friends: List? + get() = _friends.invoke() - public companion object { - private val firstnameDefault: () -> String? = - { throw IllegalStateException("Field `firstname` was not requested") } + public companion object { + private val firstnameDefault: () -> String? = { throw IllegalStateException("Field `firstname` was not requested") } + private val lastnameDefault: () -> String? = { throw IllegalStateException("Field `lastname` was not requested") } - private val lastnameDefault: () -> String? = - { throw IllegalStateException("Field `lastname` was not requested") } - - - private val friendsDefault: () -> List? = - { throw IllegalStateException("Field `friends` was not requested") } + private val friendsDefault: () -> List? = { throw IllegalStateException("Field `friends` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var firstname: () -> String? = firstnameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var firstname: () -> String? = firstnameDefault + private var lastname: () -> String? = lastnameDefault - private var lastname: () -> String? = lastnameDefault + private var friends: () -> List? = friendsDefault - private var friends: () -> List? = friendsDefault + @JsonProperty("firstname") + public fun withFirstname(firstname: String?): Builder = this.apply { + this.firstname = { firstname } + } - @JsonProperty("firstname") - public fun withFirstname(firstname: String?): Builder = this.apply { - this.firstname = { firstname } - } + @JsonProperty("lastname") + public fun withLastname(lastname: String?): Builder = this.apply { + this.lastname = { lastname } + } - @JsonProperty("lastname") - public fun withLastname(lastname: String?): Builder = this.apply { - this.lastname = { lastname } - } + @JsonProperty("friends") + public fun withFriends(friends: List?): Builder = this.apply { + this.friends = { friends } + } - @JsonProperty("friends") - public fun withFriends(friends: List?): Builder = this.apply { - this.friends = { friends } + public fun build(): Person = Person( + firstname = firstname, + lastname = lastname, + friends = friends + ) } - - public fun build(): Person = Person( - firstname = firstname, - lastname = lastname, - friends = friends, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/types/Query.kt index fef124d9f..019e6eaad 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithRecursiveField/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - people: () -> List? = peopleDefault, + people: () -> List? = peopleDefault ) { - private val _people: () -> List? = people + private val _people: () -> List? = people - @get:JvmName("getPeople") - public val people: List? - get() = _people.invoke() + @get:JvmName("getPeople") + public val people: List? + get() = _people.invoke() - public companion object { - private val peopleDefault: () -> List? = - { throw IllegalStateException("Field `people` was not requested") } + public companion object { + private val peopleDefault: () -> List? = { throw IllegalStateException("Field `people` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var people: () -> List? = peopleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var people: () -> List? = peopleDefault + @JsonProperty("people") + public fun withPeople(people: List?): Builder = this.apply { + this.people = { people } + } - @JsonProperty("people") - public fun withPeople(people: List?): Builder = this.apply { - this.people = { people } + public fun build(): Query = Query( + people = people + ) } - - public fun build(): Query = Query( - people = people, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/DgsConstants.kt index da09e098d..51f8a7038 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/DgsConstants.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithReservedWord.expected import kotlin.String public object DgsConstants { - public object SAMPLETYPE { - public const val TYPE_NAME: String = "SampleType" + public object SAMPLETYPE { + public const val TYPE_NAME: String = "SampleType" - public const val Return: String = "return" - } + public const val Return: String = "return" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/client/SampleTypeProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/client/SampleTypeProjection.kt index f92365a97..838dcffca 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/client/SampleTypeProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/client/SampleTypeProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithReservedWord.expected import com.netflix.graphql.dgs.codegen.GraphQLProjection public class SampleTypeProjection : GraphQLProjection() { - public val `return`: SampleTypeProjection - get() { - field("return") - return this - } + public val `return`: SampleTypeProjection + get() { + field("return") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/SampleType.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/SampleType.kt index 3ef76ebca..a11340e0d 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/SampleType.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/SampleType.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = SampleType.Builder::class) public class SampleType( - `return`: () -> String = returnDefault, + `return`: () -> String = returnDefault ) { - private val _return: () -> String = `return` + private val _return: () -> String = `return` - @get:JvmName("getReturn") - public val `return`: String - get() = _return.invoke() + @get:JvmName("getReturn") + public val `return`: String + get() = _return.invoke() - public companion object { - private val returnDefault: () -> String = - { throw IllegalStateException("Field `return` was not requested") } + public companion object { + private val returnDefault: () -> String = { throw IllegalStateException("Field `return` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var `return`: () -> String = returnDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var `return`: () -> String = returnDefault + @JsonProperty("return") + public fun withReturn(`return`: String): Builder = this.apply { + this.`return` = { `return` } + } - @JsonProperty("return") - public fun withReturn(`return`: String): Builder = this.apply { - this.`return` = { `return` } + public fun build(): SampleType = SampleType( + `return` = `return` + ) } - - public fun build(): SampleType = SampleType( - `return` = `return`, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/DgsClient.kt index 4e53a7c16..804d1932e 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/DgsConstants.kt index 3432bf577..83631d9d8 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/DgsConstants.kt @@ -3,19 +3,19 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithStringProperties.expe import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val People: String = "people" - } + public const val People: String = "people" + } - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Lastname: String = "lastname" - } + public const val Lastname: String = "lastname" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/client/PersonProjection.kt index dfad65469..6ee1159e7 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/client/PersonProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithStringProperties.expe import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val firstname: PersonProjection - get() { - field("firstname") - return this - } + public val firstname: PersonProjection + get() { + field("firstname") + return this + } - public val lastname: PersonProjection - get() { - field("lastname") - return this - } + public val lastname: PersonProjection + get() { + field("lastname") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/client/QueryProjection.kt index 42ab08131..938962a1b 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/client/QueryProjection.kt @@ -3,8 +3,8 @@ package com.netflix.graphql.dgs.codegen.cases.dataClassWithStringProperties.expe import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("people", PersonProjection(), _projection) - return this - } + public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { + field("people", PersonProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/types/Person.kt index a6bb21f5e..8e864c45e 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/types/Person.kt @@ -12,51 +12,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Person.Builder::class) public class Person( - firstname: () -> String? = firstnameDefault, - lastname: () -> String? = lastnameDefault, + firstname: () -> String? = firstnameDefault, + lastname: () -> String? = lastnameDefault ) { - private val _firstname: () -> String? = firstname + private val _firstname: () -> String? = firstname - private val _lastname: () -> String? = lastname + private val _lastname: () -> String? = lastname - @get:JvmName("getFirstname") - public val firstname: String? - get() = _firstname.invoke() + @get:JvmName("getFirstname") + public val firstname: String? + get() = _firstname.invoke() - @get:JvmName("getLastname") - public val lastname: String? - get() = _lastname.invoke() + @get:JvmName("getLastname") + public val lastname: String? + get() = _lastname.invoke() - public companion object { - private val firstnameDefault: () -> String? = - { throw IllegalStateException("Field `firstname` was not requested") } + public companion object { + private val firstnameDefault: () -> String? = { throw IllegalStateException("Field `firstname` was not requested") } + private val lastnameDefault: () -> String? = { throw IllegalStateException("Field `lastname` was not requested") } + } - private val lastnameDefault: () -> String? = - { throw IllegalStateException("Field `lastname` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var firstname: () -> String? = firstnameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var firstname: () -> String? = firstnameDefault + private var lastname: () -> String? = lastnameDefault - private var lastname: () -> String? = lastnameDefault + @JsonProperty("firstname") + public fun withFirstname(firstname: String?): Builder = this.apply { + this.firstname = { firstname } + } - @JsonProperty("firstname") - public fun withFirstname(firstname: String?): Builder = this.apply { - this.firstname = { firstname } - } + @JsonProperty("lastname") + public fun withLastname(lastname: String?): Builder = this.apply { + this.lastname = { lastname } + } - @JsonProperty("lastname") - public fun withLastname(lastname: String?): Builder = this.apply { - this.lastname = { lastname } + public fun build(): Person = Person( + firstname = firstname, + lastname = lastname + ) } - - public fun build(): Person = Person( - firstname = firstname, - lastname = lastname, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/types/Query.kt index d28b0348b..2c62e3d13 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithStringProperties/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - people: () -> List? = peopleDefault, + people: () -> List? = peopleDefault ) { - private val _people: () -> List? = people + private val _people: () -> List? = people - @get:JvmName("getPeople") - public val people: List? - get() = _people.invoke() + @get:JvmName("getPeople") + public val people: List? + get() = _people.invoke() - public companion object { - private val peopleDefault: () -> List? = - { throw IllegalStateException("Field `people` was not requested") } + public companion object { + private val peopleDefault: () -> List? = { throw IllegalStateException("Field `people` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var people: () -> List? = peopleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var people: () -> List? = peopleDefault + @JsonProperty("people") + public fun withPeople(people: List?): Builder = this.apply { + this.people = { people } + } - @JsonProperty("people") - public fun withPeople(people: List?): Builder = this.apply { - this.people = { people } + public fun build(): Query = Query( + people = people + ) } - - public fun build(): Query = Query( - people = people, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/DgsClient.kt index 7b95db285..1bc8138fe 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/DgsConstants.kt index d586c45f9..6408e63e5 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/DgsConstants.kt @@ -3,11 +3,11 @@ package com.netflix.graphql.dgs.codegen.cases.`enum`.expected import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Types: String = "types" - } + public const val Types: String = "types" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/client/QueryProjection.kt index 9163fd1a1..0c32875de 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/client/QueryProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.`enum`.expected.client import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public val types: QueryProjection - get() { - field("types") - return this - } + public val types: QueryProjection + get() { + field("types") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/types/EmployeeTypes.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/types/EmployeeTypes.kt index 1bc384a8d..1c407c98b 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/types/EmployeeTypes.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/types/EmployeeTypes.kt @@ -1,7 +1,7 @@ package com.netflix.graphql.dgs.codegen.cases.`enum`.expected.types public enum class EmployeeTypes { - ENGINEER, - MANAGER, - DIRECTOR, + ENGINEER, + MANAGER, + DIRECTOR, } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/types/Query.kt index 58137f1a6..7532172ef 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enum/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - types: () -> List? = typesDefault, + types: () -> List? = typesDefault ) { - private val _types: () -> List? = types + private val _types: () -> List? = types - @get:JvmName("getTypes") - public val types: List? - get() = _types.invoke() + @get:JvmName("getTypes") + public val types: List? + get() = _types.invoke() - public companion object { - private val typesDefault: () -> List? = - { throw IllegalStateException("Field `types` was not requested") } + public companion object { + private val typesDefault: () -> List? = { throw IllegalStateException("Field `types` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var types: () -> List? = typesDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var types: () -> List? = typesDefault + @JsonProperty("types") + public fun withTypes(types: List?): Builder = this.apply { + this.types = { types } + } - @JsonProperty("types") - public fun withTypes(types: List?): Builder = this.apply { - this.types = { types } + public fun build(): Query = Query( + types = types + ) } - - public fun build(): Query = Query( - types = types, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumDocs/expected/types/Color.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumDocs/expected/types/Color.kt index 3aea3b1fb..3a8749b23 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumDocs/expected/types/Color.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumDocs/expected/types/Color.kt @@ -4,7 +4,7 @@ package com.netflix.graphql.dgs.codegen.cases.enumDocs.expected.types * Some options */ public enum class Color { - red, - white, - blue, + red, + white, + blue, } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/DgsClient.kt index 2070401f5..2fa9e6a81 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/DgsConstants.kt index f81c45d80..b77a985c4 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/DgsConstants.kt @@ -3,11 +3,11 @@ package com.netflix.graphql.dgs.codegen.cases.enumWithExtendedType.expected import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Types: String = "types" - } + public const val Types: String = "types" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/client/QueryProjection.kt index e76e95d75..768f3998c 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/client/QueryProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.enumWithExtendedType.expected.clie import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public val types: QueryProjection - get() { - field("types") - return this - } + public val types: QueryProjection + get() { + field("types") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/types/EmployeeTypes.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/types/EmployeeTypes.kt index 2208fc91e..6b2f618d0 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/types/EmployeeTypes.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/types/EmployeeTypes.kt @@ -1,8 +1,8 @@ package com.netflix.graphql.dgs.codegen.cases.enumWithExtendedType.expected.types public enum class EmployeeTypes { - ENGINEER, - MANAGER, - DIRECTOR, - QA, + ENGINEER, + MANAGER, + DIRECTOR, + QA, } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/types/Query.kt index aa3a35be7..24c3d9912 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/enumWithExtendedType/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - types: () -> List? = typesDefault, + types: () -> List? = typesDefault ) { - private val _types: () -> List? = types + private val _types: () -> List? = types - @get:JvmName("getTypes") - public val types: List? - get() = _types.invoke() + @get:JvmName("getTypes") + public val types: List? + get() = _types.invoke() - public companion object { - private val typesDefault: () -> List? = - { throw IllegalStateException("Field `types` was not requested") } + public companion object { + private val typesDefault: () -> List? = { throw IllegalStateException("Field `types` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var types: () -> List? = typesDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var types: () -> List? = typesDefault + @JsonProperty("types") + public fun withTypes(types: List?): Builder = this.apply { + this.types = { types } + } - @JsonProperty("types") - public fun withTypes(types: List?): Builder = this.apply { - this.types = { types } + public fun build(): Query = Query( + types = types + ) } - - public fun build(): Query = Query( - types = types, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/DgsClient.kt index 12dabcd39..fe4c059b4 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/DgsConstants.kt index 49c9e45dd..59fa8ebc7 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/DgsConstants.kt @@ -3,21 +3,21 @@ package com.netflix.graphql.dgs.codegen.cases.input.expected import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Movies: String = "movies" + public const val Movies: String = "movies" - public object MOVIES_INPUT_ARGUMENT { - public const val Filter: String = "filter" + public object MOVIES_INPUT_ARGUMENT { + public const val Filter: String = "filter" + } } - } - public object MOVIEFILTER { - public const val TYPE_NAME: String = "MovieFilter" + public object MOVIEFILTER { + public const val TYPE_NAME: String = "MovieFilter" - public const val Genre: String = "genre" - } + public const val Genre: String = "genre" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/client/QueryProjection.kt index c1022e7f5..2a6ea53e2 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/client/QueryProjection.kt @@ -4,9 +4,9 @@ import com.netflix.graphql.dgs.codegen.GraphQLProjection import com.netflix.graphql.dgs.codegen.cases.input.expected.types.MovieFilter public class QueryProjection : GraphQLProjection() { - public fun movies(filter: MovieFilter? = default("filter")): - QueryProjection { - field("movies", "filter" to filter) - return this - } + public fun movies(filter: MovieFilter? = default("filter")): + QueryProjection { + field("movies", "filter" to filter) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/types/MovieFilter.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/types/MovieFilter.kt index 16fd73753..9e7eea70e 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/types/MovieFilter.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/types/MovieFilter.kt @@ -7,7 +7,7 @@ import kotlin.String import kotlin.collections.List public class MovieFilter( - public val genre: String? = default("genre"), + public val genre: String? = default("genre") ) : GraphQLInput() { - override fun fields(): List> = listOf("genre" to genre) + override fun fields(): List> = listOf("genre" to genre) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/types/Query.kt index 748489890..177e1dc44 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/input/expected/types/Query.kt @@ -13,32 +13,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - movies: () -> List? = moviesDefault, + movies: () -> List? = moviesDefault ) { - private val _movies: () -> List? = movies + private val _movies: () -> List? = movies - @get:JvmName("getMovies") - public val movies: List? - get() = _movies.invoke() + @get:JvmName("getMovies") + public val movies: List? + get() = _movies.invoke() - public companion object { - private val moviesDefault: () -> List? = - { throw IllegalStateException("Field `movies` was not requested") } + public companion object { + private val moviesDefault: () -> List? = { throw IllegalStateException("Field `movies` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var movies: () -> List? = moviesDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var movies: () -> List? = moviesDefault + @JsonProperty("movies") + public fun withMovies(movies: List?): Builder = this.apply { + this.movies = { movies } + } - @JsonProperty("movies") - public fun withMovies(movies: List?): Builder = this.apply { - this.movies = { movies } + public fun build(): Query = Query( + movies = movies + ) } - - public fun build(): Query = Query( - movies = movies, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultEnumValueForArray/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultEnumValueForArray/expected/DgsConstants.kt index 45fc24cd2..2972761c7 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultEnumValueForArray/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultEnumValueForArray/expected/DgsConstants.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.inputWithDefaultEnumValueForArray. import kotlin.String public object DgsConstants { - public object SOMETYPE { - public const val TYPE_NAME: String = "SomeType" + public object SOMETYPE { + public const val TYPE_NAME: String = "SomeType" - public const val Colors: String = "colors" - } + public const val Colors: String = "colors" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultEnumValueForArray/expected/types/Color.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultEnumValueForArray/expected/types/Color.kt index 1d897afea..dd3086395 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultEnumValueForArray/expected/types/Color.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultEnumValueForArray/expected/types/Color.kt @@ -1,6 +1,6 @@ package com.netflix.graphql.dgs.codegen.cases.inputWithDefaultEnumValueForArray.expected.types public enum class Color { - red, - blue, + red, + blue, } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultEnumValueForArray/expected/types/SomeType.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultEnumValueForArray/expected/types/SomeType.kt index ab733bf04..f9ec30ca4 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultEnumValueForArray/expected/types/SomeType.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultEnumValueForArray/expected/types/SomeType.kt @@ -7,7 +7,7 @@ import kotlin.String import kotlin.collections.List public class SomeType( - public val colors: List? = default?>("colors"), + public val colors: List? = default?>("colors") ) : GraphQLInput() { - override fun fields(): List> = listOf("colors" to colors) + override fun fields(): List> = listOf("colors" to colors) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultIntValueForArray/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultIntValueForArray/expected/DgsConstants.kt index 6e8cda303..42a8ba0b2 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultIntValueForArray/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultIntValueForArray/expected/DgsConstants.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.inputWithDefaultIntValueForArray.e import kotlin.String public object DgsConstants { - public object SOMETYPE { - public const val TYPE_NAME: String = "SomeType" + public object SOMETYPE { + public const val TYPE_NAME: String = "SomeType" - public const val Numbers: String = "numbers" - } + public const val Numbers: String = "numbers" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultIntValueForArray/expected/types/SomeType.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultIntValueForArray/expected/types/SomeType.kt index dea0b24ec..a9dd0e6d4 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultIntValueForArray/expected/types/SomeType.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultIntValueForArray/expected/types/SomeType.kt @@ -8,7 +8,7 @@ import kotlin.String import kotlin.collections.List public class SomeType( - public val numbers: List? = default?>("numbers"), + public val numbers: List? = default?>("numbers") ) : GraphQLInput() { - override fun fields(): List> = listOf("numbers" to numbers) + override fun fields(): List> = listOf("numbers" to numbers) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultStringValueForArray/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultStringValueForArray/expected/DgsConstants.kt index 08962f3ed..ef80bef77 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultStringValueForArray/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultStringValueForArray/expected/DgsConstants.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.inputWithDefaultStringValueForArra import kotlin.String public object DgsConstants { - public object SOMETYPE { - public const val TYPE_NAME: String = "SomeType" + public object SOMETYPE { + public const val TYPE_NAME: String = "SomeType" - public const val Names: String = "names" - } + public const val Names: String = "names" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultStringValueForArray/expected/types/SomeType.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultStringValueForArray/expected/types/SomeType.kt index 104f8b6f0..e87560f8d 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultStringValueForArray/expected/types/SomeType.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultStringValueForArray/expected/types/SomeType.kt @@ -7,7 +7,7 @@ import kotlin.String import kotlin.collections.List public class SomeType( - public val names: List? = default?>("names"), + public val names: List? = default?>("names") ) : GraphQLInput() { - override fun fields(): List> = listOf("names" to names) + override fun fields(): List> = listOf("names" to names) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForArray/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForArray/expected/DgsConstants.kt index ff5c9c0e6..75074ef5d 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForArray/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForArray/expected/DgsConstants.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.inputWithDefaultValueForArray.expe import kotlin.String public object DgsConstants { - public object SOMETYPE { - public const val TYPE_NAME: String = "SomeType" + public object SOMETYPE { + public const val TYPE_NAME: String = "SomeType" - public const val Names: String = "names" - } + public const val Names: String = "names" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForArray/expected/types/SomeType.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForArray/expected/types/SomeType.kt index ac63e3bdd..b7aa658a5 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForArray/expected/types/SomeType.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForArray/expected/types/SomeType.kt @@ -7,7 +7,7 @@ import kotlin.String import kotlin.collections.List public class SomeType( - public val names: List? = default?>("names"), + public val names: List? = default?>("names") ) : GraphQLInput() { - override fun fields(): List> = listOf("names" to names) + override fun fields(): List> = listOf("names" to names) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForEnum/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForEnum/expected/DgsConstants.kt index f1d1aae18..f0b634a55 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForEnum/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForEnum/expected/DgsConstants.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.inputWithDefaultValueForEnum.expec import kotlin.String public object DgsConstants { - public object COLORFILTER { - public const val TYPE_NAME: String = "ColorFilter" + public object COLORFILTER { + public const val TYPE_NAME: String = "ColorFilter" - public const val Color: String = "color" - } + public const val Color: String = "color" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForEnum/expected/types/Color.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForEnum/expected/types/Color.kt index 62c32f1ba..cb91658e0 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForEnum/expected/types/Color.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForEnum/expected/types/Color.kt @@ -1,5 +1,5 @@ package com.netflix.graphql.dgs.codegen.cases.inputWithDefaultValueForEnum.expected.types public enum class Color { - red, + red, } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForEnum/expected/types/ColorFilter.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForEnum/expected/types/ColorFilter.kt index db06d5b00..f71be63c2 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForEnum/expected/types/ColorFilter.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultValueForEnum/expected/types/ColorFilter.kt @@ -7,7 +7,7 @@ import kotlin.String import kotlin.collections.List public class ColorFilter( - public val color: Color? = default("color"), + public val color: Color? = default("color") ) : GraphQLInput() { - override fun fields(): List> = listOf("color" to color) + override fun fields(): List> = listOf("color" to color) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/DgsClient.kt index 44176e0a8..5e05ec7ea 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/DgsConstants.kt index fe33d1fdc..64cf885c5 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/DgsConstants.kt @@ -3,23 +3,23 @@ package com.netflix.graphql.dgs.codegen.cases.inputWithExtendedType.expected import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Movies: String = "movies" + public const val Movies: String = "movies" - public object MOVIES_INPUT_ARGUMENT { - public const val Filter: String = "filter" + public object MOVIES_INPUT_ARGUMENT { + public const val Filter: String = "filter" + } } - } - public object MOVIEFILTER { - public const val TYPE_NAME: String = "MovieFilter" + public object MOVIEFILTER { + public const val TYPE_NAME: String = "MovieFilter" - public const val Genre: String = "genre" + public const val Genre: String = "genre" - public const val ReleaseYear: String = "releaseYear" - } + public const val ReleaseYear: String = "releaseYear" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/client/QueryProjection.kt index 12136e4fe..fdbade62b 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/client/QueryProjection.kt @@ -4,9 +4,9 @@ import com.netflix.graphql.dgs.codegen.GraphQLProjection import com.netflix.graphql.dgs.codegen.cases.inputWithExtendedType.expected.types.MovieFilter public class QueryProjection : GraphQLProjection() { - public fun movies(filter: MovieFilter? = default("filter")): - QueryProjection { - field("movies", "filter" to filter) - return this - } + public fun movies(filter: MovieFilter? = default("filter")): + QueryProjection { + field("movies", "filter" to filter) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/types/MovieFilter.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/types/MovieFilter.kt index 7f529f505..983844f8f 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/types/MovieFilter.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/types/MovieFilter.kt @@ -8,9 +8,12 @@ import kotlin.String import kotlin.collections.List public class MovieFilter( - public val genre: String? = default("genre"), - public val releaseYear: Int? = default("releaseYear"), + public val genre: String? = default("genre"), + public val releaseYear: Int? = default("releaseYear") ) : GraphQLInput() { - override fun fields(): List> = listOf("genre" to genre, "releaseYear" to - releaseYear) + override fun fields(): List> = listOf( + "genre" to genre, + "releaseYear" to + releaseYear + ) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/types/Query.kt index 68469fe58..b6c52002c 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithExtendedType/expected/types/Query.kt @@ -13,32 +13,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - movies: () -> List? = moviesDefault, + movies: () -> List? = moviesDefault ) { - private val _movies: () -> List? = movies + private val _movies: () -> List? = movies - @get:JvmName("getMovies") - public val movies: List? - get() = _movies.invoke() + @get:JvmName("getMovies") + public val movies: List? + get() = _movies.invoke() - public companion object { - private val moviesDefault: () -> List? = - { throw IllegalStateException("Field `movies` was not requested") } + public companion object { + private val moviesDefault: () -> List? = { throw IllegalStateException("Field `movies` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var movies: () -> List? = moviesDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var movies: () -> List? = moviesDefault + @JsonProperty("movies") + public fun withMovies(movies: List?): Builder = this.apply { + this.movies = { movies } + } - @JsonProperty("movies") - public fun withMovies(movies: List?): Builder = this.apply { - this.movies = { movies } + public fun build(): Query = Query( + movies = movies + ) } - - public fun build(): Query = Query( - movies = movies, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithReservedWord/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithReservedWord/expected/DgsConstants.kt index fa70b8882..14844b9cc 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithReservedWord/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithReservedWord/expected/DgsConstants.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.inputWithReservedWord.expected import kotlin.String public object DgsConstants { - public object SAMPLEINPUT { - public const val TYPE_NAME: String = "SampleInput" + public object SAMPLEINPUT { + public const val TYPE_NAME: String = "SampleInput" - public const val Return: String = "return" - } + public const val Return: String = "return" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithReservedWord/expected/types/SampleInput.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithReservedWord/expected/types/SampleInput.kt index 97986e155..f19b2240c 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithReservedWord/expected/types/SampleInput.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithReservedWord/expected/types/SampleInput.kt @@ -7,7 +7,7 @@ import kotlin.String import kotlin.collections.List public class SampleInput( - public val `return`: String, + public val `return`: String ) : GraphQLInput() { - override fun fields(): List> = listOf("return" to `return`) + override fun fields(): List> = listOf("return" to `return`) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/DgsConstants.kt index 446e7b3fb..c935d56ed 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/DgsConstants.kt @@ -3,51 +3,51 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceClassWithInterfaceFields. import kotlin.String public object DgsConstants { - public object DOG { - public const val TYPE_NAME: String = "Dog" + public object DOG { + public const val TYPE_NAME: String = "Dog" - public const val Id: String = "id" + public const val Id: String = "id" - public const val Name: String = "name" + public const val Name: String = "name" - public const val Address: String = "address" + public const val Address: String = "address" - public const val Mother: String = "mother" + public const val Mother: String = "mother" - public const val Father: String = "father" + public const val Father: String = "father" - public const val Parents: String = "parents" - } + public const val Parents: String = "parents" + } - public object BIRD { - public const val TYPE_NAME: String = "Bird" + public object BIRD { + public const val TYPE_NAME: String = "Bird" - public const val Id: String = "id" + public const val Id: String = "id" - public const val Name: String = "name" + public const val Name: String = "name" - public const val Address: String = "address" + public const val Address: String = "address" - public const val Mother: String = "mother" + public const val Mother: String = "mother" - public const val Father: String = "father" + public const val Father: String = "father" - public const val Parents: String = "parents" - } + public const val Parents: String = "parents" + } - public object PET { - public const val TYPE_NAME: String = "Pet" + public object PET { + public const val TYPE_NAME: String = "Pet" - public const val Id: String = "id" + public const val Id: String = "id" - public const val Name: String = "name" + public const val Name: String = "name" - public const val Address: String = "address" + public const val Address: String = "address" - public const val Mother: String = "mother" + public const val Mother: String = "mother" - public const val Father: String = "father" + public const val Father: String = "father" - public const val Parents: String = "parents" - } + public const val Parents: String = "parents" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/client/BirdProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/client/BirdProjection.kt index 1226e25aa..9f73aa493 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/client/BirdProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/client/BirdProjection.kt @@ -3,36 +3,36 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceClassWithInterfaceFields. import com.netflix.graphql.dgs.codegen.GraphQLProjection public class BirdProjection : GraphQLProjection() { - public val id: BirdProjection - get() { - field("id") - return this - } + public val id: BirdProjection + get() { + field("id") + return this + } - public val name: BirdProjection - get() { - field("name") - return this - } + public val name: BirdProjection + get() { + field("name") + return this + } - public val address: BirdProjection - get() { - field("address") - return this - } + public val address: BirdProjection + get() { + field("address") + return this + } - public fun mother(_projection: BirdProjection.() -> BirdProjection): BirdProjection { - field("mother", BirdProjection(), _projection) - return this - } + public fun mother(_projection: BirdProjection.() -> BirdProjection): BirdProjection { + field("mother", BirdProjection(), _projection) + return this + } - public fun father(_projection: BirdProjection.() -> BirdProjection): BirdProjection { - field("father", BirdProjection(), _projection) - return this - } + public fun father(_projection: BirdProjection.() -> BirdProjection): BirdProjection { + field("father", BirdProjection(), _projection) + return this + } - public fun parents(_projection: BirdProjection.() -> BirdProjection): BirdProjection { - field("parents", BirdProjection(), _projection) - return this - } + public fun parents(_projection: BirdProjection.() -> BirdProjection): BirdProjection { + field("parents", BirdProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/client/DogProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/client/DogProjection.kt index 37fdca7f7..04e68592a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/client/DogProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/client/DogProjection.kt @@ -3,36 +3,36 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceClassWithInterfaceFields. import com.netflix.graphql.dgs.codegen.GraphQLProjection public class DogProjection : GraphQLProjection() { - public val id: DogProjection - get() { - field("id") - return this - } + public val id: DogProjection + get() { + field("id") + return this + } - public val name: DogProjection - get() { - field("name") - return this - } + public val name: DogProjection + get() { + field("name") + return this + } - public val address: DogProjection - get() { - field("address") - return this - } + public val address: DogProjection + get() { + field("address") + return this + } - public fun mother(_projection: DogProjection.() -> DogProjection): DogProjection { - field("mother", DogProjection(), _projection) - return this - } + public fun mother(_projection: DogProjection.() -> DogProjection): DogProjection { + field("mother", DogProjection(), _projection) + return this + } - public fun father(_projection: DogProjection.() -> DogProjection): DogProjection { - field("father", DogProjection(), _projection) - return this - } + public fun father(_projection: DogProjection.() -> DogProjection): DogProjection { + field("father", DogProjection(), _projection) + return this + } - public fun parents(_projection: DogProjection.() -> DogProjection): DogProjection { - field("parents", DogProjection(), _projection) - return this - } + public fun parents(_projection: DogProjection.() -> DogProjection): DogProjection { + field("parents", DogProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/client/PetProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/client/PetProjection.kt index 3ca1290f9..e97d8a85a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/client/PetProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/client/PetProjection.kt @@ -3,46 +3,46 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceClassWithInterfaceFields. import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PetProjection : GraphQLProjection() { - public val id: PetProjection - get() { - field("id") - return this + public val id: PetProjection + get() { + field("id") + return this + } + + public val name: PetProjection + get() { + field("name") + return this + } + + public val address: PetProjection + get() { + field("address") + return this + } + + public fun mother(_projection: PetProjection.() -> PetProjection): PetProjection { + field("mother", PetProjection(), _projection) + return this } - public val name: PetProjection - get() { - field("name") - return this + public fun father(_projection: PetProjection.() -> PetProjection): PetProjection { + field("father", PetProjection(), _projection) + return this } - public val address: PetProjection - get() { - field("address") - return this + public fun parents(_projection: PetProjection.() -> PetProjection): PetProjection { + field("parents", PetProjection(), _projection) + return this } - public fun mother(_projection: PetProjection.() -> PetProjection): PetProjection { - field("mother", PetProjection(), _projection) - return this - } - - public fun father(_projection: PetProjection.() -> PetProjection): PetProjection { - field("father", PetProjection(), _projection) - return this - } - - public fun parents(_projection: PetProjection.() -> PetProjection): PetProjection { - field("parents", PetProjection(), _projection) - return this - } - - public fun onDog(_projection: DogProjection.() -> DogProjection): PetProjection { - fragment("Dog", DogProjection(), _projection) - return this - } - - public fun onBird(_projection: BirdProjection.() -> BirdProjection): PetProjection { - fragment("Bird", BirdProjection(), _projection) - return this - } + public fun onDog(_projection: DogProjection.() -> DogProjection): PetProjection { + fragment("Dog", DogProjection(), _projection) + return this + } + + public fun onBird(_projection: BirdProjection.() -> BirdProjection): PetProjection { + fragment("Bird", BirdProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/types/Bird.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/types/Bird.kt index 034d513d4..8dccf5f83 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/types/Bird.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/types/Bird.kt @@ -14,133 +14,121 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Bird.Builder::class) public class Bird( - id: () -> String = idDefault, - name: () -> String? = nameDefault, - address: () -> List = addressDefault, - mother: () -> Bird = motherDefault, - father: () -> Bird? = fatherDefault, - parents: () -> List? = parentsDefault, + id: () -> String = idDefault, + name: () -> String? = nameDefault, + address: () -> List = addressDefault, + mother: () -> Bird = motherDefault, + father: () -> Bird? = fatherDefault, + parents: () -> List? = parentsDefault ) : Pet { - private val _id: () -> String = id + private val _id: () -> String = id - private val _name: () -> String? = name + private val _name: () -> String? = name - private val _address: () -> List = address + private val _address: () -> List = address - private val _mother: () -> Bird = mother + private val _mother: () -> Bird = mother - private val _father: () -> Bird? = father + private val _father: () -> Bird? = father - private val _parents: () -> List? = parents + private val _parents: () -> List? = parents - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getId") - override val id: String - get() = _id.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getId") + override val id: String + get() = _id.invoke() - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getName") - override val name: String? - get() = _name.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getName") + override val name: String? + get() = _name.invoke() - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getAddress") - override val address: List - get() = _address.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getAddress") + override val address: List + get() = _address.invoke() - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getMother") - override val mother: Bird - get() = _mother.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getMother") + override val mother: Bird + get() = _mother.invoke() - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFather") - override val father: Bird? - get() = _father.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFather") + override val father: Bird? + get() = _father.invoke() - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getParents") - override val parents: List? - get() = _parents.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getParents") + override val parents: List? + get() = _parents.invoke() - public companion object { - private val idDefault: () -> String = - { throw IllegalStateException("Field `id` was not requested") } + public companion object { + private val idDefault: () -> String = { throw IllegalStateException("Field `id` was not requested") } + private val nameDefault: () -> String? = { throw IllegalStateException("Field `name` was not requested") } - private val nameDefault: () -> String? = - { throw IllegalStateException("Field `name` was not requested") } + private val addressDefault: () -> List = { throw IllegalStateException("Field `address` was not requested") } + private val motherDefault: () -> Bird = { throw IllegalStateException("Field `mother` was not requested") } - private val addressDefault: () -> List = - { throw IllegalStateException("Field `address` was not requested") } + private val fatherDefault: () -> Bird? = { throw IllegalStateException("Field `father` was not requested") } + private val parentsDefault: () -> List? = { throw IllegalStateException("Field `parents` was not requested") } + } - private val motherDefault: () -> Bird = - { throw IllegalStateException("Field `mother` was not requested") } - - - private val fatherDefault: () -> Bird? = - { throw IllegalStateException("Field `father` was not requested") } - - - private val parentsDefault: () -> List? = - { throw IllegalStateException("Field `parents` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var id: () -> String = idDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var id: () -> String = idDefault + private var name: () -> String? = nameDefault - private var name: () -> String? = nameDefault + private var address: () -> List = addressDefault - private var address: () -> List = addressDefault + private var mother: () -> Bird = motherDefault - private var mother: () -> Bird = motherDefault + private var father: () -> Bird? = fatherDefault - private var father: () -> Bird? = fatherDefault + private var parents: () -> List? = parentsDefault - private var parents: () -> List? = parentsDefault + @JsonProperty("id") + public fun withId(id: String): Builder = this.apply { + this.id = { id } + } - @JsonProperty("id") - public fun withId(id: String): Builder = this.apply { - this.id = { id } - } + @JsonProperty("name") + public fun withName(name: String?): Builder = this.apply { + this.name = { name } + } - @JsonProperty("name") - public fun withName(name: String?): Builder = this.apply { - this.name = { name } - } + @JsonProperty("address") + public fun withAddress(address: List): Builder = this.apply { + this.address = { address } + } - @JsonProperty("address") - public fun withAddress(address: List): Builder = this.apply { - this.address = { address } - } + @JsonProperty("mother") + public fun withMother(mother: Bird): Builder = this.apply { + this.mother = { mother } + } - @JsonProperty("mother") - public fun withMother(mother: Bird): Builder = this.apply { - this.mother = { mother } - } + @JsonProperty("father") + public fun withFather(father: Bird?): Builder = this.apply { + this.father = { father } + } - @JsonProperty("father") - public fun withFather(father: Bird?): Builder = this.apply { - this.father = { father } - } + @JsonProperty("parents") + public fun withParents(parents: List?): Builder = this.apply { + this.parents = { parents } + } - @JsonProperty("parents") - public fun withParents(parents: List?): Builder = this.apply { - this.parents = { parents } + public fun build(): Bird = Bird( + id = id, + name = name, + address = address, + mother = mother, + father = father, + parents = parents + ) } - - public fun build(): Bird = Bird( - id = id, - name = name, - address = address, - mother = mother, - father = father, - parents = parents, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/types/Dog.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/types/Dog.kt index 3f701e7fe..fd2235c2d 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/types/Dog.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/types/Dog.kt @@ -14,133 +14,121 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Dog.Builder::class) public class Dog( - id: () -> String = idDefault, - name: () -> String? = nameDefault, - address: () -> List = addressDefault, - mother: () -> Dog = motherDefault, - father: () -> Dog? = fatherDefault, - parents: () -> List? = parentsDefault, + id: () -> String = idDefault, + name: () -> String? = nameDefault, + address: () -> List = addressDefault, + mother: () -> Dog = motherDefault, + father: () -> Dog? = fatherDefault, + parents: () -> List? = parentsDefault ) : Pet { - private val _id: () -> String = id + private val _id: () -> String = id - private val _name: () -> String? = name + private val _name: () -> String? = name - private val _address: () -> List = address + private val _address: () -> List = address - private val _mother: () -> Dog = mother + private val _mother: () -> Dog = mother - private val _father: () -> Dog? = father + private val _father: () -> Dog? = father - private val _parents: () -> List? = parents + private val _parents: () -> List? = parents - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getId") - override val id: String - get() = _id.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getId") + override val id: String + get() = _id.invoke() - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getName") - override val name: String? - get() = _name.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getName") + override val name: String? + get() = _name.invoke() - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getAddress") - override val address: List - get() = _address.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getAddress") + override val address: List + get() = _address.invoke() - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getMother") - override val mother: Dog - get() = _mother.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getMother") + override val mother: Dog + get() = _mother.invoke() - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFather") - override val father: Dog? - get() = _father.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFather") + override val father: Dog? + get() = _father.invoke() - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getParents") - override val parents: List? - get() = _parents.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getParents") + override val parents: List? + get() = _parents.invoke() - public companion object { - private val idDefault: () -> String = - { throw IllegalStateException("Field `id` was not requested") } + public companion object { + private val idDefault: () -> String = { throw IllegalStateException("Field `id` was not requested") } + private val nameDefault: () -> String? = { throw IllegalStateException("Field `name` was not requested") } - private val nameDefault: () -> String? = - { throw IllegalStateException("Field `name` was not requested") } + private val addressDefault: () -> List = { throw IllegalStateException("Field `address` was not requested") } + private val motherDefault: () -> Dog = { throw IllegalStateException("Field `mother` was not requested") } - private val addressDefault: () -> List = - { throw IllegalStateException("Field `address` was not requested") } + private val fatherDefault: () -> Dog? = { throw IllegalStateException("Field `father` was not requested") } + private val parentsDefault: () -> List? = { throw IllegalStateException("Field `parents` was not requested") } + } - private val motherDefault: () -> Dog = - { throw IllegalStateException("Field `mother` was not requested") } - - - private val fatherDefault: () -> Dog? = - { throw IllegalStateException("Field `father` was not requested") } - - - private val parentsDefault: () -> List? = - { throw IllegalStateException("Field `parents` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var id: () -> String = idDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var id: () -> String = idDefault + private var name: () -> String? = nameDefault - private var name: () -> String? = nameDefault + private var address: () -> List = addressDefault - private var address: () -> List = addressDefault + private var mother: () -> Dog = motherDefault - private var mother: () -> Dog = motherDefault + private var father: () -> Dog? = fatherDefault - private var father: () -> Dog? = fatherDefault + private var parents: () -> List? = parentsDefault - private var parents: () -> List? = parentsDefault + @JsonProperty("id") + public fun withId(id: String): Builder = this.apply { + this.id = { id } + } - @JsonProperty("id") - public fun withId(id: String): Builder = this.apply { - this.id = { id } - } + @JsonProperty("name") + public fun withName(name: String?): Builder = this.apply { + this.name = { name } + } - @JsonProperty("name") - public fun withName(name: String?): Builder = this.apply { - this.name = { name } - } + @JsonProperty("address") + public fun withAddress(address: List): Builder = this.apply { + this.address = { address } + } - @JsonProperty("address") - public fun withAddress(address: List): Builder = this.apply { - this.address = { address } - } + @JsonProperty("mother") + public fun withMother(mother: Dog): Builder = this.apply { + this.mother = { mother } + } - @JsonProperty("mother") - public fun withMother(mother: Dog): Builder = this.apply { - this.mother = { mother } - } + @JsonProperty("father") + public fun withFather(father: Dog?): Builder = this.apply { + this.father = { father } + } - @JsonProperty("father") - public fun withFather(father: Dog?): Builder = this.apply { - this.father = { father } - } + @JsonProperty("parents") + public fun withParents(parents: List?): Builder = this.apply { + this.parents = { parents } + } - @JsonProperty("parents") - public fun withParents(parents: List?): Builder = this.apply { - this.parents = { parents } + public fun build(): Dog = Dog( + id = id, + name = name, + address = address, + mother = mother, + father = father, + parents = parents + ) } - - public fun build(): Dog = Dog( - id = id, - name = name, - address = address, - mother = mother, - father = father, - parents = parents, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/types/Pet.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/types/Pet.kt index 178fefcca..bf8a6be99 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/types/Pet.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFields/expected/types/Pet.kt @@ -8,36 +8,38 @@ import kotlin.collections.List import kotlin.jvm.JvmName @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" +) +@JsonSubTypes( + value = [ + JsonSubTypes.Type(value = Dog::class, name = "Dog"), + JsonSubTypes.Type(value = Bird::class, name = "Bird") + ] ) -@JsonSubTypes(value = [ - JsonSubTypes.Type(value = Dog::class, name = "Dog"), - JsonSubTypes.Type(value = Bird::class, name = "Bird") -]) public sealed interface Pet { - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getId") - public val id: String + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getId") + public val id: String - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getName") - public val name: String? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getName") + public val name: String? - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getAddress") - public val address: List + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getAddress") + public val address: List - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getMother") - public val mother: Pet + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getMother") + public val mother: Pet - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFather") - public val father: Pet? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFather") + public val father: Pet? - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getParents") - public val parents: List? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getParents") + public val parents: List? } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/DgsConstants.kt index 57deafc0c..5ac1165d1 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/DgsConstants.kt @@ -3,33 +3,33 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceClassWithInterfaceFieldsO import kotlin.String public object DgsConstants { - public object VEGETARIAN { - public const val TYPE_NAME: String = "Vegetarian" + public object VEGETARIAN { + public const val TYPE_NAME: String = "Vegetarian" - public const val Calories: String = "calories" + public const val Calories: String = "calories" - public const val Vegetables: String = "vegetables" - } + public const val Vegetables: String = "vegetables" + } - public object DOG { - public const val TYPE_NAME: String = "Dog" + public object DOG { + public const val TYPE_NAME: String = "Dog" - public const val Name: String = "name" + public const val Name: String = "name" - public const val Diet: String = "diet" - } + public const val Diet: String = "diet" + } - public object PET { - public const val TYPE_NAME: String = "Pet" + public object PET { + public const val TYPE_NAME: String = "Pet" - public const val Name: String = "name" + public const val Name: String = "name" - public const val Diet: String = "diet" - } + public const val Diet: String = "diet" + } - public object DIET { - public const val TYPE_NAME: String = "Diet" + public object DIET { + public const val TYPE_NAME: String = "Diet" - public const val Calories: String = "calories" - } + public const val Calories: String = "calories" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/client/DietProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/client/DietProjection.kt index d967b9881..2b5430e5a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/client/DietProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/client/DietProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceClassWithInterfaceFieldsO import com.netflix.graphql.dgs.codegen.GraphQLProjection public class DietProjection : GraphQLProjection() { - public val calories: DietProjection - get() { - field("calories") - return this - } + public val calories: DietProjection + get() { + field("calories") + return this + } - public fun onVegetarian(_projection: VegetarianProjection.() -> VegetarianProjection): - DietProjection { - fragment("Vegetarian", VegetarianProjection(), _projection) - return this - } + public fun onVegetarian(_projection: VegetarianProjection.() -> VegetarianProjection): + DietProjection { + fragment("Vegetarian", VegetarianProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/client/DogProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/client/DogProjection.kt index 69b67adda..01a121cf0 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/client/DogProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/client/DogProjection.kt @@ -3,14 +3,14 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceClassWithInterfaceFieldsO import com.netflix.graphql.dgs.codegen.GraphQLProjection public class DogProjection : GraphQLProjection() { - public val name: DogProjection - get() { - field("name") - return this - } + public val name: DogProjection + get() { + field("name") + return this + } - public fun diet(_projection: VegetarianProjection.() -> VegetarianProjection): DogProjection { - field("diet", VegetarianProjection(), _projection) - return this - } + public fun diet(_projection: VegetarianProjection.() -> VegetarianProjection): DogProjection { + field("diet", VegetarianProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/client/PetProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/client/PetProjection.kt index ef5e49202..420dfaec1 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/client/PetProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/client/PetProjection.kt @@ -3,19 +3,19 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceClassWithInterfaceFieldsO import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PetProjection : GraphQLProjection() { - public val name: PetProjection - get() { - field("name") - return this - } + public val name: PetProjection + get() { + field("name") + return this + } - public fun diet(_projection: DietProjection.() -> DietProjection): PetProjection { - field("diet", DietProjection(), _projection) - return this - } + public fun diet(_projection: DietProjection.() -> DietProjection): PetProjection { + field("diet", DietProjection(), _projection) + return this + } - public fun onDog(_projection: DogProjection.() -> DogProjection): PetProjection { - fragment("Dog", DogProjection(), _projection) - return this - } + public fun onDog(_projection: DogProjection.() -> DogProjection): PetProjection { + fragment("Dog", DogProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/client/VegetarianProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/client/VegetarianProjection.kt index 657b05895..a4fee8a57 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/client/VegetarianProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/client/VegetarianProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceClassWithInterfaceFieldsO import com.netflix.graphql.dgs.codegen.GraphQLProjection public class VegetarianProjection : GraphQLProjection() { - public val calories: VegetarianProjection - get() { - field("calories") - return this - } + public val calories: VegetarianProjection + get() { + field("calories") + return this + } - public val vegetables: VegetarianProjection - get() { - field("vegetables") - return this - } + public val vegetables: VegetarianProjection + get() { + field("vegetables") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/types/Diet.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/types/Diet.kt index 969a5e5d3..40f864c36 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/types/Diet.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/types/Diet.kt @@ -7,15 +7,17 @@ import kotlin.Suppress import kotlin.jvm.JvmName @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" +) +@JsonSubTypes( + value = [ + JsonSubTypes.Type(value = Vegetarian::class, name = "Vegetarian") + ] ) -@JsonSubTypes(value = [ - JsonSubTypes.Type(value = Vegetarian::class, name = "Vegetarian") -]) public sealed interface Diet { - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getCalories") - public val calories: String? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getCalories") + public val calories: String? } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/types/Dog.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/types/Dog.kt index e0410728b..757bcb2d3 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/types/Dog.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/types/Dog.kt @@ -13,53 +13,49 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Dog.Builder::class) public class Dog( - name: () -> String? = nameDefault, - diet: () -> Vegetarian? = dietDefault, + name: () -> String? = nameDefault, + diet: () -> Vegetarian? = dietDefault ) : Pet { - private val _name: () -> String? = name + private val _name: () -> String? = name - private val _diet: () -> Vegetarian? = diet + private val _diet: () -> Vegetarian? = diet - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getName") - override val name: String? - get() = _name.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getName") + override val name: String? + get() = _name.invoke() - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getDiet") - override val diet: Vegetarian? - get() = _diet.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getDiet") + override val diet: Vegetarian? + get() = _diet.invoke() - public companion object { - private val nameDefault: () -> String? = - { throw IllegalStateException("Field `name` was not requested") } + public companion object { + private val nameDefault: () -> String? = { throw IllegalStateException("Field `name` was not requested") } + private val dietDefault: () -> Vegetarian? = { throw IllegalStateException("Field `diet` was not requested") } + } - private val dietDefault: () -> Vegetarian? = - { throw IllegalStateException("Field `diet` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var name: () -> String? = nameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var name: () -> String? = nameDefault + private var diet: () -> Vegetarian? = dietDefault - private var diet: () -> Vegetarian? = dietDefault + @JsonProperty("name") + public fun withName(name: String?): Builder = this.apply { + this.name = { name } + } - @JsonProperty("name") - public fun withName(name: String?): Builder = this.apply { - this.name = { name } - } + @JsonProperty("diet") + public fun withDiet(diet: Vegetarian?): Builder = this.apply { + this.diet = { diet } + } - @JsonProperty("diet") - public fun withDiet(diet: Vegetarian?): Builder = this.apply { - this.diet = { diet } + public fun build(): Dog = Dog( + name = name, + diet = diet + ) } - - public fun build(): Dog = Dog( - name = name, - diet = diet, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/types/Pet.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/types/Pet.kt index 567bad193..38c342291 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/types/Pet.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/types/Pet.kt @@ -7,19 +7,21 @@ import kotlin.Suppress import kotlin.jvm.JvmName @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" +) +@JsonSubTypes( + value = [ + JsonSubTypes.Type(value = Dog::class, name = "Dog") + ] ) -@JsonSubTypes(value = [ - JsonSubTypes.Type(value = Dog::class, name = "Dog") -]) public sealed interface Pet { - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getName") - public val name: String? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getName") + public val name: String? - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getDiet") - public val diet: Diet? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getDiet") + public val diet: Diet? } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/types/Vegetarian.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/types/Vegetarian.kt index 393dcedc7..2bd782342 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/types/Vegetarian.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithInterfaceFieldsOfDifferentType/expected/types/Vegetarian.kt @@ -14,52 +14,48 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Vegetarian.Builder::class) public class Vegetarian( - calories: () -> String? = caloriesDefault, - vegetables: () -> List? = vegetablesDefault, + calories: () -> String? = caloriesDefault, + vegetables: () -> List? = vegetablesDefault ) : Diet { - private val _calories: () -> String? = calories + private val _calories: () -> String? = calories - private val _vegetables: () -> List? = vegetables + private val _vegetables: () -> List? = vegetables - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getCalories") - override val calories: String? - get() = _calories.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getCalories") + override val calories: String? + get() = _calories.invoke() - @get:JvmName("getVegetables") - public val vegetables: List? - get() = _vegetables.invoke() + @get:JvmName("getVegetables") + public val vegetables: List? + get() = _vegetables.invoke() - public companion object { - private val caloriesDefault: () -> String? = - { throw IllegalStateException("Field `calories` was not requested") } + public companion object { + private val caloriesDefault: () -> String? = { throw IllegalStateException("Field `calories` was not requested") } + private val vegetablesDefault: () -> List? = { throw IllegalStateException("Field `vegetables` was not requested") } + } - private val vegetablesDefault: () -> List? = - { throw IllegalStateException("Field `vegetables` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var calories: () -> String? = caloriesDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var calories: () -> String? = caloriesDefault + private var vegetables: () -> List? = vegetablesDefault - private var vegetables: () -> List? = vegetablesDefault + @JsonProperty("calories") + public fun withCalories(calories: String?): Builder = this.apply { + this.calories = { calories } + } - @JsonProperty("calories") - public fun withCalories(calories: String?): Builder = this.apply { - this.calories = { calories } - } + @JsonProperty("vegetables") + public fun withVegetables(vegetables: List?): Builder = this.apply { + this.vegetables = { vegetables } + } - @JsonProperty("vegetables") - public fun withVegetables(vegetables: List?): Builder = this.apply { - this.vegetables = { vegetables } + public fun build(): Vegetarian = Vegetarian( + calories = calories, + vegetables = vegetables + ) } - - public fun build(): Vegetarian = Vegetarian( - calories = calories, - vegetables = vegetables, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/DgsClient.kt index 10a4a2f38..8cb1f010b 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/DgsConstants.kt index 7d2d372d0..20df4add0 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/DgsConstants.kt @@ -3,29 +3,29 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceClassWithNonNullableField import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val People: String = "people" - } + public const val People: String = "people" + } - public object EMPLOYEE { - public const val TYPE_NAME: String = "Employee" + public object EMPLOYEE { + public const val TYPE_NAME: String = "Employee" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Lastname: String = "lastname" + public const val Lastname: String = "lastname" - public const val Company: String = "company" - } + public const val Company: String = "company" + } - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Lastname: String = "lastname" - } + public const val Lastname: String = "lastname" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/client/EmployeeProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/client/EmployeeProjection.kt index 1076e0504..66b3715a9 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/client/EmployeeProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/client/EmployeeProjection.kt @@ -3,21 +3,21 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceClassWithNonNullableField import com.netflix.graphql.dgs.codegen.GraphQLProjection public class EmployeeProjection : GraphQLProjection() { - public val firstname: EmployeeProjection - get() { - field("firstname") - return this - } + public val firstname: EmployeeProjection + get() { + field("firstname") + return this + } - public val lastname: EmployeeProjection - get() { - field("lastname") - return this - } + public val lastname: EmployeeProjection + get() { + field("lastname") + return this + } - public val company: EmployeeProjection - get() { - field("company") - return this - } + public val company: EmployeeProjection + get() { + field("company") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/client/PersonProjection.kt index ef7b3cc25..3825f5d54 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/client/PersonProjection.kt @@ -3,21 +3,21 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceClassWithNonNullableField import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val firstname: PersonProjection - get() { - field("firstname") - return this - } + public val firstname: PersonProjection + get() { + field("firstname") + return this + } - public val lastname: PersonProjection - get() { - field("lastname") - return this - } + public val lastname: PersonProjection + get() { + field("lastname") + return this + } - public fun onEmployee(_projection: EmployeeProjection.() -> EmployeeProjection): - PersonProjection { - fragment("Employee", EmployeeProjection(), _projection) - return this - } + public fun onEmployee(_projection: EmployeeProjection.() -> EmployeeProjection): + PersonProjection { + fragment("Employee", EmployeeProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/client/QueryProjection.kt index 0bc6afdf1..4336a3f50 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/client/QueryProjection.kt @@ -3,8 +3,8 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceClassWithNonNullableField import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("people", PersonProjection(), _projection) - return this - } + public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { + field("people", PersonProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/types/Employee.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/types/Employee.kt index d14d5d3e7..0e9576904 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/types/Employee.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/types/Employee.kt @@ -13,72 +13,66 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Employee.Builder::class) public class Employee( - firstname: () -> String = firstnameDefault, - lastname: () -> String? = lastnameDefault, - company: () -> String? = companyDefault, + firstname: () -> String = firstnameDefault, + lastname: () -> String? = lastnameDefault, + company: () -> String? = companyDefault ) : Person { - private val _firstname: () -> String = firstname + private val _firstname: () -> String = firstname - private val _lastname: () -> String? = lastname + private val _lastname: () -> String? = lastname - private val _company: () -> String? = company + private val _company: () -> String? = company - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFirstname") - override val firstname: String - get() = _firstname.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFirstname") + override val firstname: String + get() = _firstname.invoke() - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getLastname") - override val lastname: String? - get() = _lastname.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getLastname") + override val lastname: String? + get() = _lastname.invoke() - @get:JvmName("getCompany") - public val company: String? - get() = _company.invoke() + @get:JvmName("getCompany") + public val company: String? + get() = _company.invoke() - public companion object { - private val firstnameDefault: () -> String = - { throw IllegalStateException("Field `firstname` was not requested") } + public companion object { + private val firstnameDefault: () -> String = { throw IllegalStateException("Field `firstname` was not requested") } + private val lastnameDefault: () -> String? = { throw IllegalStateException("Field `lastname` was not requested") } - private val lastnameDefault: () -> String? = - { throw IllegalStateException("Field `lastname` was not requested") } - - - private val companyDefault: () -> String? = - { throw IllegalStateException("Field `company` was not requested") } + private val companyDefault: () -> String? = { throw IllegalStateException("Field `company` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var firstname: () -> String = firstnameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var firstname: () -> String = firstnameDefault + private var lastname: () -> String? = lastnameDefault - private var lastname: () -> String? = lastnameDefault + private var company: () -> String? = companyDefault - private var company: () -> String? = companyDefault + @JsonProperty("firstname") + public fun withFirstname(firstname: String): Builder = this.apply { + this.firstname = { firstname } + } - @JsonProperty("firstname") - public fun withFirstname(firstname: String): Builder = this.apply { - this.firstname = { firstname } - } + @JsonProperty("lastname") + public fun withLastname(lastname: String?): Builder = this.apply { + this.lastname = { lastname } + } - @JsonProperty("lastname") - public fun withLastname(lastname: String?): Builder = this.apply { - this.lastname = { lastname } - } + @JsonProperty("company") + public fun withCompany(company: String?): Builder = this.apply { + this.company = { company } + } - @JsonProperty("company") - public fun withCompany(company: String?): Builder = this.apply { - this.company = { company } + public fun build(): Employee = Employee( + firstname = firstname, + lastname = lastname, + company = company + ) } - - public fun build(): Employee = Employee( - firstname = firstname, - lastname = lastname, - company = company, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/types/Person.kt index d897d964c..0174c9a41 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/types/Person.kt @@ -7,19 +7,21 @@ import kotlin.Suppress import kotlin.jvm.JvmName @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" +) +@JsonSubTypes( + value = [ + JsonSubTypes.Type(value = Employee::class, name = "Employee") + ] ) -@JsonSubTypes(value = [ - JsonSubTypes.Type(value = Employee::class, name = "Employee") -]) public sealed interface Person { - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFirstname") - public val firstname: String + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFirstname") + public val firstname: String - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getLastname") - public val lastname: String? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getLastname") + public val lastname: String? } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/types/Query.kt index f32c05ada..4fdd8d970 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceClassWithNonNullableFields/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - people: () -> List? = peopleDefault, + people: () -> List? = peopleDefault ) { - private val _people: () -> List? = people + private val _people: () -> List? = people - @get:JvmName("getPeople") - public val people: List? - get() = _people.invoke() + @get:JvmName("getPeople") + public val people: List? + get() = _people.invoke() - public companion object { - private val peopleDefault: () -> List? = - { throw IllegalStateException("Field `people` was not requested") } + public companion object { + private val peopleDefault: () -> List? = { throw IllegalStateException("Field `people` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var people: () -> List? = peopleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var people: () -> List? = peopleDefault + @JsonProperty("people") + public fun withPeople(people: List?): Builder = this.apply { + this.people = { people } + } - @JsonProperty("people") - public fun withPeople(people: List?): Builder = this.apply { - this.people = { people } + public fun build(): Query = Query( + people = people + ) } - - public fun build(): Query = Query( - people = people, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceDocs/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceDocs/expected/DgsConstants.kt index b9161d2d0..3b750d73d 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceDocs/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceDocs/expected/DgsConstants.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceDocs.expected import kotlin.String public object DgsConstants { - public object TITLED { - public const val TYPE_NAME: String = "Titled" + public object TITLED { + public const val TYPE_NAME: String = "Titled" - public const val Title: String = "title" - } + public const val Title: String = "title" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceDocs/expected/client/TitledProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceDocs/expected/client/TitledProjection.kt index 9766b6beb..4420d85a2 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceDocs/expected/client/TitledProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceDocs/expected/client/TitledProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceDocs.expected.client import com.netflix.graphql.dgs.codegen.GraphQLProjection public class TitledProjection : GraphQLProjection() { - public val title: TitledProjection - get() { - field("title") - return this - } + public val title: TitledProjection + get() { + field("title") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceDocs/expected/types/Titled.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceDocs/expected/types/Titled.kt index 2b7cea2f0..8341da74d 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceDocs/expected/types/Titled.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceDocs/expected/types/Titled.kt @@ -9,12 +9,12 @@ import kotlin.jvm.JvmName * Anything with a title! */ @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" ) public sealed interface Titled { - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getTitle") - public val title: String? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getTitle") + public val title: String? } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceFieldsDocs/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceFieldsDocs/expected/DgsConstants.kt index 9a263822e..11a269392 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceFieldsDocs/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceFieldsDocs/expected/DgsConstants.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceFieldsDocs.expected import kotlin.String public object DgsConstants { - public object TITLED { - public const val TYPE_NAME: String = "Titled" + public object TITLED { + public const val TYPE_NAME: String = "Titled" - public const val Title: String = "title" - } + public const val Title: String = "title" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceFieldsDocs/expected/client/TitledProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceFieldsDocs/expected/client/TitledProjection.kt index b61c94cc2..897a720a9 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceFieldsDocs/expected/client/TitledProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceFieldsDocs/expected/client/TitledProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceFieldsDocs.expected.clien import com.netflix.graphql.dgs.codegen.GraphQLProjection public class TitledProjection : GraphQLProjection() { - public val title: TitledProjection - get() { - field("title") - return this - } + public val title: TitledProjection + get() { + field("title") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceFieldsDocs/expected/types/Titled.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceFieldsDocs/expected/types/Titled.kt index 77392d68b..77df31062 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceFieldsDocs/expected/types/Titled.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceFieldsDocs/expected/types/Titled.kt @@ -6,15 +6,15 @@ import kotlin.Suppress import kotlin.jvm.JvmName @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" ) public sealed interface Titled { - /** - * The original, non localized title. - */ - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getTitle") - public val title: String? + /** + * The original, non localized title. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getTitle") + public val title: String? } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/DgsClient.kt index d2f43db68..b67a7f37c 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/DgsConstants.kt index f3f71371b..d746f2910 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/DgsConstants.kt @@ -3,31 +3,31 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceWithInterfaceInheritance. import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Fruits: String = "fruits" - } + public const val Fruits: String = "fruits" + } - public object SEED { - public const val TYPE_NAME: String = "Seed" + public object SEED { + public const val TYPE_NAME: String = "Seed" - public const val Name: String = "name" - } + public const val Name: String = "name" + } - public object FRUIT { - public const val TYPE_NAME: String = "Fruit" + public object FRUIT { + public const val TYPE_NAME: String = "Fruit" - public const val Seeds: String = "seeds" - } + public const val Seeds: String = "seeds" + } - public object STONEFRUIT { - public const val TYPE_NAME: String = "StoneFruit" + public object STONEFRUIT { + public const val TYPE_NAME: String = "StoneFruit" - public const val Seeds: String = "seeds" + public const val Seeds: String = "seeds" - public const val Fuzzy: String = "fuzzy" - } + public const val Fuzzy: String = "fuzzy" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/client/FruitProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/client/FruitProjection.kt index 2a87b5b0c..d9529044b 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/client/FruitProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/client/FruitProjection.kt @@ -3,14 +3,14 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceWithInterfaceInheritance. import com.netflix.graphql.dgs.codegen.GraphQLProjection public class FruitProjection : GraphQLProjection() { - public fun seeds(_projection: SeedProjection.() -> SeedProjection): FruitProjection { - field("seeds", SeedProjection(), _projection) - return this - } + public fun seeds(_projection: SeedProjection.() -> SeedProjection): FruitProjection { + field("seeds", SeedProjection(), _projection) + return this + } - public fun onStoneFruit(_projection: StoneFruitProjection.() -> StoneFruitProjection): - FruitProjection { - fragment("StoneFruit", StoneFruitProjection(), _projection) - return this - } + public fun onStoneFruit(_projection: StoneFruitProjection.() -> StoneFruitProjection): + FruitProjection { + fragment("StoneFruit", StoneFruitProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/client/QueryProjection.kt index 3abf122d1..d92486ce4 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/client/QueryProjection.kt @@ -3,8 +3,8 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceWithInterfaceInheritance. import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun fruits(_projection: FruitProjection.() -> FruitProjection): QueryProjection { - field("fruits", FruitProjection(), _projection) - return this - } + public fun fruits(_projection: FruitProjection.() -> FruitProjection): QueryProjection { + field("fruits", FruitProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/client/SeedProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/client/SeedProjection.kt index 8a423643b..6cb95182e 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/client/SeedProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/client/SeedProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceWithInterfaceInheritance. import com.netflix.graphql.dgs.codegen.GraphQLProjection public class SeedProjection : GraphQLProjection() { - public val name: SeedProjection - get() { - field("name") - return this - } + public val name: SeedProjection + get() { + field("name") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/client/StoneFruitProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/client/StoneFruitProjection.kt index f73f5f500..61639b019 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/client/StoneFruitProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/client/StoneFruitProjection.kt @@ -3,14 +3,14 @@ package com.netflix.graphql.dgs.codegen.cases.interfaceWithInterfaceInheritance. import com.netflix.graphql.dgs.codegen.GraphQLProjection public class StoneFruitProjection : GraphQLProjection() { - public val fuzzy: StoneFruitProjection - get() { - field("fuzzy") - return this - } + public val fuzzy: StoneFruitProjection + get() { + field("fuzzy") + return this + } - public fun seeds(_projection: SeedProjection.() -> SeedProjection): StoneFruitProjection { - field("seeds", SeedProjection(), _projection) - return this - } + public fun seeds(_projection: SeedProjection.() -> SeedProjection): StoneFruitProjection { + field("seeds", SeedProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/types/Fruit.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/types/Fruit.kt index b3d9cec4a..44ba83f68 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/types/Fruit.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/types/Fruit.kt @@ -6,12 +6,12 @@ import kotlin.collections.List import kotlin.jvm.JvmName @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" ) public sealed interface Fruit { - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getSeeds") - public val seeds: List? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getSeeds") + public val seeds: List? } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/types/Query.kt index 8abc2fab7..126992c75 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - fruits: () -> List? = fruitsDefault, + fruits: () -> List? = fruitsDefault ) { - private val _fruits: () -> List? = fruits + private val _fruits: () -> List? = fruits - @get:JvmName("getFruits") - public val fruits: List? - get() = _fruits.invoke() + @get:JvmName("getFruits") + public val fruits: List? + get() = _fruits.invoke() - public companion object { - private val fruitsDefault: () -> List? = - { throw IllegalStateException("Field `fruits` was not requested") } + public companion object { + private val fruitsDefault: () -> List? = { throw IllegalStateException("Field `fruits` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var fruits: () -> List? = fruitsDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var fruits: () -> List? = fruitsDefault + @JsonProperty("fruits") + public fun withFruits(fruits: List?): Builder = this.apply { + this.fruits = { fruits } + } - @JsonProperty("fruits") - public fun withFruits(fruits: List?): Builder = this.apply { - this.fruits = { fruits } + public fun build(): Query = Query( + fruits = fruits + ) } - - public fun build(): Query = Query( - fruits = fruits, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/types/Seed.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/types/Seed.kt index 5753c7835..ff184045a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/types/Seed.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/types/Seed.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Seed.Builder::class) public class Seed( - name: () -> String? = nameDefault, + name: () -> String? = nameDefault ) { - private val _name: () -> String? = name + private val _name: () -> String? = name - @get:JvmName("getName") - public val name: String? - get() = _name.invoke() + @get:JvmName("getName") + public val name: String? + get() = _name.invoke() - public companion object { - private val nameDefault: () -> String? = - { throw IllegalStateException("Field `name` was not requested") } + public companion object { + private val nameDefault: () -> String? = { throw IllegalStateException("Field `name` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var name: () -> String? = nameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var name: () -> String? = nameDefault + @JsonProperty("name") + public fun withName(name: String?): Builder = this.apply { + this.name = { name } + } - @JsonProperty("name") - public fun withName(name: String?): Builder = this.apply { - this.name = { name } + public fun build(): Seed = Seed( + name = name + ) } - - public fun build(): Seed = Seed( - name = name, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/types/StoneFruit.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/types/StoneFruit.kt index c4141bea4..8a2694513 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/types/StoneFruit.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithInterfaceInheritance/expected/types/StoneFruit.kt @@ -7,16 +7,16 @@ import kotlin.collections.List import kotlin.jvm.JvmName @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" ) public sealed interface StoneFruit : Fruit { - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getSeeds") - override val seeds: List? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getSeeds") + override val seeds: List? - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFuzzy") - public val fuzzy: Boolean? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFuzzy") + public val fuzzy: Boolean? } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/DgsClient.kt index 36bc94ef4..83b7d0d1e 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/DgsConstants.kt index 13f93803f..69fb7513e 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/DgsConstants.kt @@ -3,13 +3,13 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithEnum.expected import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val E: String = "e" + public const val E: String = "e" - public const val Es: String = "es" - } + public const val Es: String = "es" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/client/QueryProjection.kt index ec23c0faa..193d8cddd 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/client/QueryProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithEnum.expected.client import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public val e: QueryProjection - get() { - field("e") - return this - } + public val e: QueryProjection + get() { + field("e") + return this + } - public val es: QueryProjection - get() { - field("es") - return this - } + public val es: QueryProjection + get() { + field("es") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/types/E.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/types/E.kt index 9de42a388..feea78bd5 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/types/E.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/types/E.kt @@ -1,5 +1,5 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithEnum.expected.types public enum class E { - V, + V, } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/types/Query.kt index 58ee64111..34bfe2387 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithEnum/expected/types/Query.kt @@ -12,51 +12,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - e: () -> E? = eDefault, - es: () -> List? = esDefault, + e: () -> E? = eDefault, + es: () -> List? = esDefault ) { - private val _e: () -> E? = e + private val _e: () -> E? = e - private val _es: () -> List? = es + private val _es: () -> List? = es - @get:JvmName("getE") - public val e: E? - get() = _e.invoke() + @get:JvmName("getE") + public val e: E? + get() = _e.invoke() - @get:JvmName("getEs") - public val es: List? - get() = _es.invoke() + @get:JvmName("getEs") + public val es: List? + get() = _es.invoke() - public companion object { - private val eDefault: () -> E? = - { throw IllegalStateException("Field `e` was not requested") } + public companion object { + private val eDefault: () -> E? = { throw IllegalStateException("Field `e` was not requested") } + private val esDefault: () -> List? = { throw IllegalStateException("Field `es` was not requested") } + } - private val esDefault: () -> List? = - { throw IllegalStateException("Field `es` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var e: () -> E? = eDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var e: () -> E? = eDefault + private var es: () -> List? = esDefault - private var es: () -> List? = esDefault + @JsonProperty("e") + public fun withE(e: E?): Builder = this.apply { + this.e = { e } + } - @JsonProperty("e") - public fun withE(e: E?): Builder = this.apply { - this.e = { e } - } + @JsonProperty("es") + public fun withEs(es: List?): Builder = this.apply { + this.es = { es } + } - @JsonProperty("es") - public fun withEs(es: List?): Builder = this.apply { - this.es = { es } + public fun build(): Query = Query( + e = e, + es = es + ) } - - public fun build(): Query = Query( - e = e, - es = es, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/DgsClient.kt index 28e9e2cf1..f9a950011 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/DgsConstants.kt index 1f964d375..6855e53fc 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/DgsConstants.kt @@ -3,41 +3,41 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithNestedInputs.expecte import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Q1: String = "q1" + public const val Q1: String = "q1" - public const val Q2: String = "q2" + public const val Q2: String = "q2" - public object Q1_INPUT_ARGUMENT { - public const val Arg1: String = "arg1" + public object Q1_INPUT_ARGUMENT { + public const val Arg1: String = "arg1" - public const val Arg2: String = "arg2" - } + public const val Arg2: String = "arg2" + } - public object Q2_INPUT_ARGUMENT { - public const val Arg1: String = "arg1" + public object Q2_INPUT_ARGUMENT { + public const val Arg1: String = "arg1" - public const val Arg2: String = "arg2" + public const val Arg2: String = "arg2" + } } - } - public object I1 { - public const val TYPE_NAME: String = "I1" + public object I1 { + public const val TYPE_NAME: String = "I1" - public const val Arg1: String = "arg1" + public const val Arg1: String = "arg1" - public const val Arg2: String = "arg2" - } + public const val Arg2: String = "arg2" + } - public object I2 { - public const val TYPE_NAME: String = "I2" + public object I2 { + public const val TYPE_NAME: String = "I2" - public const val Arg1: String = "arg1" + public const val Arg1: String = "arg1" - public const val Arg2: String = "arg2" - } + public const val Arg2: String = "arg2" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/client/QueryProjection.kt index 2822d4df0..ec5810267 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/client/QueryProjection.kt @@ -6,15 +6,21 @@ import com.netflix.graphql.dgs.codegen.cases.projectionWithNestedInputs.expected import kotlin.String public class QueryProjection : GraphQLProjection() { - public fun q1(arg1: String? = default("arg1"), arg2: I2? = - default("arg2")): QueryProjection { - field("q1", "arg1" to arg1 , "arg2" to arg2) - return this - } + public fun q1( + arg1: String? = default("arg1"), + arg2: I2? = + default("arg2") + ): QueryProjection { + field("q1", "arg1" to arg1, "arg2" to arg2) + return this + } - public fun q2(arg1: I1? = default("arg1"), arg2: String? = - default("arg2")): QueryProjection { - field("q2", "arg1" to arg1 , "arg2" to arg2) - return this - } + public fun q2( + arg1: I1? = default("arg1"), + arg2: String? = + default("arg2") + ): QueryProjection { + field("q2", "arg1" to arg1, "arg2" to arg2) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/types/I1.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/types/I1.kt index 3d4d860c0..3d5fd0f58 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/types/I1.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/types/I1.kt @@ -7,8 +7,8 @@ import kotlin.String import kotlin.collections.List public class I1( - public val arg1: I1? = default("arg1"), - public val arg2: I2? = default("arg2"), + public val arg1: I1? = default("arg1"), + public val arg2: I2? = default("arg2") ) : GraphQLInput() { - override fun fields(): List> = listOf("arg1" to arg1, "arg2" to arg2) + override fun fields(): List> = listOf("arg1" to arg1, "arg2" to arg2) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/types/I2.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/types/I2.kt index 8de341675..54552813a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/types/I2.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/types/I2.kt @@ -7,8 +7,8 @@ import kotlin.String import kotlin.collections.List public class I2( - public val arg1: String? = default("arg1"), - public val arg2: String? = default("arg2"), + public val arg1: String? = default("arg1"), + public val arg2: String? = default("arg2") ) : GraphQLInput() { - override fun fields(): List> = listOf("arg1" to arg1, "arg2" to arg2) + override fun fields(): List> = listOf("arg1" to arg1, "arg2" to arg2) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/types/Query.kt index 531cd0386..74ca4347e 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithNestedInputs/expected/types/Query.kt @@ -12,51 +12,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - q1: () -> String? = q1Default, - q2: () -> String? = q2Default, + q1: () -> String? = q1Default, + q2: () -> String? = q2Default ) { - private val _q1: () -> String? = q1 + private val _q1: () -> String? = q1 - private val _q2: () -> String? = q2 + private val _q2: () -> String? = q2 - @get:JvmName("getQ1") - public val q1: String? - get() = _q1.invoke() + @get:JvmName("getQ1") + public val q1: String? + get() = _q1.invoke() - @get:JvmName("getQ2") - public val q2: String? - get() = _q2.invoke() + @get:JvmName("getQ2") + public val q2: String? + get() = _q2.invoke() - public companion object { - private val q1Default: () -> String? = - { throw IllegalStateException("Field `q1` was not requested") } + public companion object { + private val q1Default: () -> String? = { throw IllegalStateException("Field `q1` was not requested") } + private val q2Default: () -> String? = { throw IllegalStateException("Field `q2` was not requested") } + } - private val q2Default: () -> String? = - { throw IllegalStateException("Field `q2` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var q1: () -> String? = q1Default - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var q1: () -> String? = q1Default + private var q2: () -> String? = q2Default - private var q2: () -> String? = q2Default + @JsonProperty("q1") + public fun withQ1(q1: String?): Builder = this.apply { + this.q1 = { q1 } + } - @JsonProperty("q1") - public fun withQ1(q1: String?): Builder = this.apply { - this.q1 = { q1 } - } + @JsonProperty("q2") + public fun withQ2(q2: String?): Builder = this.apply { + this.q2 = { q2 } + } - @JsonProperty("q2") - public fun withQ2(q2: String?): Builder = this.apply { - this.q2 = { q2 } + public fun build(): Query = Query( + q1 = q1, + q2 = q2 + ) } - - public fun build(): Query = Query( - q1 = q1, - q2 = q2, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/DgsClient.kt index 5f44888d6..e5fa48d4f 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/DgsConstants.kt index 62ca4ec57..4013ae2f3 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/DgsConstants.kt @@ -3,25 +3,25 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithPrimitiveAndArgs.exp import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val String: String = "string" + public const val String: String = "string" - public object STRING_INPUT_ARGUMENT { - public const val A1: String = "a1" + public object STRING_INPUT_ARGUMENT { + public const val A1: String = "a1" - public const val A2: String = "a2" + public const val A2: String = "a2" - public const val A3: String = "a3" + public const val A3: String = "a3" + } } - } - public object I { - public const val TYPE_NAME: String = "I" + public object I { + public const val TYPE_NAME: String = "I" - public const val Arg: String = "arg" - } + public const val Arg: String = "arg" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/client/QueryProjection.kt index 719963754..8a1d693fc 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/client/QueryProjection.kt @@ -5,12 +5,12 @@ import com.netflix.graphql.dgs.codegen.cases.projectionWithPrimitiveAndArgs.expe import kotlin.String public class QueryProjection : GraphQLProjection() { - public fun string( - a1: String? = default("a1"), - a2: String, - a3: I? = default("a3"), - ): QueryProjection { - field("string", "a1" to a1 , "a2" to a2 , "a3" to a3) - return this - } + public fun string( + a1: String? = default("a1"), + a2: String, + a3: I? = default("a3") + ): QueryProjection { + field("string", "a1" to a1, "a2" to a2, "a3" to a3) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/types/I.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/types/I.kt index 6304f9111..4b6355de7 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/types/I.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/types/I.kt @@ -7,7 +7,7 @@ import kotlin.String import kotlin.collections.List public class I( - public val arg: String? = default("arg"), + public val arg: String? = default("arg") ) : GraphQLInput() { - override fun fields(): List> = listOf("arg" to arg) + override fun fields(): List> = listOf("arg" to arg) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/types/Query.kt index 12f2b1d25..5d9036ae1 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitiveAndArgs/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - string: () -> String? = stringDefault, + string: () -> String? = stringDefault ) { - private val _string: () -> String? = string + private val _string: () -> String? = string - @get:JvmName("getString") - public val string: String? - get() = _string.invoke() + @get:JvmName("getString") + public val string: String? + get() = _string.invoke() - public companion object { - private val stringDefault: () -> String? = - { throw IllegalStateException("Field `string` was not requested") } + public companion object { + private val stringDefault: () -> String? = { throw IllegalStateException("Field `string` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var string: () -> String? = stringDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var string: () -> String? = stringDefault + @JsonProperty("string") + public fun withString(string: String?): Builder = this.apply { + this.string = { string } + } - @JsonProperty("string") - public fun withString(string: String?): Builder = this.apply { - this.string = { string } + public fun build(): Query = Query( + string = string + ) } - - public fun build(): Query = Query( - string = string, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitives/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitives/expected/DgsClient.kt index 084871bbd..1d4d2efe6 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitives/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitives/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitives/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitives/expected/DgsConstants.kt index 261ed06ad..ce449e9f4 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitives/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitives/expected/DgsConstants.kt @@ -3,13 +3,13 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithPrimitives.expected import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val String: String = "string" + public const val String: String = "string" - public const val Strings: String = "strings" - } + public const val Strings: String = "strings" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitives/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitives/expected/client/QueryProjection.kt index 7abd88b88..d1e65328b 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitives/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitives/expected/client/QueryProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithPrimitives.expected. import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public val string: QueryProjection - get() { - field("string") - return this - } + public val string: QueryProjection + get() { + field("string") + return this + } - public val strings: QueryProjection - get() { - field("strings") - return this - } + public val strings: QueryProjection + get() { + field("strings") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitives/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitives/expected/types/Query.kt index 294d64fb3..af8b8a563 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitives/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithPrimitives/expected/types/Query.kt @@ -13,51 +13,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - string: () -> String? = stringDefault, - strings: () -> List? = stringsDefault, + string: () -> String? = stringDefault, + strings: () -> List? = stringsDefault ) { - private val _string: () -> String? = string + private val _string: () -> String? = string - private val _strings: () -> List? = strings + private val _strings: () -> List? = strings - @get:JvmName("getString") - public val string: String? - get() = _string.invoke() + @get:JvmName("getString") + public val string: String? + get() = _string.invoke() - @get:JvmName("getStrings") - public val strings: List? - get() = _strings.invoke() + @get:JvmName("getStrings") + public val strings: List? + get() = _strings.invoke() - public companion object { - private val stringDefault: () -> String? = - { throw IllegalStateException("Field `string` was not requested") } + public companion object { + private val stringDefault: () -> String? = { throw IllegalStateException("Field `string` was not requested") } + private val stringsDefault: () -> List? = { throw IllegalStateException("Field `strings` was not requested") } + } - private val stringsDefault: () -> List? = - { throw IllegalStateException("Field `strings` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var string: () -> String? = stringDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var string: () -> String? = stringDefault + private var strings: () -> List? = stringsDefault - private var strings: () -> List? = stringsDefault + @JsonProperty("string") + public fun withString(string: String?): Builder = this.apply { + this.string = { string } + } - @JsonProperty("string") - public fun withString(string: String?): Builder = this.apply { - this.string = { string } - } + @JsonProperty("strings") + public fun withStrings(strings: List?): Builder = this.apply { + this.strings = { strings } + } - @JsonProperty("strings") - public fun withStrings(strings: List?): Builder = this.apply { - this.strings = { strings } + public fun build(): Query = Query( + string = string, + strings = strings + ) } - - public fun build(): Query = Query( - string = string, - strings = strings, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/DgsClient.kt index a28d05258..f3f5d74ac 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/DgsConstants.kt index 1d0deb6a0..4caf47c36 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/DgsConstants.kt @@ -3,27 +3,27 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithType.expected import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Person: String = "person" + public const val Person: String = "person" - public const val People: String = "people" - } + public const val People: String = "people" + } - public object EMPLOYEE { - public const val TYPE_NAME: String = "Employee" + public object EMPLOYEE { + public const val TYPE_NAME: String = "Employee" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Company: String = "company" - } + public const val Company: String = "company" + } - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Firstname: String = "firstname" - } + public const val Firstname: String = "firstname" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/client/EmployeeProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/client/EmployeeProjection.kt index 7f3ca171f..1a4bf3695 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/client/EmployeeProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/client/EmployeeProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithType.expected.client import com.netflix.graphql.dgs.codegen.GraphQLProjection public class EmployeeProjection : GraphQLProjection() { - public val firstname: EmployeeProjection - get() { - field("firstname") - return this - } + public val firstname: EmployeeProjection + get() { + field("firstname") + return this + } - public val company: EmployeeProjection - get() { - field("company") - return this - } + public val company: EmployeeProjection + get() { + field("company") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/client/PersonProjection.kt index c173fa278..8daf34d7b 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/client/PersonProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithType.expected.client import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val firstname: PersonProjection - get() { - field("firstname") - return this - } + public val firstname: PersonProjection + get() { + field("firstname") + return this + } - public fun onEmployee(_projection: EmployeeProjection.() -> EmployeeProjection): - PersonProjection { - fragment("Employee", EmployeeProjection(), _projection) - return this - } + public fun onEmployee(_projection: EmployeeProjection.() -> EmployeeProjection): + PersonProjection { + fragment("Employee", EmployeeProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/client/QueryProjection.kt index 50265e47e..67be43d31 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/client/QueryProjection.kt @@ -3,13 +3,13 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithType.expected.client import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun person(_projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("person", PersonProjection(), _projection) - return this - } + public fun person(_projection: PersonProjection.() -> PersonProjection): QueryProjection { + field("person", PersonProjection(), _projection) + return this + } - public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { - field("people", PersonProjection(), _projection) - return this - } + public fun people(_projection: PersonProjection.() -> PersonProjection): QueryProjection { + field("people", PersonProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/types/Employee.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/types/Employee.kt index 24a71113b..e3c5bfea2 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/types/Employee.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/types/Employee.kt @@ -13,52 +13,48 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Employee.Builder::class) public class Employee( - firstname: () -> String? = firstnameDefault, - company: () -> String? = companyDefault, + firstname: () -> String? = firstnameDefault, + company: () -> String? = companyDefault ) : Person { - private val _firstname: () -> String? = firstname + private val _firstname: () -> String? = firstname - private val _company: () -> String? = company + private val _company: () -> String? = company - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFirstname") - override val firstname: String? - get() = _firstname.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFirstname") + override val firstname: String? + get() = _firstname.invoke() - @get:JvmName("getCompany") - public val company: String? - get() = _company.invoke() + @get:JvmName("getCompany") + public val company: String? + get() = _company.invoke() - public companion object { - private val firstnameDefault: () -> String? = - { throw IllegalStateException("Field `firstname` was not requested") } + public companion object { + private val firstnameDefault: () -> String? = { throw IllegalStateException("Field `firstname` was not requested") } + private val companyDefault: () -> String? = { throw IllegalStateException("Field `company` was not requested") } + } - private val companyDefault: () -> String? = - { throw IllegalStateException("Field `company` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var firstname: () -> String? = firstnameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var firstname: () -> String? = firstnameDefault + private var company: () -> String? = companyDefault - private var company: () -> String? = companyDefault + @JsonProperty("firstname") + public fun withFirstname(firstname: String?): Builder = this.apply { + this.firstname = { firstname } + } - @JsonProperty("firstname") - public fun withFirstname(firstname: String?): Builder = this.apply { - this.firstname = { firstname } - } + @JsonProperty("company") + public fun withCompany(company: String?): Builder = this.apply { + this.company = { company } + } - @JsonProperty("company") - public fun withCompany(company: String?): Builder = this.apply { - this.company = { company } + public fun build(): Employee = Employee( + firstname = firstname, + company = company + ) } - - public fun build(): Employee = Employee( - firstname = firstname, - company = company, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/types/Person.kt index 55768fa21..3ee8154c9 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/types/Person.kt @@ -7,15 +7,17 @@ import kotlin.Suppress import kotlin.jvm.JvmName @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" +) +@JsonSubTypes( + value = [ + JsonSubTypes.Type(value = Employee::class, name = "Employee") + ] ) -@JsonSubTypes(value = [ - JsonSubTypes.Type(value = Employee::class, name = "Employee") -]) public sealed interface Person { - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFirstname") - public val firstname: String? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFirstname") + public val firstname: String? } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/types/Query.kt index b20ab851c..303c3ec50 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithType/expected/types/Query.kt @@ -12,51 +12,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - person: () -> Person? = personDefault, - people: () -> List? = peopleDefault, + person: () -> Person? = personDefault, + people: () -> List? = peopleDefault ) { - private val _person: () -> Person? = person + private val _person: () -> Person? = person - private val _people: () -> List? = people + private val _people: () -> List? = people - @get:JvmName("getPerson") - public val person: Person? - get() = _person.invoke() + @get:JvmName("getPerson") + public val person: Person? + get() = _person.invoke() - @get:JvmName("getPeople") - public val people: List? - get() = _people.invoke() + @get:JvmName("getPeople") + public val people: List? + get() = _people.invoke() - public companion object { - private val personDefault: () -> Person? = - { throw IllegalStateException("Field `person` was not requested") } + public companion object { + private val personDefault: () -> Person? = { throw IllegalStateException("Field `person` was not requested") } + private val peopleDefault: () -> List? = { throw IllegalStateException("Field `people` was not requested") } + } - private val peopleDefault: () -> List? = - { throw IllegalStateException("Field `people` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var person: () -> Person? = personDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var person: () -> Person? = personDefault + private var people: () -> List? = peopleDefault - private var people: () -> List? = peopleDefault + @JsonProperty("person") + public fun withPerson(person: Person?): Builder = this.apply { + this.person = { person } + } - @JsonProperty("person") - public fun withPerson(person: Person?): Builder = this.apply { - this.person = { person } - } + @JsonProperty("people") + public fun withPeople(people: List?): Builder = this.apply { + this.people = { people } + } - @JsonProperty("people") - public fun withPeople(people: List?): Builder = this.apply { - this.people = { people } + public fun build(): Query = Query( + person = person, + people = people + ) } - - public fun build(): Query = Query( - person = person, - people = people, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/DgsClient.kt index e9c1252eb..64042f26e 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/DgsConstants.kt index 77a4e6764..052156ac3 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/DgsConstants.kt @@ -3,39 +3,39 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithTypeAndArgs.expected import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Person: String = "person" + public const val Person: String = "person" - public object PERSON_INPUT_ARGUMENT { - public const val A1: String = "a1" + public object PERSON_INPUT_ARGUMENT { + public const val A1: String = "a1" - public const val A2: String = "a2" + public const val A2: String = "a2" - public const val A3: String = "a3" + public const val A3: String = "a3" + } } - } - public object EMPLOYEE { - public const val TYPE_NAME: String = "Employee" + public object EMPLOYEE { + public const val TYPE_NAME: String = "Employee" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Company: String = "company" - } + public const val Company: String = "company" + } - public object I { - public const val TYPE_NAME: String = "I" + public object I { + public const val TYPE_NAME: String = "I" - public const val Arg: String = "arg" - } + public const val Arg: String = "arg" + } - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Firstname: String = "firstname" - } + public const val Firstname: String = "firstname" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/client/EmployeeProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/client/EmployeeProjection.kt index cf3a4e821..852989b0b 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/client/EmployeeProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/client/EmployeeProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithTypeAndArgs.expected import com.netflix.graphql.dgs.codegen.GraphQLProjection public class EmployeeProjection : GraphQLProjection() { - public val firstname: EmployeeProjection - get() { - field("firstname") - return this - } + public val firstname: EmployeeProjection + get() { + field("firstname") + return this + } - public val company: EmployeeProjection - get() { - field("company") - return this - } + public val company: EmployeeProjection + get() { + field("company") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/client/PersonProjection.kt index c1f9c82e4..c1dea8f60 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/client/PersonProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithTypeAndArgs.expected import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val firstname: PersonProjection - get() { - field("firstname") - return this - } + public val firstname: PersonProjection + get() { + field("firstname") + return this + } - public fun onEmployee(_projection: EmployeeProjection.() -> EmployeeProjection): - PersonProjection { - fragment("Employee", EmployeeProjection(), _projection) - return this - } + public fun onEmployee(_projection: EmployeeProjection.() -> EmployeeProjection): + PersonProjection { + fragment("Employee", EmployeeProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/client/QueryProjection.kt index d4f012890..5342ba9f7 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/client/QueryProjection.kt @@ -5,13 +5,13 @@ import com.netflix.graphql.dgs.codegen.cases.projectionWithTypeAndArgs.expected. import kotlin.String public class QueryProjection : GraphQLProjection() { - public fun person( - a1: String? = default("a1"), - a2: String, - a3: I? = default("a3"), - _projection: PersonProjection.() -> PersonProjection, - ): QueryProjection { - field("person", PersonProjection(), _projection, "a1" to a1 , "a2" to a2 , "a3" to a3) - return this - } + public fun person( + a1: String? = default("a1"), + a2: String, + a3: I? = default("a3"), + _projection: PersonProjection.() -> PersonProjection + ): QueryProjection { + field("person", PersonProjection(), _projection, "a1" to a1, "a2" to a2, "a3" to a3) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/types/Employee.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/types/Employee.kt index 7322e2ee8..176fa0915 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/types/Employee.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/types/Employee.kt @@ -13,52 +13,48 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Employee.Builder::class) public class Employee( - firstname: () -> String? = firstnameDefault, - company: () -> String? = companyDefault, + firstname: () -> String? = firstnameDefault, + company: () -> String? = companyDefault ) : Person { - private val _firstname: () -> String? = firstname + private val _firstname: () -> String? = firstname - private val _company: () -> String? = company + private val _company: () -> String? = company - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFirstname") - override val firstname: String? - get() = _firstname.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFirstname") + override val firstname: String? + get() = _firstname.invoke() - @get:JvmName("getCompany") - public val company: String? - get() = _company.invoke() + @get:JvmName("getCompany") + public val company: String? + get() = _company.invoke() - public companion object { - private val firstnameDefault: () -> String? = - { throw IllegalStateException("Field `firstname` was not requested") } + public companion object { + private val firstnameDefault: () -> String? = { throw IllegalStateException("Field `firstname` was not requested") } + private val companyDefault: () -> String? = { throw IllegalStateException("Field `company` was not requested") } + } - private val companyDefault: () -> String? = - { throw IllegalStateException("Field `company` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var firstname: () -> String? = firstnameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var firstname: () -> String? = firstnameDefault + private var company: () -> String? = companyDefault - private var company: () -> String? = companyDefault + @JsonProperty("firstname") + public fun withFirstname(firstname: String?): Builder = this.apply { + this.firstname = { firstname } + } - @JsonProperty("firstname") - public fun withFirstname(firstname: String?): Builder = this.apply { - this.firstname = { firstname } - } + @JsonProperty("company") + public fun withCompany(company: String?): Builder = this.apply { + this.company = { company } + } - @JsonProperty("company") - public fun withCompany(company: String?): Builder = this.apply { - this.company = { company } + public fun build(): Employee = Employee( + firstname = firstname, + company = company + ) } - - public fun build(): Employee = Employee( - firstname = firstname, - company = company, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/types/I.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/types/I.kt index fd1a95b77..4e14b4d7f 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/types/I.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/types/I.kt @@ -7,7 +7,7 @@ import kotlin.String import kotlin.collections.List public class I( - public val arg: String? = default("arg"), + public val arg: String? = default("arg") ) : GraphQLInput() { - override fun fields(): List> = listOf("arg" to arg) + override fun fields(): List> = listOf("arg" to arg) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/types/Person.kt index 2c2021ae6..fb25df2ee 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/types/Person.kt @@ -7,15 +7,17 @@ import kotlin.Suppress import kotlin.jvm.JvmName @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" +) +@JsonSubTypes( + value = [ + JsonSubTypes.Type(value = Employee::class, name = "Employee") + ] ) -@JsonSubTypes(value = [ - JsonSubTypes.Type(value = Employee::class, name = "Employee") -]) public sealed interface Person { - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFirstname") - public val firstname: String? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFirstname") + public val firstname: String? } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/types/Query.kt index 5cc92e703..d23d73d91 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithTypeAndArgs/expected/types/Query.kt @@ -11,32 +11,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - person: () -> Person? = personDefault, + person: () -> Person? = personDefault ) { - private val _person: () -> Person? = person + private val _person: () -> Person? = person - @get:JvmName("getPerson") - public val person: Person? - get() = _person.invoke() + @get:JvmName("getPerson") + public val person: Person? + get() = _person.invoke() - public companion object { - private val personDefault: () -> Person? = - { throw IllegalStateException("Field `person` was not requested") } + public companion object { + private val personDefault: () -> Person? = { throw IllegalStateException("Field `person` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var person: () -> Person? = personDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var person: () -> Person? = personDefault + @JsonProperty("person") + public fun withPerson(person: Person?): Builder = this.apply { + this.person = { person } + } - @JsonProperty("person") - public fun withPerson(person: Person?): Builder = this.apply { - this.person = { person } + public fun build(): Query = Query( + person = person + ) } - - public fun build(): Query = Query( - person = person, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/DgsClient.kt index caef12149..ed2d2f26b 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/DgsConstants.kt index caa105ece..6025f3669 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/DgsConstants.kt @@ -3,31 +3,31 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithUnion.expected import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val U: String = "u" + public const val U: String = "u" - public const val Us: String = "us" - } + public const val Us: String = "us" + } - public object EMPLOYEE { - public const val TYPE_NAME: String = "Employee" + public object EMPLOYEE { + public const val TYPE_NAME: String = "Employee" - public const val Firstname: String = "firstname" + public const val Firstname: String = "firstname" - public const val Company: String = "company" - } + public const val Company: String = "company" + } - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Firstname: String = "firstname" - } + public const val Firstname: String = "firstname" + } - public object U { - public const val TYPE_NAME: String = "U" - } + public object U { + public const val TYPE_NAME: String = "U" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/client/EmployeeProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/client/EmployeeProjection.kt index 0dc109213..e1ca51a0b 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/client/EmployeeProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/client/EmployeeProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithUnion.expected.clien import com.netflix.graphql.dgs.codegen.GraphQLProjection public class EmployeeProjection : GraphQLProjection() { - public val firstname: EmployeeProjection - get() { - field("firstname") - return this - } + public val firstname: EmployeeProjection + get() { + field("firstname") + return this + } - public val company: EmployeeProjection - get() { - field("company") - return this - } + public val company: EmployeeProjection + get() { + field("company") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/client/PersonProjection.kt index 03c117847..ec3a70339 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/client/PersonProjection.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithUnion.expected.clien import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val firstname: PersonProjection - get() { - field("firstname") - return this - } + public val firstname: PersonProjection + get() { + field("firstname") + return this + } - public fun onEmployee(_projection: EmployeeProjection.() -> EmployeeProjection): - PersonProjection { - fragment("Employee", EmployeeProjection(), _projection) - return this - } + public fun onEmployee(_projection: EmployeeProjection.() -> EmployeeProjection): + PersonProjection { + fragment("Employee", EmployeeProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/client/QueryProjection.kt index 8feedac01..988fcf12a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/client/QueryProjection.kt @@ -3,13 +3,13 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithUnion.expected.clien import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun u(_projection: UProjection.() -> UProjection): QueryProjection { - field("u", UProjection(), _projection) - return this - } + public fun u(_projection: UProjection.() -> UProjection): QueryProjection { + field("u", UProjection(), _projection) + return this + } - public fun us(_projection: UProjection.() -> UProjection): QueryProjection { - field("us", UProjection(), _projection) - return this - } + public fun us(_projection: UProjection.() -> UProjection): QueryProjection { + field("us", UProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/client/UProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/client/UProjection.kt index e8b7097ba..e30dce9a2 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/client/UProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/client/UProjection.kt @@ -3,8 +3,8 @@ package com.netflix.graphql.dgs.codegen.cases.projectionWithUnion.expected.clien import com.netflix.graphql.dgs.codegen.GraphQLProjection public class UProjection : GraphQLProjection() { - public fun onEmployee(_projection: EmployeeProjection.() -> EmployeeProjection): UProjection { - fragment("Employee", EmployeeProjection(), _projection) - return this - } + public fun onEmployee(_projection: EmployeeProjection.() -> EmployeeProjection): UProjection { + fragment("Employee", EmployeeProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/types/Employee.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/types/Employee.kt index fcf28f010..fab4157b6 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/types/Employee.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/types/Employee.kt @@ -13,52 +13,48 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Employee.Builder::class) public class Employee( - firstname: () -> String? = firstnameDefault, - company: () -> String? = companyDefault, + firstname: () -> String? = firstnameDefault, + company: () -> String? = companyDefault ) : Person, U { - private val _firstname: () -> String? = firstname + private val _firstname: () -> String? = firstname - private val _company: () -> String? = company + private val _company: () -> String? = company - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFirstname") - override val firstname: String? - get() = _firstname.invoke() + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFirstname") + override val firstname: String? + get() = _firstname.invoke() - @get:JvmName("getCompany") - public val company: String? - get() = _company.invoke() + @get:JvmName("getCompany") + public val company: String? + get() = _company.invoke() - public companion object { - private val firstnameDefault: () -> String? = - { throw IllegalStateException("Field `firstname` was not requested") } + public companion object { + private val firstnameDefault: () -> String? = { throw IllegalStateException("Field `firstname` was not requested") } + private val companyDefault: () -> String? = { throw IllegalStateException("Field `company` was not requested") } + } - private val companyDefault: () -> String? = - { throw IllegalStateException("Field `company` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var firstname: () -> String? = firstnameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var firstname: () -> String? = firstnameDefault + private var company: () -> String? = companyDefault - private var company: () -> String? = companyDefault + @JsonProperty("firstname") + public fun withFirstname(firstname: String?): Builder = this.apply { + this.firstname = { firstname } + } - @JsonProperty("firstname") - public fun withFirstname(firstname: String?): Builder = this.apply { - this.firstname = { firstname } - } + @JsonProperty("company") + public fun withCompany(company: String?): Builder = this.apply { + this.company = { company } + } - @JsonProperty("company") - public fun withCompany(company: String?): Builder = this.apply { - this.company = { company } + public fun build(): Employee = Employee( + firstname = firstname, + company = company + ) } - - public fun build(): Employee = Employee( - firstname = firstname, - company = company, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/types/Person.kt index 7916d280f..e2c444d60 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/types/Person.kt @@ -7,15 +7,17 @@ import kotlin.Suppress import kotlin.jvm.JvmName @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" +) +@JsonSubTypes( + value = [ + JsonSubTypes.Type(value = Employee::class, name = "Employee") + ] ) -@JsonSubTypes(value = [ - JsonSubTypes.Type(value = Employee::class, name = "Employee") -]) public sealed interface Person { - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getFirstname") - public val firstname: String? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getFirstname") + public val firstname: String? } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/types/Query.kt index 5489e617e..82c77b7be 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/types/Query.kt @@ -12,51 +12,47 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - u: () -> U? = uDefault, - us: () -> List? = usDefault, + u: () -> U? = uDefault, + us: () -> List? = usDefault ) { - private val _u: () -> U? = u + private val _u: () -> U? = u - private val _us: () -> List? = us + private val _us: () -> List? = us - @get:JvmName("getU") - public val u: U? - get() = _u.invoke() + @get:JvmName("getU") + public val u: U? + get() = _u.invoke() - @get:JvmName("getUs") - public val us: List? - get() = _us.invoke() + @get:JvmName("getUs") + public val us: List? + get() = _us.invoke() - public companion object { - private val uDefault: () -> U? = - { throw IllegalStateException("Field `u` was not requested") } + public companion object { + private val uDefault: () -> U? = { throw IllegalStateException("Field `u` was not requested") } + private val usDefault: () -> List? = { throw IllegalStateException("Field `us` was not requested") } + } - private val usDefault: () -> List? = - { throw IllegalStateException("Field `us` was not requested") } - - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var u: () -> U? = uDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var u: () -> U? = uDefault + private var us: () -> List? = usDefault - private var us: () -> List? = usDefault + @JsonProperty("u") + public fun withU(u: U?): Builder = this.apply { + this.u = { u } + } - @JsonProperty("u") - public fun withU(u: U?): Builder = this.apply { - this.u = { u } - } + @JsonProperty("us") + public fun withUs(us: List?): Builder = this.apply { + this.us = { us } + } - @JsonProperty("us") - public fun withUs(us: List?): Builder = this.apply { - this.us = { us } + public fun build(): Query = Query( + u = u, + us = us + ) } - - public fun build(): Query = Query( - u = u, - us = us, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/types/U.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/types/U.kt index f79295ca9..da40d79d0 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/types/U.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/types/U.kt @@ -4,11 +4,13 @@ import com.fasterxml.jackson.`annotation`.JsonSubTypes import com.fasterxml.jackson.`annotation`.JsonTypeInfo @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" +) +@JsonSubTypes( + value = [ + JsonSubTypes.Type(value = Employee::class, name = "Employee") + ] ) -@JsonSubTypes(value = [ - JsonSubTypes.Type(value = Employee::class, name = "Employee") -]) public sealed interface U diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnFields/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnFields/expected/DgsConstants.kt index 9a0f7a082..431e74a64 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnFields/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnFields/expected/DgsConstants.kt @@ -3,11 +3,11 @@ package com.netflix.graphql.dgs.codegen.cases.skipCodegenOnFields.expected import kotlin.String public object DgsConstants { - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Name: String = "name" + public const val Name: String = "name" - public const val Email: String = "email" - } + public const val Email: String = "email" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnFields/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnFields/expected/client/PersonProjection.kt index c58ea5e24..8fe9f12aa 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnFields/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnFields/expected/client/PersonProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.skipCodegenOnFields.expected.clien import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val name: PersonProjection - get() { - field("name") - return this - } + public val name: PersonProjection + get() { + field("name") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnFields/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnFields/expected/types/Person.kt index 777247d2e..06b863ef2 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnFields/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnFields/expected/types/Person.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Person.Builder::class) public class Person( - name: () -> String? = nameDefault, + name: () -> String? = nameDefault ) { - private val _name: () -> String? = name + private val _name: () -> String? = name - @get:JvmName("getName") - public val name: String? - get() = _name.invoke() + @get:JvmName("getName") + public val name: String? + get() = _name.invoke() - public companion object { - private val nameDefault: () -> String? = - { throw IllegalStateException("Field `name` was not requested") } + public companion object { + private val nameDefault: () -> String? = { throw IllegalStateException("Field `name` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var name: () -> String? = nameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var name: () -> String? = nameDefault + @JsonProperty("name") + public fun withName(name: String?): Builder = this.apply { + this.name = { name } + } - @JsonProperty("name") - public fun withName(name: String?): Builder = this.apply { - this.name = { name } + public fun build(): Person = Person( + name = name + ) } - - public fun build(): Person = Person( - name = name, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnInterfaceFields/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnInterfaceFields/expected/DgsConstants.kt index a96e78225..b5e9929cb 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnInterfaceFields/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnInterfaceFields/expected/DgsConstants.kt @@ -3,11 +3,11 @@ package com.netflix.graphql.dgs.codegen.cases.skipCodegenOnInterfaceFields.expec import kotlin.String public object DgsConstants { - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Name: String = "name" + public const val Name: String = "name" - public const val Email: String = "email" - } + public const val Email: String = "email" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnInterfaceFields/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnInterfaceFields/expected/client/PersonProjection.kt index da21f6892..88e7583bc 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnInterfaceFields/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnInterfaceFields/expected/client/PersonProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.skipCodegenOnInterfaceFields.expec import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val name: PersonProjection - get() { - field("name") - return this - } + public val name: PersonProjection + get() { + field("name") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnInterfaceFields/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnInterfaceFields/expected/types/Person.kt index 695196bb8..1e1094e95 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnInterfaceFields/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnInterfaceFields/expected/types/Person.kt @@ -6,12 +6,12 @@ import kotlin.Suppress import kotlin.jvm.JvmName @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" ) public sealed interface Person { - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getName") - public val name: String? + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("getName") + public val name: String? } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnTypes/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnTypes/expected/DgsConstants.kt index 729ebe5f0..d9c12b5bf 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnTypes/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnTypes/expected/DgsConstants.kt @@ -3,15 +3,15 @@ package com.netflix.graphql.dgs.codegen.cases.skipCodegenOnTypes.expected import kotlin.String public object DgsConstants { - public object PERSON { - public const val TYPE_NAME: String = "Person" + public object PERSON { + public const val TYPE_NAME: String = "Person" - public const val Name: String = "name" - } + public const val Name: String = "name" + } - public object CAR { - public const val TYPE_NAME: String = "Car" + public object CAR { + public const val TYPE_NAME: String = "Car" - public const val Make: String = "make" - } + public const val Make: String = "make" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnTypes/expected/client/PersonProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnTypes/expected/client/PersonProjection.kt index caa6b08d4..ff9ed00bf 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnTypes/expected/client/PersonProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnTypes/expected/client/PersonProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.skipCodegenOnTypes.expected.client import com.netflix.graphql.dgs.codegen.GraphQLProjection public class PersonProjection : GraphQLProjection() { - public val name: PersonProjection - get() { - field("name") - return this - } + public val name: PersonProjection + get() { + field("name") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnTypes/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnTypes/expected/types/Person.kt index 469f38874..4461eb5ae 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnTypes/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/skipCodegenOnTypes/expected/types/Person.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Person.Builder::class) public class Person( - name: () -> String? = nameDefault, + name: () -> String? = nameDefault ) { - private val _name: () -> String? = name + private val _name: () -> String? = name - @get:JvmName("getName") - public val name: String? - get() = _name.invoke() + @get:JvmName("getName") + public val name: String? + get() = _name.invoke() - public companion object { - private val nameDefault: () -> String? = - { throw IllegalStateException("Field `name` was not requested") } + public companion object { + private val nameDefault: () -> String? = { throw IllegalStateException("Field `name` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var name: () -> String? = nameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var name: () -> String? = nameDefault + @JsonProperty("name") + public fun withName(name: String?): Builder = this.apply { + this.name = { name } + } - @JsonProperty("name") - public fun withName(name: String?): Builder = this.apply { - this.name = { name } + public fun build(): Person = Person( + name = name + ) } - - public fun build(): Person = Person( - name = name, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/DgsClient.kt index f1d8a01c3..b172c5e73 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/DgsConstants.kt index 6d6e8d0ae..390c4d9ae 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/DgsConstants.kt @@ -3,27 +3,27 @@ package com.netflix.graphql.dgs.codegen.cases.union.expected import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Search: String = "search" - } + public const val Search: String = "search" + } - public object MOVIE { - public const val TYPE_NAME: String = "Movie" + public object MOVIE { + public const val TYPE_NAME: String = "Movie" - public const val Title: String = "title" - } + public const val Title: String = "title" + } - public object ACTOR { - public const val TYPE_NAME: String = "Actor" + public object ACTOR { + public const val TYPE_NAME: String = "Actor" - public const val Name: String = "name" - } + public const val Name: String = "name" + } - public object SEARCHRESULT { - public const val TYPE_NAME: String = "SearchResult" - } + public object SEARCHRESULT { + public const val TYPE_NAME: String = "SearchResult" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/client/ActorProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/client/ActorProjection.kt index 9469a2a7d..f281a0af2 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/client/ActorProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/client/ActorProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.union.expected.client import com.netflix.graphql.dgs.codegen.GraphQLProjection public class ActorProjection : GraphQLProjection() { - public val name: ActorProjection - get() { - field("name") - return this - } + public val name: ActorProjection + get() { + field("name") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/client/MovieProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/client/MovieProjection.kt index b8a209fe9..33765eb09 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/client/MovieProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/client/MovieProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.union.expected.client import com.netflix.graphql.dgs.codegen.GraphQLProjection public class MovieProjection : GraphQLProjection() { - public val title: MovieProjection - get() { - field("title") - return this - } + public val title: MovieProjection + get() { + field("title") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/client/QueryProjection.kt index 3ccd516d8..401778e36 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/client/QueryProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.union.expected.client import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun search(_projection: SearchResultProjection.() -> SearchResultProjection): - QueryProjection { - field("search", SearchResultProjection(), _projection) - return this - } + public fun search(_projection: SearchResultProjection.() -> SearchResultProjection): + QueryProjection { + field("search", SearchResultProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/client/SearchResultProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/client/SearchResultProjection.kt index eff0789fe..3c025254a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/client/SearchResultProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/client/SearchResultProjection.kt @@ -3,13 +3,13 @@ package com.netflix.graphql.dgs.codegen.cases.union.expected.client import com.netflix.graphql.dgs.codegen.GraphQLProjection public class SearchResultProjection : GraphQLProjection() { - public fun onMovie(_projection: MovieProjection.() -> MovieProjection): SearchResultProjection { - fragment("Movie", MovieProjection(), _projection) - return this - } + public fun onMovie(_projection: MovieProjection.() -> MovieProjection): SearchResultProjection { + fragment("Movie", MovieProjection(), _projection) + return this + } - public fun onActor(_projection: ActorProjection.() -> ActorProjection): SearchResultProjection { - fragment("Actor", ActorProjection(), _projection) - return this - } + public fun onActor(_projection: ActorProjection.() -> ActorProjection): SearchResultProjection { + fragment("Actor", ActorProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/types/Actor.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/types/Actor.kt index 90a616ea5..84cad3bf0 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/types/Actor.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/types/Actor.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Actor.Builder::class) public class Actor( - name: () -> String? = nameDefault, + name: () -> String? = nameDefault ) : SearchResult { - private val _name: () -> String? = name + private val _name: () -> String? = name - @get:JvmName("getName") - public val name: String? - get() = _name.invoke() + @get:JvmName("getName") + public val name: String? + get() = _name.invoke() - public companion object { - private val nameDefault: () -> String? = - { throw IllegalStateException("Field `name` was not requested") } + public companion object { + private val nameDefault: () -> String? = { throw IllegalStateException("Field `name` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var name: () -> String? = nameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var name: () -> String? = nameDefault + @JsonProperty("name") + public fun withName(name: String?): Builder = this.apply { + this.name = { name } + } - @JsonProperty("name") - public fun withName(name: String?): Builder = this.apply { - this.name = { name } + public fun build(): Actor = Actor( + name = name + ) } - - public fun build(): Actor = Actor( - name = name, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/types/Movie.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/types/Movie.kt index 5b80e1cca..09cf60d4f 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/types/Movie.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/types/Movie.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Movie.Builder::class) public class Movie( - title: () -> String? = titleDefault, + title: () -> String? = titleDefault ) : SearchResult { - private val _title: () -> String? = title + private val _title: () -> String? = title - @get:JvmName("getTitle") - public val title: String? - get() = _title.invoke() + @get:JvmName("getTitle") + public val title: String? + get() = _title.invoke() - public companion object { - private val titleDefault: () -> String? = - { throw IllegalStateException("Field `title` was not requested") } + public companion object { + private val titleDefault: () -> String? = { throw IllegalStateException("Field `title` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var title: () -> String? = titleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var title: () -> String? = titleDefault + @JsonProperty("title") + public fun withTitle(title: String?): Builder = this.apply { + this.title = { title } + } - @JsonProperty("title") - public fun withTitle(title: String?): Builder = this.apply { - this.title = { title } + public fun build(): Movie = Movie( + title = title + ) } - - public fun build(): Movie = Movie( - title = title, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/types/Query.kt index 0e7b3b657..da3a437fa 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - search: () -> List? = searchDefault, + search: () -> List? = searchDefault ) { - private val _search: () -> List? = search + private val _search: () -> List? = search - @get:JvmName("getSearch") - public val search: List? - get() = _search.invoke() + @get:JvmName("getSearch") + public val search: List? + get() = _search.invoke() - public companion object { - private val searchDefault: () -> List? = - { throw IllegalStateException("Field `search` was not requested") } + public companion object { + private val searchDefault: () -> List? = { throw IllegalStateException("Field `search` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var search: () -> List? = searchDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var search: () -> List? = searchDefault + @JsonProperty("search") + public fun withSearch(search: List?): Builder = this.apply { + this.search = { search } + } - @JsonProperty("search") - public fun withSearch(search: List?): Builder = this.apply { - this.search = { search } + public fun build(): Query = Query( + search = search + ) } - - public fun build(): Query = Query( - search = search, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/types/SearchResult.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/types/SearchResult.kt index 615a4836c..4731dd925 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/types/SearchResult.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/union/expected/types/SearchResult.kt @@ -4,12 +4,14 @@ import com.fasterxml.jackson.`annotation`.JsonSubTypes import com.fasterxml.jackson.`annotation`.JsonTypeInfo @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" +) +@JsonSubTypes( + value = [ + JsonSubTypes.Type(value = Movie::class, name = "Movie"), + JsonSubTypes.Type(value = Actor::class, name = "Actor") + ] ) -@JsonSubTypes(value = [ - JsonSubTypes.Type(value = Movie::class, name = "Movie"), - JsonSubTypes.Type(value = Actor::class, name = "Actor") -]) public sealed interface SearchResult diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/DgsClient.kt index d7d243c10..c2c7d0dba 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/DgsConstants.kt index 77865861e..4fe54adb1 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/DgsConstants.kt @@ -3,45 +3,45 @@ package com.netflix.graphql.dgs.codegen.cases.unionTypesWithoutInterfaceCanDeser import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Search: String = "search" + public const val Search: String = "search" - public object SEARCH_INPUT_ARGUMENT { - public const val Text: String = "text" + public object SEARCH_INPUT_ARGUMENT { + public const val Text: String = "text" + } } - } - public object HUMAN { - public const val TYPE_NAME: String = "Human" + public object HUMAN { + public const val TYPE_NAME: String = "Human" - public const val Id: String = "id" + public const val Id: String = "id" - public const val Name: String = "name" + public const val Name: String = "name" - public const val TotalCredits: String = "totalCredits" - } + public const val TotalCredits: String = "totalCredits" + } - public object DROID { - public const val TYPE_NAME: String = "Droid" + public object DROID { + public const val TYPE_NAME: String = "Droid" - public const val Id: String = "id" + public const val Id: String = "id" - public const val Name: String = "name" + public const val Name: String = "name" - public const val PrimaryFunction: String = "primaryFunction" - } + public const val PrimaryFunction: String = "primaryFunction" + } - public object SEARCHRESULTPAGE { - public const val TYPE_NAME: String = "SearchResultPage" + public object SEARCHRESULTPAGE { + public const val TYPE_NAME: String = "SearchResultPage" - public const val Items: String = "items" - } + public const val Items: String = "items" + } - public object SEARCHRESULT { - public const val TYPE_NAME: String = "SearchResult" - } + public object SEARCHRESULT { + public const val TYPE_NAME: String = "SearchResult" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/DroidProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/DroidProjection.kt index 5786c726c..5c2f9e7a9 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/DroidProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/DroidProjection.kt @@ -3,21 +3,21 @@ package com.netflix.graphql.dgs.codegen.cases.unionTypesWithoutInterfaceCanDeser import com.netflix.graphql.dgs.codegen.GraphQLProjection public class DroidProjection : GraphQLProjection() { - public val id: DroidProjection - get() { - field("id") - return this - } + public val id: DroidProjection + get() { + field("id") + return this + } - public val name: DroidProjection - get() { - field("name") - return this - } + public val name: DroidProjection + get() { + field("name") + return this + } - public val primaryFunction: DroidProjection - get() { - field("primaryFunction") - return this - } + public val primaryFunction: DroidProjection + get() { + field("primaryFunction") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/HumanProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/HumanProjection.kt index 528c42875..a6ef3aef5 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/HumanProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/HumanProjection.kt @@ -3,21 +3,21 @@ package com.netflix.graphql.dgs.codegen.cases.unionTypesWithoutInterfaceCanDeser import com.netflix.graphql.dgs.codegen.GraphQLProjection public class HumanProjection : GraphQLProjection() { - public val id: HumanProjection - get() { - field("id") - return this - } + public val id: HumanProjection + get() { + field("id") + return this + } - public val name: HumanProjection - get() { - field("name") - return this - } + public val name: HumanProjection + get() { + field("name") + return this + } - public val totalCredits: HumanProjection - get() { - field("totalCredits") - return this - } + public val totalCredits: HumanProjection + get() { + field("totalCredits") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/QueryProjection.kt index 5700b7627..a5443bf68 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/QueryProjection.kt @@ -4,9 +4,11 @@ import com.netflix.graphql.dgs.codegen.GraphQLProjection import kotlin.String public class QueryProjection : GraphQLProjection() { - public fun search(text: String, - _projection: SearchResultPageProjection.() -> SearchResultPageProjection): QueryProjection { - field("search", SearchResultPageProjection(), _projection, "text" to text) - return this - } + public fun search( + text: String, + _projection: SearchResultPageProjection.() -> SearchResultPageProjection + ): QueryProjection { + field("search", SearchResultPageProjection(), _projection, "text" to text) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/SearchResultPageProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/SearchResultPageProjection.kt index 624b1e6af..abccecec5 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/SearchResultPageProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/SearchResultPageProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.unionTypesWithoutInterfaceCanDeser import com.netflix.graphql.dgs.codegen.GraphQLProjection public class SearchResultPageProjection : GraphQLProjection() { - public fun items(_projection: SearchResultProjection.() -> SearchResultProjection): - SearchResultPageProjection { - field("items", SearchResultProjection(), _projection) - return this - } + public fun items(_projection: SearchResultProjection.() -> SearchResultProjection): + SearchResultPageProjection { + field("items", SearchResultProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/SearchResultProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/SearchResultProjection.kt index 20eb7361f..2811f23a5 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/SearchResultProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/client/SearchResultProjection.kt @@ -3,13 +3,13 @@ package com.netflix.graphql.dgs.codegen.cases.unionTypesWithoutInterfaceCanDeser import com.netflix.graphql.dgs.codegen.GraphQLProjection public class SearchResultProjection : GraphQLProjection() { - public fun onHuman(_projection: HumanProjection.() -> HumanProjection): SearchResultProjection { - fragment("Human", HumanProjection(), _projection) - return this - } + public fun onHuman(_projection: HumanProjection.() -> HumanProjection): SearchResultProjection { + fragment("Human", HumanProjection(), _projection) + return this + } - public fun onDroid(_projection: DroidProjection.() -> DroidProjection): SearchResultProjection { - fragment("Droid", DroidProjection(), _projection) - return this - } + public fun onDroid(_projection: DroidProjection.() -> DroidProjection): SearchResultProjection { + fragment("Droid", DroidProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/Droid.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/Droid.kt index 8c989e447..23f73284f 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/Droid.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/Droid.kt @@ -12,70 +12,64 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Droid.Builder::class) public class Droid( - id: () -> String = idDefault, - name: () -> String = nameDefault, - primaryFunction: () -> String? = primaryFunctionDefault, + id: () -> String = idDefault, + name: () -> String = nameDefault, + primaryFunction: () -> String? = primaryFunctionDefault ) : SearchResult { - private val _id: () -> String = id + private val _id: () -> String = id - private val _name: () -> String = name + private val _name: () -> String = name - private val _primaryFunction: () -> String? = primaryFunction + private val _primaryFunction: () -> String? = primaryFunction - @get:JvmName("getId") - public val id: String - get() = _id.invoke() + @get:JvmName("getId") + public val id: String + get() = _id.invoke() - @get:JvmName("getName") - public val name: String - get() = _name.invoke() + @get:JvmName("getName") + public val name: String + get() = _name.invoke() - @get:JvmName("getPrimaryFunction") - public val primaryFunction: String? - get() = _primaryFunction.invoke() + @get:JvmName("getPrimaryFunction") + public val primaryFunction: String? + get() = _primaryFunction.invoke() - public companion object { - private val idDefault: () -> String = - { throw IllegalStateException("Field `id` was not requested") } + public companion object { + private val idDefault: () -> String = { throw IllegalStateException("Field `id` was not requested") } + private val nameDefault: () -> String = { throw IllegalStateException("Field `name` was not requested") } - private val nameDefault: () -> String = - { throw IllegalStateException("Field `name` was not requested") } - - - private val primaryFunctionDefault: () -> String? = - { throw IllegalStateException("Field `primaryFunction` was not requested") } + private val primaryFunctionDefault: () -> String? = { throw IllegalStateException("Field `primaryFunction` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var id: () -> String = idDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var id: () -> String = idDefault + private var name: () -> String = nameDefault - private var name: () -> String = nameDefault + private var primaryFunction: () -> String? = primaryFunctionDefault - private var primaryFunction: () -> String? = primaryFunctionDefault + @JsonProperty("id") + public fun withId(id: String): Builder = this.apply { + this.id = { id } + } - @JsonProperty("id") - public fun withId(id: String): Builder = this.apply { - this.id = { id } - } + @JsonProperty("name") + public fun withName(name: String): Builder = this.apply { + this.name = { name } + } - @JsonProperty("name") - public fun withName(name: String): Builder = this.apply { - this.name = { name } - } + @JsonProperty("primaryFunction") + public fun withPrimaryFunction(primaryFunction: String?): Builder = this.apply { + this.primaryFunction = { primaryFunction } + } - @JsonProperty("primaryFunction") - public fun withPrimaryFunction(primaryFunction: String?): Builder = this.apply { - this.primaryFunction = { primaryFunction } + public fun build(): Droid = Droid( + id = id, + name = name, + primaryFunction = primaryFunction + ) } - - public fun build(): Droid = Droid( - id = id, - name = name, - primaryFunction = primaryFunction, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/Human.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/Human.kt index 109de5d8d..50eff34b0 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/Human.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/Human.kt @@ -13,70 +13,64 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Human.Builder::class) public class Human( - id: () -> String = idDefault, - name: () -> String = nameDefault, - totalCredits: () -> Int? = totalCreditsDefault, + id: () -> String = idDefault, + name: () -> String = nameDefault, + totalCredits: () -> Int? = totalCreditsDefault ) : SearchResult { - private val _id: () -> String = id + private val _id: () -> String = id - private val _name: () -> String = name + private val _name: () -> String = name - private val _totalCredits: () -> Int? = totalCredits + private val _totalCredits: () -> Int? = totalCredits - @get:JvmName("getId") - public val id: String - get() = _id.invoke() + @get:JvmName("getId") + public val id: String + get() = _id.invoke() - @get:JvmName("getName") - public val name: String - get() = _name.invoke() + @get:JvmName("getName") + public val name: String + get() = _name.invoke() - @get:JvmName("getTotalCredits") - public val totalCredits: Int? - get() = _totalCredits.invoke() + @get:JvmName("getTotalCredits") + public val totalCredits: Int? + get() = _totalCredits.invoke() - public companion object { - private val idDefault: () -> String = - { throw IllegalStateException("Field `id` was not requested") } + public companion object { + private val idDefault: () -> String = { throw IllegalStateException("Field `id` was not requested") } + private val nameDefault: () -> String = { throw IllegalStateException("Field `name` was not requested") } - private val nameDefault: () -> String = - { throw IllegalStateException("Field `name` was not requested") } - - - private val totalCreditsDefault: () -> Int? = - { throw IllegalStateException("Field `totalCredits` was not requested") } + private val totalCreditsDefault: () -> Int? = { throw IllegalStateException("Field `totalCredits` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var id: () -> String = idDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var id: () -> String = idDefault + private var name: () -> String = nameDefault - private var name: () -> String = nameDefault + private var totalCredits: () -> Int? = totalCreditsDefault - private var totalCredits: () -> Int? = totalCreditsDefault + @JsonProperty("id") + public fun withId(id: String): Builder = this.apply { + this.id = { id } + } - @JsonProperty("id") - public fun withId(id: String): Builder = this.apply { - this.id = { id } - } + @JsonProperty("name") + public fun withName(name: String): Builder = this.apply { + this.name = { name } + } - @JsonProperty("name") - public fun withName(name: String): Builder = this.apply { - this.name = { name } - } + @JsonProperty("totalCredits") + public fun withTotalCredits(totalCredits: Int?): Builder = this.apply { + this.totalCredits = { totalCredits } + } - @JsonProperty("totalCredits") - public fun withTotalCredits(totalCredits: Int?): Builder = this.apply { - this.totalCredits = { totalCredits } + public fun build(): Human = Human( + id = id, + name = name, + totalCredits = totalCredits + ) } - - public fun build(): Human = Human( - id = id, - name = name, - totalCredits = totalCredits, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/Query.kt index 4531bb092..2efc49b10 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/Query.kt @@ -11,32 +11,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - search: () -> SearchResultPage? = searchDefault, + search: () -> SearchResultPage? = searchDefault ) { - private val _search: () -> SearchResultPage? = search + private val _search: () -> SearchResultPage? = search - @get:JvmName("getSearch") - public val search: SearchResultPage? - get() = _search.invoke() + @get:JvmName("getSearch") + public val search: SearchResultPage? + get() = _search.invoke() - public companion object { - private val searchDefault: () -> SearchResultPage? = - { throw IllegalStateException("Field `search` was not requested") } + public companion object { + private val searchDefault: () -> SearchResultPage? = { throw IllegalStateException("Field `search` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var search: () -> SearchResultPage? = searchDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var search: () -> SearchResultPage? = searchDefault + @JsonProperty("search") + public fun withSearch(search: SearchResultPage?): Builder = this.apply { + this.search = { search } + } - @JsonProperty("search") - public fun withSearch(search: SearchResultPage?): Builder = this.apply { - this.search = { search } + public fun build(): Query = Query( + search = search + ) } - - public fun build(): Query = Query( - search = search, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/SearchResult.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/SearchResult.kt index 84de34236..efeedfda4 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/SearchResult.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/SearchResult.kt @@ -4,12 +4,14 @@ import com.fasterxml.jackson.`annotation`.JsonSubTypes import com.fasterxml.jackson.`annotation`.JsonTypeInfo @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" +) +@JsonSubTypes( + value = [ + JsonSubTypes.Type(value = Human::class, name = "Human"), + JsonSubTypes.Type(value = Droid::class, name = "Droid") + ] ) -@JsonSubTypes(value = [ - JsonSubTypes.Type(value = Human::class, name = "Human"), - JsonSubTypes.Type(value = Droid::class, name = "Droid") -]) public sealed interface SearchResult diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/SearchResultPage.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/SearchResultPage.kt index 460cff0e5..935b354dc 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/SearchResultPage.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionTypesWithoutInterfaceCanDeserialize/expected/types/SearchResultPage.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = SearchResultPage.Builder::class) public class SearchResultPage( - items: () -> List? = itemsDefault, + items: () -> List? = itemsDefault ) { - private val _items: () -> List? = items + private val _items: () -> List? = items - @get:JvmName("getItems") - public val items: List? - get() = _items.invoke() + @get:JvmName("getItems") + public val items: List? + get() = _items.invoke() - public companion object { - private val itemsDefault: () -> List? = - { throw IllegalStateException("Field `items` was not requested") } + public companion object { + private val itemsDefault: () -> List? = { throw IllegalStateException("Field `items` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var items: () -> List? = itemsDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var items: () -> List? = itemsDefault + @JsonProperty("items") + public fun withItems(items: List?): Builder = this.apply { + this.items = { items } + } - @JsonProperty("items") - public fun withItems(items: List?): Builder = this.apply { - this.items = { items } + public fun build(): SearchResultPage = SearchResultPage( + items = items + ) } - - public fun build(): SearchResultPage = SearchResultPage( - items = items, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/DgsClient.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/DgsClient.kt index e56a6592f..74433e148 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/DgsClient.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/DgsClient.kt @@ -6,6 +6,6 @@ import graphql.language.OperationDefinition import kotlin.String public object DgsClient { - public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = - GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) + public fun buildQuery(_projection: QueryProjection.() -> QueryProjection): String = + GraphQLProjection.asQuery(OperationDefinition.Operation.QUERY, QueryProjection(), _projection) } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/DgsConstants.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/DgsConstants.kt index e205c9083..3c90be3b6 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/DgsConstants.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/DgsConstants.kt @@ -3,33 +3,33 @@ package com.netflix.graphql.dgs.codegen.cases.unionWithExtendedType.expected import kotlin.String public object DgsConstants { - public const val QUERY_TYPE: String = "Query" + public const val QUERY_TYPE: String = "Query" - public object QUERY { - public const val TYPE_NAME: String = "Query" + public object QUERY { + public const val TYPE_NAME: String = "Query" - public const val Search: String = "search" - } + public const val Search: String = "search" + } - public object MOVIE { - public const val TYPE_NAME: String = "Movie" + public object MOVIE { + public const val TYPE_NAME: String = "Movie" - public const val Title: String = "title" - } + public const val Title: String = "title" + } - public object ACTOR { - public const val TYPE_NAME: String = "Actor" + public object ACTOR { + public const val TYPE_NAME: String = "Actor" - public const val Name: String = "name" - } + public const val Name: String = "name" + } - public object RATING { - public const val TYPE_NAME: String = "Rating" + public object RATING { + public const val TYPE_NAME: String = "Rating" - public const val Stars: String = "stars" - } + public const val Stars: String = "stars" + } - public object SEARCHRESULT { - public const val TYPE_NAME: String = "SearchResult" - } + public object SEARCHRESULT { + public const val TYPE_NAME: String = "SearchResult" + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/ActorProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/ActorProjection.kt index 3c1899cfd..14a4c2ed6 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/ActorProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/ActorProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.unionWithExtendedType.expected.cli import com.netflix.graphql.dgs.codegen.GraphQLProjection public class ActorProjection : GraphQLProjection() { - public val name: ActorProjection - get() { - field("name") - return this - } + public val name: ActorProjection + get() { + field("name") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/MovieProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/MovieProjection.kt index 9056dfb4e..facba695a 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/MovieProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/MovieProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.unionWithExtendedType.expected.cli import com.netflix.graphql.dgs.codegen.GraphQLProjection public class MovieProjection : GraphQLProjection() { - public val title: MovieProjection - get() { - field("title") - return this - } + public val title: MovieProjection + get() { + field("title") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/QueryProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/QueryProjection.kt index b26921e01..d18ecc7c8 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/QueryProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/QueryProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.unionWithExtendedType.expected.cli import com.netflix.graphql.dgs.codegen.GraphQLProjection public class QueryProjection : GraphQLProjection() { - public fun search(_projection: SearchResultProjection.() -> SearchResultProjection): - QueryProjection { - field("search", SearchResultProjection(), _projection) - return this - } + public fun search(_projection: SearchResultProjection.() -> SearchResultProjection): + QueryProjection { + field("search", SearchResultProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/RatingProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/RatingProjection.kt index 69fbc6038..a30b7a7f3 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/RatingProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/RatingProjection.kt @@ -3,9 +3,9 @@ package com.netflix.graphql.dgs.codegen.cases.unionWithExtendedType.expected.cli import com.netflix.graphql.dgs.codegen.GraphQLProjection public class RatingProjection : GraphQLProjection() { - public val stars: RatingProjection - get() { - field("stars") - return this - } + public val stars: RatingProjection + get() { + field("stars") + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/SearchResultProjection.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/SearchResultProjection.kt index 844891561..46ec76d6d 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/SearchResultProjection.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/client/SearchResultProjection.kt @@ -3,19 +3,19 @@ package com.netflix.graphql.dgs.codegen.cases.unionWithExtendedType.expected.cli import com.netflix.graphql.dgs.codegen.GraphQLProjection public class SearchResultProjection : GraphQLProjection() { - public fun onMovie(_projection: MovieProjection.() -> MovieProjection): SearchResultProjection { - fragment("Movie", MovieProjection(), _projection) - return this - } + public fun onMovie(_projection: MovieProjection.() -> MovieProjection): SearchResultProjection { + fragment("Movie", MovieProjection(), _projection) + return this + } - public fun onActor(_projection: ActorProjection.() -> ActorProjection): SearchResultProjection { - fragment("Actor", ActorProjection(), _projection) - return this - } + public fun onActor(_projection: ActorProjection.() -> ActorProjection): SearchResultProjection { + fragment("Actor", ActorProjection(), _projection) + return this + } - public fun onRating(_projection: RatingProjection.() -> RatingProjection): - SearchResultProjection { - fragment("Rating", RatingProjection(), _projection) - return this - } + public fun onRating(_projection: RatingProjection.() -> RatingProjection): + SearchResultProjection { + fragment("Rating", RatingProjection(), _projection) + return this + } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/Actor.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/Actor.kt index 1c6590f5c..8b1632b14 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/Actor.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/Actor.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Actor.Builder::class) public class Actor( - name: () -> String? = nameDefault, + name: () -> String? = nameDefault ) : SearchResult { - private val _name: () -> String? = name + private val _name: () -> String? = name - @get:JvmName("getName") - public val name: String? - get() = _name.invoke() + @get:JvmName("getName") + public val name: String? + get() = _name.invoke() - public companion object { - private val nameDefault: () -> String? = - { throw IllegalStateException("Field `name` was not requested") } + public companion object { + private val nameDefault: () -> String? = { throw IllegalStateException("Field `name` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var name: () -> String? = nameDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var name: () -> String? = nameDefault + @JsonProperty("name") + public fun withName(name: String?): Builder = this.apply { + this.name = { name } + } - @JsonProperty("name") - public fun withName(name: String?): Builder = this.apply { - this.name = { name } + public fun build(): Actor = Actor( + name = name + ) } - - public fun build(): Actor = Actor( - name = name, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/Movie.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/Movie.kt index cd100e0f4..9e2b28f9c 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/Movie.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/Movie.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Movie.Builder::class) public class Movie( - title: () -> String? = titleDefault, + title: () -> String? = titleDefault ) : SearchResult { - private val _title: () -> String? = title + private val _title: () -> String? = title - @get:JvmName("getTitle") - public val title: String? - get() = _title.invoke() + @get:JvmName("getTitle") + public val title: String? + get() = _title.invoke() - public companion object { - private val titleDefault: () -> String? = - { throw IllegalStateException("Field `title` was not requested") } + public companion object { + private val titleDefault: () -> String? = { throw IllegalStateException("Field `title` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var title: () -> String? = titleDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var title: () -> String? = titleDefault + @JsonProperty("title") + public fun withTitle(title: String?): Builder = this.apply { + this.title = { title } + } - @JsonProperty("title") - public fun withTitle(title: String?): Builder = this.apply { - this.title = { title } + public fun build(): Movie = Movie( + title = title + ) } - - public fun build(): Movie = Movie( - title = title, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/Query.kt index 80200673f..075d1d753 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/Query.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Query.Builder::class) public class Query( - search: () -> List? = searchDefault, + search: () -> List? = searchDefault ) { - private val _search: () -> List? = search + private val _search: () -> List? = search - @get:JvmName("getSearch") - public val search: List? - get() = _search.invoke() + @get:JvmName("getSearch") + public val search: List? + get() = _search.invoke() - public companion object { - private val searchDefault: () -> List? = - { throw IllegalStateException("Field `search` was not requested") } + public companion object { + private val searchDefault: () -> List? = { throw IllegalStateException("Field `search` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var search: () -> List? = searchDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var search: () -> List? = searchDefault + @JsonProperty("search") + public fun withSearch(search: List?): Builder = this.apply { + this.search = { search } + } - @JsonProperty("search") - public fun withSearch(search: List?): Builder = this.apply { - this.search = { search } + public fun build(): Query = Query( + search = search + ) } - - public fun build(): Query = Query( - search = search, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/Rating.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/Rating.kt index 1d75464ec..6cf3a03cc 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/Rating.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/Rating.kt @@ -12,32 +12,30 @@ import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Rating.Builder::class) public class Rating( - stars: () -> Int? = starsDefault, + stars: () -> Int? = starsDefault ) : SearchResult { - private val _stars: () -> Int? = stars + private val _stars: () -> Int? = stars - @get:JvmName("getStars") - public val stars: Int? - get() = _stars.invoke() + @get:JvmName("getStars") + public val stars: Int? + get() = _stars.invoke() - public companion object { - private val starsDefault: () -> Int? = - { throw IllegalStateException("Field `stars` was not requested") } + public companion object { + private val starsDefault: () -> Int? = { throw IllegalStateException("Field `stars` was not requested") } + } - } + @JsonPOJOBuilder + @JsonIgnoreProperties("__typename") + public class Builder { + private var stars: () -> Int? = starsDefault - @JsonPOJOBuilder - @JsonIgnoreProperties("__typename") - public class Builder { - private var stars: () -> Int? = starsDefault + @JsonProperty("stars") + public fun withStars(stars: Int?): Builder = this.apply { + this.stars = { stars } + } - @JsonProperty("stars") - public fun withStars(stars: Int?): Builder = this.apply { - this.stars = { stars } + public fun build(): Rating = Rating( + stars = stars + ) } - - public fun build(): Rating = Rating( - stars = stars, - ) - } } diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/SearchResult.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/SearchResult.kt index c985525bb..047785a73 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/SearchResult.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/unionWithExtendedType/expected/types/SearchResult.kt @@ -4,13 +4,15 @@ import com.fasterxml.jackson.`annotation`.JsonSubTypes import com.fasterxml.jackson.`annotation`.JsonTypeInfo @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "__typename", + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "__typename" +) +@JsonSubTypes( + value = [ + JsonSubTypes.Type(value = Movie::class, name = "Movie"), + JsonSubTypes.Type(value = Actor::class, name = "Actor"), + JsonSubTypes.Type(value = Rating::class, name = "Rating") + ] ) -@JsonSubTypes(value = [ - JsonSubTypes.Type(value = Movie::class, name = "Movie"), - JsonSubTypes.Type(value = Actor::class, name = "Actor"), - JsonSubTypes.Type(value = Rating::class, name = "Rating") -]) public sealed interface SearchResult diff --git a/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/CodeGenCli.kt b/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/CodeGenCli.kt index 9a2b1eaa6..1b0f150f6 100644 --- a/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/CodeGenCli.kt +++ b/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/CodeGenCli.kt @@ -59,6 +59,7 @@ class CodeGenCli : CliktCommand("Generate Java sources for SCHEMA file(s)") { private val shortProjectionNames by option("--short-projection-names").flag() private val generateInterfaceSetters by option("--generate-interface-setters").flag() private val generateDocs by option("--generate-docs").flag() + // Generate an additional bitset field and supporting getters, setters, builder functions for data classes private val generateFieldIsSet by option("--generate-field-is-set", help = "Generate an additional bitset field and supporting getters, setters, and builder functions for data classes").flag(default = false) diff --git a/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/java/DataTypeGenerator.kt b/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/java/DataTypeGenerator.kt index 64ab49c0a..3a491e4a1 100644 --- a/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/java/DataTypeGenerator.kt +++ b/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/java/DataTypeGenerator.kt @@ -19,7 +19,6 @@ package com.netflix.graphql.dgs.codegen.generators.java import com.netflix.graphql.dgs.codegen.* -import com.netflix.graphql.dgs.codegen.generators.shared.CodeGeneratorUtils.capitalized import com.netflix.graphql.dgs.codegen.generators.shared.SiteTarget import com.netflix.graphql.dgs.codegen.generators.shared.applyDirectivesJava import com.squareup.javapoet.* @@ -224,7 +223,7 @@ abstract class BaseDataTypeGenerator( addParameterizedConstructor(fields, javaType) } - if(config.generateFieldIsSet) { + if (config.generateFieldIsSet) { addBitsetField(javaType) addBitSetEnum(fields, javaType) } @@ -383,26 +382,28 @@ abstract class BaseDataTypeGenerator( .enumBuilder("Field") .addModifiers(Modifier.PUBLIC) .addField(FieldSpec.builder(ClassName.INT, "ordinal").initializer("-1").build()) - .addMethod(MethodSpec - .methodBuilder("getOrdinal") - .addModifiers(Modifier.PUBLIC) - .returns(ClassName.INT) - .addCode( - """ + .addMethod( + MethodSpec + .methodBuilder("getOrdinal") + .addModifiers(Modifier.PUBLIC) + .returns(ClassName.INT) + .addCode( + """ |return ordinal; - """.trimMargin() - ) - .build() + """.trimMargin() + ) + .build() ) - .addMethod(MethodSpec - .constructorBuilder() - .addParameter(ClassName.INT, "ordinal") - .addCode( - """ + .addMethod( + MethodSpec + .constructorBuilder() + .addParameter(ClassName.INT, "ordinal") + .addCode( + """ |this.ordinal = ordinal; - """.trimMargin() - ) - .build() + """.trimMargin() + ) + .build() ) fields.forEach { @@ -428,7 +429,6 @@ abstract class BaseDataTypeGenerator( javaType.addMethod(isSetGetter.build()) } - private fun addFieldWithGetterAndSetter(returnType: com.squareup.javapoet.TypeName?, fieldDefinition: Field, javaType: TypeSpec.Builder) { val fieldBuilder = if (fieldDefinition.initialValue != null) { FieldSpec @@ -465,7 +465,7 @@ abstract class BaseDataTypeGenerator( ReservedKeywordSanitizer.sanitize(fieldDefinition.name) ) - if(config.generateFieldIsSet) { + if (config.generateFieldIsSet) { setterMethodBuilder.addStatement( "setField(Field.\$N)", ReservedKeywordSanitizer.sanitize(fieldDefinition.name.uppercase()) @@ -508,26 +508,26 @@ abstract class BaseDataTypeGenerator( private fun addBuilder(javaType: TypeSpec.Builder) { val className = ClassName.get(packageName, javaType.build().name) - val buildMethod = if(config.generateFieldIsSet) { - MethodSpec.methodBuilder("build").returns(className).addCode( - """ + val buildMethod = if (config.generateFieldIsSet) { + MethodSpec.methodBuilder("build").returns(className).addCode( + """ $className result = new $className(); -${javaType.build().fieldSpecs.filter{it.name!="fieldsPresent"}.joinToString("\n") { "result.${it.name} = this.${it.name};" }} +${javaType.build().fieldSpecs.filter{it.name != "fieldsPresent"}.joinToString("\n") { "result.${it.name} = this.${it.name};" }} for (Field field: Field.values()) { if (this.isSet(field)) { result.setField(field); } } return result; - """.trimIndent() - ) + """.trimIndent() + ) } else { MethodSpec.methodBuilder("build").returns(className).addCode( """ $className result = new $className(); ${javaType.build().fieldSpecs.joinToString("\n") { "result.${it.name} = this.${it.name};" }} return result; - """.trimIndent() + """.trimIndent() ) }.addModifiers(Modifier.PUBLIC).build() @@ -542,8 +542,6 @@ return result; javaType.addMethod(newBuilderMethod) - - val builderType = TypeSpec .classBuilder("Builder") @@ -551,16 +549,16 @@ return result; .addModifiers(Modifier.PUBLIC, Modifier.STATIC) .addMethod(buildMethod) - if(config.generateFieldIsSet) { + if (config.generateFieldIsSet) { addBitsetFieldGetterAndSetter(builderType) } - javaType.build().fieldSpecs.filter{it.name!="fieldsPresent"}.map { + javaType.build().fieldSpecs.filter { it.name != "fieldsPresent" }.map { var methodBuilder = MethodSpec.methodBuilder(it.name) .addJavadoc(it.javadoc) .returns(builderClassName) .addStatement("this.${it.name} = ${it.name}") - if(config.generateFieldIsSet) { + if (config.generateFieldIsSet) { methodBuilder.addStatement( "setField(Field.\$N)", ReservedKeywordSanitizer.sanitize(it.name.uppercase()) diff --git a/graphql-dgs-codegen-core/src/test/kotlin/com/netflix/graphql/dgs/codegen/CodeGenTest.kt b/graphql-dgs-codegen-core/src/test/kotlin/com/netflix/graphql/dgs/codegen/CodeGenTest.kt index 9bf85fe5d..d10013c0e 100644 --- a/graphql-dgs-codegen-core/src/test/kotlin/com/netflix/graphql/dgs/codegen/CodeGenTest.kt +++ b/graphql-dgs-codegen-core/src/test/kotlin/com/netflix/graphql/dgs/codegen/CodeGenTest.kt @@ -2642,13 +2642,13 @@ class CodeGenTest { assertThat(typeSpec.methodSpecs).extracting("name").contains("setField", "isSet") - var setFieldMethod = typeSpec.methodSpecs.find{it.name == "setField"} + var setFieldMethod = typeSpec.methodSpecs.find { it.name == "setField" } assertThat(setFieldMethod?.code.toString().trim()).isEqualTo("fieldsPresent.set(field.getOrdinal());") - var isSetMethod = typeSpec.methodSpecs.find{it.name == "isSet"} + var isSetMethod = typeSpec.methodSpecs.find { it.name == "isSet" } assertThat(isSetMethod?.code.toString().trim()).isEqualTo("return fieldsPresent.get(field.getOrdinal());") - var setTitleMethod = typeSpec.methodSpecs.find{it.name == "setTitle"} + var setTitleMethod = typeSpec.methodSpecs.find { it.name == "setTitle" } assertThat(setTitleMethod?.code.toString().trim()).isEqualTo( """ | this.title = title; @@ -2668,11 +2668,11 @@ class CodeGenTest { assertThat(typeSpec.typeSpecs[1].kind).isEqualTo(TypeSpec.Kind.CLASS) assertThat(typeSpec.typeSpecs[1].name).isEqualTo("Builder") - val builderSpec = typeSpec.typeSpecs.find{it.name == "Builder"} + val builderSpec = typeSpec.typeSpecs.find { it.name == "Builder" } assertThat(builderSpec?.fieldSpecs).extracting("name").contains("fieldsPresent") - val buildMethod = builderSpec?.methodSpecs?.find{it.name == "build"} + val buildMethod = builderSpec?.methodSpecs?.find { it.name == "build" } assertThat(buildMethod?.code.toString()) .isEqualTo( """ @@ -2691,13 +2691,13 @@ class CodeGenTest { assertThat(builderSpec?.methodSpecs).extracting("name").contains("setField", "isSet") - setFieldMethod = builderSpec?.methodSpecs?.find{it.name == "setField"} + setFieldMethod = builderSpec?.methodSpecs?.find { it.name == "setField" } assertThat(setFieldMethod?.code.toString().trim()).isEqualTo("fieldsPresent.set(field.getOrdinal());") - isSetMethod = builderSpec?.methodSpecs?.find{it.name == "isSet"} + isSetMethod = builderSpec?.methodSpecs?.find { it.name == "isSet" } assertThat(isSetMethod?.code.toString().trim()).isEqualTo("return fieldsPresent.get(field.getOrdinal());") - setTitleMethod = builderSpec?.methodSpecs?.find{it.name == "title"} + setTitleMethod = builderSpec?.methodSpecs?.find { it.name == "title" } assertThat(setTitleMethod?.code.toString().trim()).isEqualTo( """ | this.title = title; @@ -2736,7 +2736,7 @@ class CodeGenTest { val codeGenResult = CodeGen( CodeGenConfig( schemas = setOf(schema), - packageName = basePackageName, + packageName = basePackageName ) ).generate() @@ -2751,7 +2751,7 @@ class CodeGenTest { assertThat(typeSpec.fieldSpecs).extracting("name").doesNotContain("fieldsPresent") assertThat(typeSpec.methodSpecs).extracting("name").doesNotContain("setField", "isSet") - var setTitleMethod = typeSpec.methodSpecs.find{it.name == "setTitle"} + var setTitleMethod = typeSpec.methodSpecs.find { it.name == "setTitle" } assertThat(setTitleMethod?.code.toString().trim()).isEqualTo( """ | this.title = title; @@ -2765,11 +2765,11 @@ class CodeGenTest { assertThat(typeSpec.typeSpecs[0].kind).isEqualTo(TypeSpec.Kind.CLASS) assertThat(typeSpec.typeSpecs[0].name).isEqualTo("Builder") - val builderSpec = typeSpec.typeSpecs.find{it.name == "Builder"} + val builderSpec = typeSpec.typeSpecs.find { it.name == "Builder" } assertThat(builderSpec?.fieldSpecs).extracting("name").doesNotContain("fieldsPresent") - val buildMethod = builderSpec?.methodSpecs?.find{it.name == "build"} + val buildMethod = builderSpec?.methodSpecs?.find { it.name == "build" } assertThat(buildMethod?.code.toString()) .isEqualTo( """ @@ -2783,7 +2783,7 @@ class CodeGenTest { assertThat(builderSpec?.methodSpecs).extracting("name").doesNotContain("setField", "isSet") - setTitleMethod = builderSpec?.methodSpecs?.find{it.name == "title"} + setTitleMethod = builderSpec?.methodSpecs?.find { it.name == "title" } assertThat(setTitleMethod?.code.toString().trim()).isEqualTo( """ | this.title = title;