From 745b6c984641b5961490ccdcd132135db1c450cf Mon Sep 17 00:00:00 2001 From: yshepilov Date: Mon, 3 Aug 2026 10:12:55 +0200 Subject: [PATCH 1/3] Generate value-based equals/hashCode for kotlin2 data types kotlin2 response/data types (generateKotlinNullableClasses = true) had no equals/hashCode and compared by identity, since their fields are backed by lazy supplier lambdas that throw when a field wasn't requested. Add generated equals/hashCode where two instances are equal iff they requested the same set of fields and every requested field's value is equal; an unrequested field's supplier is never invoked. This mirrors the semantics and CodeBlock style of the existing Java DataTypeGenerator.addEquals/ addHashcode. Regenerates all kotlin2 integration-test golden expected files. --- .../graphql/dgs/codegen/Kotlin2CodeGenTest.kt | 62 ++++++++++ .../expected/types/Person.kt | 17 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/Person.kt | 17 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/Person.kt | 17 +++ .../expected/types/Query.kt | 17 +++ .../expected/types/Person.kt | 20 ++++ .../expected/types/Query.kt | 14 +++ .../dataClassDocs/expected/types/Movie.kt | 13 +++ .../dataClassDocs/expected/types/Query.kt | 14 +++ .../expected/types/Movie.kt | 13 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/Query.kt | 13 +++ .../expected/types/Query.kt | 13 +++ .../expected/types/RequiredTestType.kt | 13 +++ .../expected/types/Entity.kt | 16 +++ .../expected/types/EntityConnection.kt | 17 +++ .../expected/types/EntityEdge.kt | 17 +++ .../expected/types/PageInfo.kt | 23 ++++ .../expected/types/Query.kt | 18 +++ .../expected/types/Car.kt | 19 ++++ .../expected/types/Engine.kt | 21 ++++ .../expected/types/Performance.kt | 17 +++ .../expected/types/Query.kt | 13 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/Employee.kt | 22 ++++ .../expected/types/Query.kt | 14 +++ .../expected/types/Employee.kt | 20 ++++ .../expected/types/Query.kt | 14 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/Talent.kt | 23 ++++ .../expected/types/Person.kt | 16 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/Product.kt | 13 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/Entity.kt | 16 +++ .../expected/types/EntityEdge.kt | 17 +++ .../expected/types/Query.kt | 18 +++ .../expected/types/Employee.kt | 20 ++++ .../expected/types/Query.kt | 14 +++ .../expected/types/MyType.kt | 13 +++ .../expected/types/OtherType.kt | 13 +++ .../expected/types/Person.kt | 16 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/MyType.kt | 17 +++ .../expected/types/MyType.kt | 17 +++ .../expected/types/Person.kt | 16 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/MyType.kt | 17 +++ .../expected/types/Person.kt | 20 ++++ .../expected/types/Query.kt | 14 +++ .../expected/types/Person.kt | 16 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/SampleType.kt | 14 +++ .../expected/types/Person.kt | 17 +++ .../expected/types/Query.kt | 14 +++ .../cases/enum/expected/types/Query.kt | 13 +++ .../expected/types/Query.kt | 13 +++ .../expected/types/Example.kt | 15 +++ .../cases/input/expected/types/Query.kt | 14 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/Bird.kt | 28 +++++ .../expected/types/Dog.kt | 28 +++++ .../expected/types/Dog.kt | 16 +++ .../expected/types/Vegetarian.kt | 17 +++ .../expected/types/Employee.kt | 20 ++++ .../expected/types/Query.kt | 14 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/Seed.kt | 13 +++ .../expected/types/Query.kt | 13 +++ .../expected/types/T.kt | 16 +++ .../expected/types/Query.kt | 16 +++ .../expected/types/Query.kt | 16 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/Query.kt | 17 +++ .../expected/types/Employee.kt | 17 +++ .../expected/types/Query.kt | 17 +++ .../expected/types/Employee.kt | 17 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/Employee.kt | 17 +++ .../expected/types/Query.kt | 16 +++ .../expected/types/Person.kt | 13 +++ .../expected/types/Person.kt | 13 +++ .../cases/union/expected/types/Actor.kt | 13 +++ .../cases/union/expected/types/Movie.kt | 13 +++ .../cases/union/expected/types/Query.kt | 14 +++ .../expected/types/Droid.kt | 20 ++++ .../expected/types/Human.kt | 18 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/SearchResultPage.kt | 13 +++ .../expected/types/Actor.kt | 13 +++ .../expected/types/Movie.kt | 13 +++ .../expected/types/Query.kt | 14 +++ .../expected/types/Rating.kt | 12 ++ .../kotlin2/GenerateKotlin2DataTypes.kt | 107 +++++++++++++++++- 99 files changed, 1695 insertions(+), 1 deletion(-) diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/Kotlin2CodeGenTest.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/Kotlin2CodeGenTest.kt index 4c5b85d0..d762a96f 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/Kotlin2CodeGenTest.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/Kotlin2CodeGenTest.kt @@ -333,6 +333,68 @@ class Kotlin2CodeGenTest { assertCompilesKotlin(result) } + @Test + fun `equals and hashCode compare requested fields by value, at runtime`() { + val schema = + """ + type Item { + name: String + age: Int + } + """.trimIndent() + + val result = + CodeGen( + CodeGenConfig( + schemas = setOf(schema), + packageName = "com.netflix.test.equalshashcode", + language = Language.KOTLIN, + generateKotlinNullableClasses = true, + generateKotlinClosureProjections = true, + ), + ).generate() + + val buildDir = assertCompilesKotlin(result) + val classLoader = URLClassLoader(arrayOf(buildDir.toUri().toURL()), this.javaClass.classLoader) + val builderClass = classLoader.loadClass("com.netflix.test.equalshashcode.types.Item\$Builder") + val withNameMethod = builderClass.getMethod("withName", String::class.java) + val withAgeMethod = builderClass.getMethod("withAge", Integer::class.java) + val buildMethod = builderClass.getMethod("build") + + fun newItem( + name: String?, + requestName: Boolean, + age: Int?, + requestAge: Boolean, + ): Any { + val builder = builderClass.getDeclaredConstructor().newInstance() + if (requestName) withNameMethod.invoke(builder, name) + if (requestAge) withAgeMethod.invoke(builder, age) + return buildMethod.invoke(builder) + } + + // Same projection, same values -> equal, and hashCode is consistent with equals. + val sameProjectionA = newItem("Alice", requestName = true, age = 30, requestAge = true) + val sameProjectionB = newItem("Alice", requestName = true, age = 30, requestAge = true) + assertThat(sameProjectionA).isEqualTo(sameProjectionB) + assertThat(sameProjectionA.hashCode()).isEqualTo(sameProjectionB.hashCode()) + + // `age` requested on only one side -> not equal, in both directions, and does not throw. + val onlyNameRequested = newItem("Alice", requestName = true, age = null, requestAge = false) + assertThat(sameProjectionA).isNotEqualTo(onlyNameRequested) + assertThat(onlyNameRequested).isNotEqualTo(sameProjectionA) + + // `age` unrequested on both sides -> equal without invoking the throwing supplier. + val onlyNameRequestedTwin = newItem("Alice", requestName = true, age = null, requestAge = false) + assertThat(onlyNameRequested).isEqualTo(onlyNameRequestedTwin) + assertThat(onlyNameRequested.hashCode()).isEqualTo(onlyNameRequestedTwin.hashCode()) + + // `age` requested-but-null vs. `age` absent -> not equal. + val nameRequestedNullAge = newItem("Alice", requestName = true, age = null, requestAge = true) + assertThat(onlyNameRequested).isNotEqualTo(nameRequestedNullAge) + assertThat(nameRequestedNullAge).isNotEqualTo(onlyNameRequested) + } + companion object { @Suppress("unused") @JvmStatic 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 d1763bac..efe7c479 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.constantsForInputTypes.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -29,6 +33,19 @@ public class Person( public val lastname: String? get() = __lastname.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Person) return false + return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && + (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && + (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === + lastnameDefault || Objects.equals(lastname, other.lastname)) + } + + override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault + else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname) + @Generated public companion object { private val firstnameDefault: () -> String? = 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 867f3259..6724fa67 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.constantsForInputTypes.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val people: List? get() = __people.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === + peopleDefault || Objects.equals(people, other.people)) + } + + override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else + people) + @Generated public companion object { private val peopleDefault: () -> List? = 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 05d1bcbb..5ee47b8d 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedInputTypes.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -29,6 +33,19 @@ public class Person( public val lastname: String? get() = __lastname.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Person) return false + return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && + (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && + (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === + lastnameDefault || Objects.equals(lastname, other.lastname)) + } + + override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault + else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname) + @Generated public companion object { private val firstnameDefault: () -> String? = 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 74aae422..9b8aa1c0 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedInputTypes.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val people: List? get() = __people.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === + peopleDefault || Objects.equals(people, other.people)) + } + + override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else + people) + @Generated public companion object { private val peopleDefault: () -> List? = 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 c2420035..ef131074 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedInterface.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val people: List? get() = __people.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === + peopleDefault || Objects.equals(people, other.people)) + } + + override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else + people) + @Generated public companion object { private val peopleDefault: () -> List? = 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 00098ad8..8e5d2a01 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedQuery.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -29,6 +33,19 @@ public class Person( public val lastname: String? get() = __lastname.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Person) return false + return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && + (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && + (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === + lastnameDefault || Objects.equals(lastname, other.lastname)) + } + + override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault + else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname) + @Generated public companion object { private val firstnameDefault: () -> String? = 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 18106a44..b830928b 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedQuery.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -29,6 +33,19 @@ public class Query( public val friends: List? get() = __friends.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === + peopleDefault || Objects.equals(people, other.people)) && + (__friends === friendsDefault) == (other.__friends === friendsDefault) && (__friends === + friendsDefault || Objects.equals(friends, other.friends)) + } + + override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else + people, + if (__friends === friendsDefault) friendsDefault else friends) + @Generated public companion object { private val peopleDefault: () -> List? = 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 fc0e0103..9fb9241e 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedTypes.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -36,6 +40,22 @@ public class Person( public val email: String? get() = __email.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Person) return false + return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && + (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && + (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === + lastnameDefault || Objects.equals(lastname, other.lastname)) && + (__email === emailDefault) == (other.__email === emailDefault) && (__email === emailDefault || + Objects.equals(email, other.email)) + } + + override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault + else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname, + if (__email === emailDefault) emailDefault else email) + @Generated public companion object { private val firstnameDefault: () -> String? = 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 802d4b6f..c000eb4e 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedTypes.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val people: List? get() = __people.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === + peopleDefault || Objects.equals(people, other.people)) + } + + override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else + people) + @Generated public companion object { private val peopleDefault: () -> List? = 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 50ea0d9d..7122c56d 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassDocs.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -26,6 +30,15 @@ public class Movie( public val title: String? get() = __title.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Movie) return false + return (__title === titleDefault) == (other.__title === titleDefault) && (__title === + titleDefault || Objects.equals(title, other.title)) + } + + override fun hashCode(): Int = Objects.hash(if (__title === titleDefault) titleDefault else title) + @Generated public companion object { private val titleDefault: () -> String? = 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 c77209a0..7d8b4cdf 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassDocs.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.jvm.JvmName @Generated @@ -21,6 +25,16 @@ public class Query( public val search: Movie? get() = __search.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__search === searchDefault) == (other.__search === searchDefault) && (__search === + searchDefault || Objects.equals(search, other.search)) + } + + override fun hashCode(): Int = Objects.hash(if (__search === searchDefault) searchDefault else + search) + @Generated public companion object { private val searchDefault: () -> Movie? = 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 d54c13c9..c9610419 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassFieldDocs.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -25,6 +29,15 @@ public class Movie( public val title: String? get() = __title.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Movie) return false + return (__title === titleDefault) == (other.__title === titleDefault) && (__title === + titleDefault || Objects.equals(title, other.title)) + } + + override fun hashCode(): Int = Objects.hash(if (__title === titleDefault) titleDefault else title) + @Generated public companion object { private val titleDefault: () -> String? = 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 e48e0b95..dc120ce7 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassFieldDocs.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.jvm.JvmName @Generated @@ -21,6 +25,16 @@ public class Query( public val search: Movie? get() = __search.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__search === searchDefault) == (other.__search === searchDefault) && (__search === + searchDefault || Objects.equals(search, other.search)) + } + + override fun hashCode(): Int = Objects.hash(if (__search === searchDefault) searchDefault else + search) + @Generated public companion object { private val searchDefault: () -> Movie? = 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 49770de7..5d9dd7ec 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWIthNoFields.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.jvm.JvmName @Generated @@ -21,6 +25,15 @@ public class Query( public val me: Person? get() = __me.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__me === meDefault) == (other.__me === meDefault) && (__me === meDefault || + Objects.equals(me, other.me)) + } + + override fun hashCode(): Int = Objects.hash(if (__me === meDefault) meDefault else me) + @Generated public companion object { private val meDefault: () -> Person? = 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 ac3c921b..02ec3c3a 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithBooleanField.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.jvm.JvmName @Generated @@ -21,6 +25,15 @@ public class Query( public val test: RequiredTestType? get() = __test.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__test === testDefault) == (other.__test === testDefault) && (__test === testDefault || + Objects.equals(test, other.test)) + } + + override fun hashCode(): Int = Objects.hash(if (__test === testDefault) testDefault else test) + @Generated public companion object { private val testDefault: () -> RequiredTestType? = 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 9d5b1e95..ccf6f121 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 @@ -7,7 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithBooleanField.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any import kotlin.Boolean +import kotlin.Int import kotlin.jvm.JvmName @Generated @@ -22,6 +25,16 @@ public class RequiredTestType( public val isRequired: Boolean get() = __isRequired.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is RequiredTestType) return false + return (__isRequired === isRequiredDefault) == (other.__isRequired === isRequiredDefault) && + (__isRequired === isRequiredDefault || Objects.equals(isRequired, other.isRequired)) + } + + override fun hashCode(): Int = Objects.hash(if (__isRequired === isRequiredDefault) + isRequiredDefault else isRequired) + @Generated public companion object { private val isRequiredDefault: () -> Boolean = 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 591f4376..11e10b57 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 @@ -8,6 +8,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expected.Generated import java.lang.IllegalStateException import java.time.OffsetDateTime +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.Long import kotlin.jvm.JvmName @@ -30,6 +34,18 @@ public class Entity( public val dateTime: OffsetDateTime? get() = __dateTime.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Entity) return false + return (__long === longDefault) == (other.__long === longDefault) && (__long === longDefault || + Objects.equals(long, other.long)) && + (__dateTime === dateTimeDefault) == (other.__dateTime === dateTimeDefault) && (__dateTime === + dateTimeDefault || Objects.equals(dateTime, other.dateTime)) + } + + override fun hashCode(): Int = Objects.hash(if (__long === longDefault) longDefault else long, + if (__dateTime === dateTimeDefault) dateTimeDefault else dateTime) + @Generated public companion object { private val longDefault: () -> Long? = 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 3aa2af32..1d4407bb 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -29,6 +33,19 @@ public class EntityConnection( public val edges: List? get() = __edges.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is EntityConnection) return false + return (__pageInfo === pageInfoDefault) == (other.__pageInfo === pageInfoDefault) && (__pageInfo + === pageInfoDefault || Objects.equals(pageInfo, other.pageInfo)) && + (__edges === edgesDefault) == (other.__edges === edgesDefault) && (__edges === edgesDefault || + Objects.equals(edges, other.edges)) + } + + override fun hashCode(): Int = Objects.hash(if (__pageInfo === pageInfoDefault) pageInfoDefault + else pageInfo, + if (__edges === edgesDefault) edgesDefault else edges) + @Generated public companion object { private val pageInfoDefault: () -> PageInfo = 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 69760476..f13d02a1 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -29,6 +33,19 @@ public class EntityEdge( public val node: Entity? get() = __node.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is EntityEdge) return false + return (__cursor === cursorDefault) == (other.__cursor === cursorDefault) && (__cursor === + cursorDefault || Objects.equals(cursor, other.cursor)) && + (__node === nodeDefault) == (other.__node === nodeDefault) && (__node === nodeDefault || + Objects.equals(node, other.node)) + } + + override fun hashCode(): Int = Objects.hash(if (__cursor === cursorDefault) cursorDefault else + cursor, + if (__node === nodeDefault) nodeDefault else node) + @Generated public companion object { private val cursorDefault: () -> String = 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 88d1c7c1..5bf1e279 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 @@ -7,7 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -44,6 +47,26 @@ public class PageInfo( public val hasPreviousPage: Boolean get() = __hasPreviousPage.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is PageInfo) return false + return (__startCursor === startCursorDefault) == (other.__startCursor === startCursorDefault) && + (__startCursor === startCursorDefault || Objects.equals(startCursor, other.startCursor)) && + (__endCursor === endCursorDefault) == (other.__endCursor === endCursorDefault) && (__endCursor + === endCursorDefault || Objects.equals(endCursor, other.endCursor)) && + (__hasNextPage === hasNextPageDefault) == (other.__hasNextPage === hasNextPageDefault) && + (__hasNextPage === hasNextPageDefault || Objects.equals(hasNextPage, other.hasNextPage)) && + (__hasPreviousPage === hasPreviousPageDefault) == (other.__hasPreviousPage === + hasPreviousPageDefault) && (__hasPreviousPage === hasPreviousPageDefault || + Objects.equals(hasPreviousPage, other.hasPreviousPage)) + } + + override fun hashCode(): Int = Objects.hash(if (__startCursor === startCursorDefault) + startCursorDefault else startCursor, + if (__endCursor === endCursorDefault) endCursorDefault else endCursor, + if (__hasNextPage === hasNextPageDefault) hasNextPageDefault else hasNextPage, + if (__hasPreviousPage === hasPreviousPageDefault) hasPreviousPageDefault else hasPreviousPage) + @Generated public companion object { private val startCursorDefault: () -> String? = 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 1000c951..870b3b71 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -29,6 +33,20 @@ public class Query( public val entityConnection: EntityConnection? get() = __entityConnection.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__entity === entityDefault) == (other.__entity === entityDefault) && (__entity === + entityDefault || Objects.equals(entity, other.entity)) && + (__entityConnection === entityConnectionDefault) == (other.__entityConnection === + entityConnectionDefault) && (__entityConnection === entityConnectionDefault || + Objects.equals(entityConnection, other.entityConnection)) + } + + override fun hashCode(): Int = Objects.hash(if (__entity === entityDefault) entityDefault else + entity, + if (__entityConnection === entityConnectionDefault) entityConnectionDefault else entityConnection) + @Generated public companion object { private val entityDefault: () -> List? = 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 d0553d90..97b0f9aa 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithDeeplyNestedComplexField.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -36,6 +40,21 @@ public class Car( public val engine: Engine? get() = __engine.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Car) return false + return (__make === makeDefault) == (other.__make === makeDefault) && (__make === makeDefault || + Objects.equals(make, other.make)) && + (__model === modelDefault) == (other.__model === modelDefault) && (__model === modelDefault || + Objects.equals(model, other.model)) && + (__engine === engineDefault) == (other.__engine === engineDefault) && (__engine === + engineDefault || Objects.equals(engine, other.engine)) + } + + override fun hashCode(): Int = Objects.hash(if (__make === makeDefault) makeDefault else make, + if (__model === modelDefault) modelDefault else model, + if (__engine === engineDefault) engineDefault else engine) + @Generated public companion object { private val makeDefault: () -> String? = 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 dd50e0fb..bc77be98 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 @@ -7,6 +7,9 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithDeeplyNestedComplexField.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean import kotlin.Double import kotlin.Int import kotlin.String @@ -45,6 +48,24 @@ public class Engine( public val performance: Performance? get() = __performance.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Engine) return false + return (__type === typeDefault) == (other.__type === typeDefault) && (__type === typeDefault || + Objects.equals(type, other.type)) && + (__bhp === bhpDefault) == (other.__bhp === bhpDefault) && (__bhp === bhpDefault || + Objects.equals(bhp, other.bhp)) && + (__size === sizeDefault) == (other.__size === sizeDefault) && (__size === sizeDefault || + Objects.equals(size, other.size)) && + (__performance === performanceDefault) == (other.__performance === performanceDefault) && + (__performance === performanceDefault || Objects.equals(performance, other.performance)) + } + + override fun hashCode(): Int = Objects.hash(if (__type === typeDefault) typeDefault else type, + if (__bhp === bhpDefault) bhpDefault else bhp, + if (__size === sizeDefault) sizeDefault else size, + if (__performance === performanceDefault) performanceDefault else performance) + @Generated public companion object { private val typeDefault: () -> String? = 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 c3dafbb5..ff28dac2 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 @@ -7,7 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithDeeplyNestedComplexField.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean import kotlin.Double +import kotlin.Int import kotlin.jvm.JvmName @Generated @@ -29,6 +33,19 @@ public class Performance( public val quarterMile: Double? get() = __quarterMile.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Performance) return false + return (__zeroToSixty === zeroToSixtyDefault) == (other.__zeroToSixty === zeroToSixtyDefault) && + (__zeroToSixty === zeroToSixtyDefault || Objects.equals(zeroToSixty, other.zeroToSixty)) && + (__quarterMile === quarterMileDefault) == (other.__quarterMile === quarterMileDefault) && + (__quarterMile === quarterMileDefault || Objects.equals(quarterMile, other.quarterMile)) + } + + override fun hashCode(): Int = Objects.hash(if (__zeroToSixty === zeroToSixtyDefault) + zeroToSixtyDefault else zeroToSixty, + if (__quarterMile === quarterMileDefault) quarterMileDefault else quarterMile) + @Generated public companion object { private val zeroToSixtyDefault: () -> Double? = 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 c49e4872..fcb4e543 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithDeeplyNestedComplexField.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,15 @@ public class Query( public val cars: List? get() = __cars.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__cars === carsDefault) == (other.__cars === carsDefault) && (__cars === carsDefault || + Objects.equals(cars, other.cars)) + } + + override fun hashCode(): Int = Objects.hash(if (__cars === carsDefault) carsDefault else cars) + @Generated public companion object { private val carsDefault: () -> List? = 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 77fc6a94..986849e6 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithExtendedInterface.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val people: List? get() = __people.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === + peopleDefault || Objects.equals(people, other.people)) + } + + override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else + people) + @Generated public companion object { private val peopleDefault: () -> List? = diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Employee.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Employee.kt index 93fb8b81..abad5a62 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Employee.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Employee.kt @@ -7,6 +7,9 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithExtendedInterfaceInheritance.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean import kotlin.Int import kotlin.String import kotlin.Suppress @@ -48,6 +51,25 @@ public class Employee( override val age: Int get() = __age.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Employee) return false + return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && + (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && + (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === + lastnameDefault || Objects.equals(lastname, other.lastname)) && + (__company === companyDefault) == (other.__company === companyDefault) && (__company === + companyDefault || Objects.equals(company, other.company)) && + (__age === ageDefault) == (other.__age === ageDefault) && (__age === ageDefault || + Objects.equals(age, other.age)) + } + + override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault + else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname, + if (__company === companyDefault) companyDefault else company, + if (__age === ageDefault) ageDefault else age) + @Generated public companion object { private val firstnameDefault: () -> String = diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Query.kt index 9d23111b..3b109032 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Query.kt @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithExtendedInterfaceInheritance.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val people: List? get() = __people.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === + peopleDefault || Objects.equals(people, other.people)) + } + + override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else + people) + @Generated public companion object { private val peopleDefault: () -> List? = 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 0319fb56..a9ee5793 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithInterface.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress import kotlin.jvm.JvmName @@ -39,6 +43,22 @@ public class Employee( public val company: String? get() = __company.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Employee) return false + return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && + (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && + (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === + lastnameDefault || Objects.equals(lastname, other.lastname)) && + (__company === companyDefault) == (other.__company === companyDefault) && (__company === + companyDefault || Objects.equals(company, other.company)) + } + + override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault + else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname, + if (__company === companyDefault) companyDefault else company) + @Generated public companion object { private val firstnameDefault: () -> 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 77c64378..72c798a6 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithInterface.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val people: List? get() = __people.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === + peopleDefault || Objects.equals(people, other.people)) + } + + override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else + people) + @Generated public companion object { private val peopleDefault: () -> List? = 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 1166dd79..50b06e98 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithInterfaceInheritance.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val people: List? get() = __people.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === + peopleDefault || Objects.equals(people, other.people)) + } + + override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else + people) + @Generated public companion object { private val peopleDefault: () -> List? = 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 55f9487f..db020fa2 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithInterfaceInheritance.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress import kotlin.jvm.JvmName @@ -47,6 +51,25 @@ public class Talent( public val imdbProfile: String? get() = __imdbProfile.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Talent) return false + return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && + (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && + (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === + lastnameDefault || Objects.equals(lastname, other.lastname)) && + (__company === companyDefault) == (other.__company === companyDefault) && (__company === + companyDefault || Objects.equals(company, other.company)) && + (__imdbProfile === imdbProfileDefault) == (other.__imdbProfile === imdbProfileDefault) && + (__imdbProfile === imdbProfileDefault || Objects.equals(imdbProfile, other.imdbProfile)) + } + + override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault + else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname, + if (__company === companyDefault) companyDefault else company, + if (__imdbProfile === imdbProfileDefault) imdbProfileDefault else imdbProfile) + @Generated public companion object { private val firstnameDefault: () -> String = 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 e2e3e651..a7e71b5b 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithListProperties.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -30,6 +34,18 @@ public class Person( public val email: List? get() = __email.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Person) return false + return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || + Objects.equals(name, other.name)) && + (__email === emailDefault) == (other.__email === emailDefault) && (__email === emailDefault || + Objects.equals(email, other.email)) + } + + override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name, + if (__email === emailDefault) emailDefault else email) + @Generated public companion object { private val nameDefault: () -> String? = 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 1eec46af..80f1e02c 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithListProperties.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val people: List? get() = __people.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === + peopleDefault || Objects.equals(people, other.people)) + } + + override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else + people) + @Generated public companion object { private val peopleDefault: () -> List? = 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 cb3548ad..778b20ed 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 @@ -8,6 +8,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedInterfaces.expected.Generated import com.netflix.graphql.dgs.codegen.fixtures.Node import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress import kotlin.jvm.JvmName @@ -26,6 +30,15 @@ public class Product( override val id: String get() = __id.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Product) return false + return (__id === idDefault) == (other.__id === idDefault) && (__id === idDefault || + Objects.equals(id, other.id)) + } + + override fun hashCode(): Int = Objects.hash(if (__id === idDefault) idDefault else id) + @Generated public companion object { private val idDefault: () -> String = 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 d2d426ba..4e489069 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedInterfaces.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val products: List? get() = __products.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__products === productsDefault) == (other.__products === productsDefault) && (__products + === productsDefault || Objects.equals(products, other.products)) + } + + override fun hashCode(): Int = Objects.hash(if (__products === productsDefault) productsDefault + else products) + @Generated public companion object { private val productsDefault: () -> List? = 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 c0338b52..52c5676f 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 @@ -8,6 +8,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedTypes.expected.Generated import java.lang.IllegalStateException import java.time.OffsetDateTime +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.Long import kotlin.jvm.JvmName @@ -30,6 +34,18 @@ public class Entity( public val dateTime: OffsetDateTime? get() = __dateTime.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Entity) return false + return (__long === longDefault) == (other.__long === longDefault) && (__long === longDefault || + Objects.equals(long, other.long)) && + (__dateTime === dateTimeDefault) == (other.__dateTime === dateTimeDefault) && (__dateTime === + dateTimeDefault || Objects.equals(dateTime, other.dateTime)) + } + + override fun hashCode(): Int = Objects.hash(if (__long === longDefault) longDefault else long, + if (__dateTime === dateTimeDefault) dateTimeDefault else dateTime) + @Generated public companion object { private val longDefault: () -> Long? = 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 364cd5c7..e8763721 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedTypes.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -29,6 +33,19 @@ public class EntityEdge( public val node: Entity? get() = __node.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is EntityEdge) return false + return (__cursor === cursorDefault) == (other.__cursor === cursorDefault) && (__cursor === + cursorDefault || Objects.equals(cursor, other.cursor)) && + (__node === nodeDefault) == (other.__node === nodeDefault) && (__node === nodeDefault || + Objects.equals(node, other.node)) + } + + override fun hashCode(): Int = Objects.hash(if (__cursor === cursorDefault) cursorDefault else + cursor, + if (__node === nodeDefault) nodeDefault else node) + @Generated public companion object { private val cursorDefault: () -> String = 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 1fb057f0..42cddd79 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 @@ -8,6 +8,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedTypes.expected.Generated import graphql.relay.SimpleListConnection import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -30,6 +34,20 @@ public class Query( public val entityConnection: SimpleListConnection? get() = __entityConnection.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__entity === entityDefault) == (other.__entity === entityDefault) && (__entity === + entityDefault || Objects.equals(entity, other.entity)) && + (__entityConnection === entityConnectionDefault) == (other.__entityConnection === + entityConnectionDefault) && (__entityConnection === entityConnectionDefault || + Objects.equals(entityConnection, other.entityConnection)) + } + + override fun hashCode(): Int = Objects.hash(if (__entity === entityDefault) entityDefault else + entity, + if (__entityConnection === entityConnectionDefault) entityConnectionDefault else entityConnection) + @Generated public companion object { private val entityDefault: () -> List? = 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 30d8f241..ee11b4b3 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableAndInterface.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress import kotlin.jvm.JvmName @@ -40,6 +44,22 @@ public class Employee( override val company: String? get() = __company.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Employee) return false + return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && + (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && + (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === + lastnameDefault || Objects.equals(lastname, other.lastname)) && + (__company === companyDefault) == (other.__company === companyDefault) && (__company === + companyDefault || Objects.equals(company, other.company)) + } + + override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault + else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname, + if (__company === companyDefault) companyDefault else company) + @Generated public companion object { private val firstnameDefault: () -> 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 cc1994f5..ad76917b 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableAndInterface.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val people: List? get() = __people.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === + peopleDefault || Objects.equals(people, other.people)) + } + + override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else + people) + @Generated public companion object { private val peopleDefault: () -> List? = 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 cebd92b9..cd2c65c3 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableComplexType.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.jvm.JvmName @Generated @@ -21,6 +25,15 @@ public class MyType( public val other: OtherType get() = __other.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is MyType) return false + return (__other === otherDefault) == (other.__other === otherDefault) && (__other === + otherDefault || Objects.equals(other, other.other)) + } + + override fun hashCode(): Int = Objects.hash(if (__other === otherDefault) otherDefault else other) + @Generated public companion object { private val otherDefault: () -> OtherType = 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 51282e0d..3f58afb1 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableComplexType.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -22,6 +26,15 @@ public class OtherType( public val name: String get() = __name.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is OtherType) return false + return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || + Objects.equals(name, other.name)) + } + + override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name) + @Generated public companion object { private val nameDefault: () -> String = 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 4a41f86c..fb748ef1 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableListOfNullableValues.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -30,6 +34,18 @@ public class Person( public val email: List get() = __email.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Person) return false + return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || + Objects.equals(name, other.name)) && + (__email === emailDefault) == (other.__email === emailDefault) && (__email === emailDefault || + Objects.equals(email, other.email)) + } + + override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name, + if (__email === emailDefault) emailDefault else email) + @Generated public companion object { private val nameDefault: () -> String = 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 3241da1b..fbc48a0d 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableListOfNullableValues.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val people: List? get() = __people.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === + peopleDefault || Objects.equals(people, other.people)) + } + + override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else + people) + @Generated public companion object { private val peopleDefault: () -> List? = 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 189a1a36..e8b8f87f 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 @@ -7,6 +7,8 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullablePrimitive.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any import kotlin.Boolean import kotlin.Double import kotlin.Int @@ -38,6 +40,21 @@ public class MyType( public val floaty: Double get() = __floaty.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is MyType) return false + return (__count === countDefault) == (other.__count === countDefault) && (__count === + countDefault || Objects.equals(count, other.count)) && + (__truth === truthDefault) == (other.__truth === truthDefault) && (__truth === truthDefault || + Objects.equals(truth, other.truth)) && + (__floaty === floatyDefault) == (other.__floaty === floatyDefault) && (__floaty === + floatyDefault || Objects.equals(floaty, other.floaty)) + } + + override fun hashCode(): Int = Objects.hash(if (__count === countDefault) countDefault else count, + if (__truth === truthDefault) truthDefault else truth, + if (__floaty === floatyDefault) floatyDefault else floaty) + @Generated public companion object { private val countDefault: () -> Int = 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 80bbb167..d6408759 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 @@ -7,6 +7,8 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullablePrimitiveInList.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any import kotlin.Boolean import kotlin.Double import kotlin.Int @@ -39,6 +41,21 @@ public class MyType( public val floaty: List? get() = __floaty.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is MyType) return false + return (__count === countDefault) == (other.__count === countDefault) && (__count === + countDefault || Objects.equals(count, other.count)) && + (__truth === truthDefault) == (other.__truth === truthDefault) && (__truth === truthDefault || + Objects.equals(truth, other.truth)) && + (__floaty === floatyDefault) == (other.__floaty === floatyDefault) && (__floaty === + floatyDefault || Objects.equals(floaty, other.floaty)) + } + + override fun hashCode(): Int = Objects.hash(if (__count === countDefault) countDefault else count, + if (__truth === truthDefault) truthDefault else truth, + if (__floaty === floatyDefault) floatyDefault else floaty) + @Generated public companion object { private val countDefault: () -> List? = 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 df789bf6..e05f6f20 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableProperties.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -30,6 +34,18 @@ public class Person( public val email: List get() = __email.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Person) return false + return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || + Objects.equals(name, other.name)) && + (__email === emailDefault) == (other.__email === emailDefault) && (__email === emailDefault || + Objects.equals(email, other.email)) + } + + override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name, + if (__email === emailDefault) emailDefault else email) + @Generated public companion object { private val nameDefault: () -> String = 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 179851bb..e6899c5f 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableProperties.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val people: List? get() = __people.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === + peopleDefault || Objects.equals(people, other.people)) + } + + override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else + people) + @Generated public companion object { private val peopleDefault: () -> List? = 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 f3164c40..8cc35b68 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 @@ -7,6 +7,8 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNullablePrimitive.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any import kotlin.Boolean import kotlin.Double import kotlin.Int @@ -38,6 +40,21 @@ public class MyType( public val floaty: Double? get() = __floaty.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is MyType) return false + return (__count === countDefault) == (other.__count === countDefault) && (__count === + countDefault || Objects.equals(count, other.count)) && + (__truth === truthDefault) == (other.__truth === truthDefault) && (__truth === truthDefault || + Objects.equals(truth, other.truth)) && + (__floaty === floatyDefault) == (other.__floaty === floatyDefault) && (__floaty === + floatyDefault || Objects.equals(floaty, other.floaty)) + } + + override fun hashCode(): Int = Objects.hash(if (__count === countDefault) countDefault else count, + if (__truth === truthDefault) truthDefault else truth, + if (__floaty === floatyDefault) floatyDefault else floaty) + @Generated public companion object { private val countDefault: () -> Int? = 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 351585e1..b39fe57f 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithRecursiveField.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -37,6 +41,22 @@ public class Person( public val friends: List? get() = __friends.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Person) return false + return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && + (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && + (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === + lastnameDefault || Objects.equals(lastname, other.lastname)) && + (__friends === friendsDefault) == (other.__friends === friendsDefault) && (__friends === + friendsDefault || Objects.equals(friends, other.friends)) + } + + override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault + else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname, + if (__friends === friendsDefault) friendsDefault else friends) + @Generated public companion object { private val firstnameDefault: () -> String? = 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 1f1f3810..a1f44c57 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithRecursiveField.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val people: List? get() = __people.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === + peopleDefault || Objects.equals(people, other.people)) + } + + override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else + people) + @Generated public companion object { private val peopleDefault: () -> List? = diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Person.kt index 16166bf4..478b2ee2 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Person.kt @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithReservedWord.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -29,6 +33,18 @@ public class Person( public val `interface`: String? get() = __interface.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Person) return false + return (__info === infoDefault) == (other.__info === infoDefault) && (__info === infoDefault || + Objects.equals(info, other.info)) && + (__interface === interfaceDefault) == (other.__interface === interfaceDefault) && (__interface + === interfaceDefault || Objects.equals(`interface`, other.`interface`)) + } + + override fun hashCode(): Int = Objects.hash(if (__info === infoDefault) infoDefault else info, + if (__interface === interfaceDefault) interfaceDefault else `interface`) + @Generated public companion object { private val infoDefault: () -> String? = diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Query.kt index dfbfa2a3..1f894e64 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Query.kt @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithReservedWord.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val people: List? get() = __people.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === + peopleDefault || Objects.equals(people, other.people)) + } + + override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else + people) + @Generated public companion object { private val peopleDefault: () -> List? = 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 fec342e0..1250317c 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithReservedWord.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class SampleType( public val `return`: String get() = __return.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is SampleType) return false + return (__return === returnDefault) == (other.__return === returnDefault) && (__return === + returnDefault || Objects.equals(`return`, other.`return`)) + } + + override fun hashCode(): Int = Objects.hash(if (__return === returnDefault) returnDefault else + `return`) + @Generated public companion object { private val returnDefault: () -> String = 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 a719af1c..50c2c2ba 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithStringProperties.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -29,6 +33,19 @@ public class Person( public val lastname: String? get() = __lastname.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Person) return false + return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && + (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && + (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === + lastnameDefault || Objects.equals(lastname, other.lastname)) + } + + override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault + else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname) + @Generated public companion object { private val firstnameDefault: () -> String? = 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 aef99ad4..e4c5f00a 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithStringProperties.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val people: List? get() = __people.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === + peopleDefault || Objects.equals(people, other.people)) + } + + override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else + people) + @Generated public companion object { private val peopleDefault: () -> List? = 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 2c519850..60e8b468 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.`enum`.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,15 @@ public class Query( public val types: List? get() = __types.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__types === typesDefault) == (other.__types === typesDefault) && (__types === + typesDefault || Objects.equals(types, other.types)) + } + + override fun hashCode(): Int = Objects.hash(if (__types === typesDefault) typesDefault else types) + @Generated public companion object { private val typesDefault: () -> List? = 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 04d3b802..ece69b20 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.enumWithExtendedType.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,15 @@ public class Query( public val types: List? get() = __types.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__types === typesDefault) == (other.__types === typesDefault) && (__types === + typesDefault || Objects.equals(types, other.types)) + } + + override fun hashCode(): Int = Objects.hash(if (__types === typesDefault) typesDefault else types) + @Generated public companion object { private val typesDefault: () -> List? = diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/extendedDataClassWithInterface/expected/types/Example.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/extendedDataClassWithInterface/expected/types/Example.kt index 1e5f76c2..70e0d474 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/extendedDataClassWithInterface/expected/types/Example.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/extendedDataClassWithInterface/expected/types/Example.kt @@ -7,6 +7,9 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.extendedDataClassWithInterface.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean import kotlin.Int import kotlin.String import kotlin.Suppress @@ -34,6 +37,18 @@ public class Example( override val age: Int? get() = __age.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Example) return false + return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || + Objects.equals(name, other.name)) && + (__age === ageDefault) == (other.__age === ageDefault) && (__age === ageDefault || + Objects.equals(age, other.age)) + } + + override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name, + if (__age === ageDefault) ageDefault else age) + @Generated public companion object { private val nameDefault: () -> String? = 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 83f27dc5..1c8a83cd 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.input.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -23,6 +27,16 @@ public class Query( public val movies: List? get() = __movies.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__movies === moviesDefault) == (other.__movies === moviesDefault) && (__movies === + moviesDefault || Objects.equals(movies, other.movies)) + } + + override fun hashCode(): Int = Objects.hash(if (__movies === moviesDefault) moviesDefault else + movies) + @Generated public companion object { private val moviesDefault: () -> List? = diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultBigDecimal/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultBigDecimal/expected/types/Query.kt index 2d08886d..3c77fc1e 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultBigDecimal/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultBigDecimal/expected/types/Query.kt @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.inputWithDefaultBigDecimal.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val orders: String? get() = __orders.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__orders === ordersDefault) == (other.__orders === ordersDefault) && (__orders === + ordersDefault || Objects.equals(orders, other.orders)) + } + + override fun hashCode(): Int = Objects.hash(if (__orders === ordersDefault) ordersDefault else + orders) + @Generated public companion object { private val ordersDefault: () -> String? = diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultCurrency/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultCurrency/expected/types/Query.kt index 451b3c28..de758e74 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultCurrency/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultCurrency/expected/types/Query.kt @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.inputWithDefaultCurrency.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val orders: String? get() = __orders.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__orders === ordersDefault) == (other.__orders === ordersDefault) && (__orders === + ordersDefault || Objects.equals(orders, other.orders)) + } + + override fun hashCode(): Int = Objects.hash(if (__orders === ordersDefault) ordersDefault else + orders) + @Generated public companion object { private val ordersDefault: () -> String? = 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 f6a722b5..0e89914f 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.inputWithExtendedType.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -23,6 +27,16 @@ public class Query( public val movies: List? get() = __movies.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__movies === moviesDefault) == (other.__movies === moviesDefault) && (__movies === + moviesDefault || Objects.equals(movies, other.movies)) + } + + override fun hashCode(): Int = Objects.hash(if (__movies === moviesDefault) moviesDefault else + movies) + @Generated public companion object { private val moviesDefault: () -> List? = 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 83d4ecd8..ace62ed8 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceClassWithInterfaceFields.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress import kotlin.collections.List @@ -65,6 +69,30 @@ public class Bird( override val parents: List? get() = __parents.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Bird) return false + return (__id === idDefault) == (other.__id === idDefault) && (__id === idDefault || + Objects.equals(id, other.id)) && + (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || + Objects.equals(name, other.name)) && + (__address === addressDefault) == (other.__address === addressDefault) && (__address === + addressDefault || Objects.equals(address, other.address)) && + (__mother === motherDefault) == (other.__mother === motherDefault) && (__mother === + motherDefault || Objects.equals(mother, other.mother)) && + (__father === fatherDefault) == (other.__father === fatherDefault) && (__father === + fatherDefault || Objects.equals(father, other.father)) && + (__parents === parentsDefault) == (other.__parents === parentsDefault) && (__parents === + parentsDefault || Objects.equals(parents, other.parents)) + } + + override fun hashCode(): Int = Objects.hash(if (__id === idDefault) idDefault else id, + if (__name === nameDefault) nameDefault else name, + if (__address === addressDefault) addressDefault else address, + if (__mother === motherDefault) motherDefault else mother, + if (__father === fatherDefault) fatherDefault else father, + if (__parents === parentsDefault) parentsDefault else parents) + @Generated public companion object { private val idDefault: () -> String = 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 3abed9f2..ca09ddd5 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceClassWithInterfaceFields.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress import kotlin.collections.List @@ -65,6 +69,30 @@ public class Dog( override val parents: List? get() = __parents.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Dog) return false + return (__id === idDefault) == (other.__id === idDefault) && (__id === idDefault || + Objects.equals(id, other.id)) && + (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || + Objects.equals(name, other.name)) && + (__address === addressDefault) == (other.__address === addressDefault) && (__address === + addressDefault || Objects.equals(address, other.address)) && + (__mother === motherDefault) == (other.__mother === motherDefault) && (__mother === + motherDefault || Objects.equals(mother, other.mother)) && + (__father === fatherDefault) == (other.__father === fatherDefault) && (__father === + fatherDefault || Objects.equals(father, other.father)) && + (__parents === parentsDefault) == (other.__parents === parentsDefault) && (__parents === + parentsDefault || Objects.equals(parents, other.parents)) + } + + override fun hashCode(): Int = Objects.hash(if (__id === idDefault) idDefault else id, + if (__name === nameDefault) nameDefault else name, + if (__address === addressDefault) addressDefault else address, + if (__mother === motherDefault) motherDefault else mother, + if (__father === fatherDefault) fatherDefault else father, + if (__parents === parentsDefault) parentsDefault else parents) + @Generated public companion object { private val idDefault: () -> 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 4b5bd329..21baf959 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceClassWithInterfaceFieldsOfDifferentType.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress import kotlin.jvm.JvmName @@ -32,6 +36,18 @@ public class Dog( override val diet: Vegetarian? get() = __diet.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Dog) return false + return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || + Objects.equals(name, other.name)) && + (__diet === dietDefault) == (other.__diet === dietDefault) && (__diet === dietDefault || + Objects.equals(diet, other.diet)) + } + + override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name, + if (__diet === dietDefault) dietDefault else diet) + @Generated public companion object { private val nameDefault: () -> String? = 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 41a4ac0c..5b8d4700 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceClassWithInterfaceFieldsOfDifferentType.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress import kotlin.collections.List @@ -32,6 +36,19 @@ public class Vegetarian( public val vegetables: List? get() = __vegetables.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Vegetarian) return false + return (__calories === caloriesDefault) == (other.__calories === caloriesDefault) && (__calories + === caloriesDefault || Objects.equals(calories, other.calories)) && + (__vegetables === vegetablesDefault) == (other.__vegetables === vegetablesDefault) && + (__vegetables === vegetablesDefault || Objects.equals(vegetables, other.vegetables)) + } + + override fun hashCode(): Int = Objects.hash(if (__calories === caloriesDefault) caloriesDefault + else calories, + if (__vegetables === vegetablesDefault) vegetablesDefault else vegetables) + @Generated public companion object { private val caloriesDefault: () -> String? = 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 29ca5ac4..90614113 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceClassWithNonNullableFields.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress import kotlin.jvm.JvmName @@ -39,6 +43,22 @@ public class Employee( public val company: String? get() = __company.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Employee) return false + return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && + (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && + (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === + lastnameDefault || Objects.equals(lastname, other.lastname)) && + (__company === companyDefault) == (other.__company === companyDefault) && (__company === + companyDefault || Objects.equals(company, other.company)) + } + + override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault + else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname, + if (__company === companyDefault) companyDefault else company) + @Generated public companion object { private val firstnameDefault: () -> 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 66cd0113..3bb31bfb 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceClassWithNonNullableFields.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val people: List? get() = __people.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === + peopleDefault || Objects.equals(people, other.people)) + } + + override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else + people) + @Generated public companion object { private val peopleDefault: () -> 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 4b6d570d..feac8daf 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceWithInterfaceInheritance.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val fruits: List? get() = __fruits.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__fruits === fruitsDefault) == (other.__fruits === fruitsDefault) && (__fruits === + fruitsDefault || Objects.equals(fruits, other.fruits)) + } + + override fun hashCode(): Int = Objects.hash(if (__fruits === fruitsDefault) fruitsDefault else + fruits) + @Generated public companion object { private val fruitsDefault: () -> List? = 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 fc2b21e1..d56f8bdd 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceWithInterfaceInheritance.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -22,6 +26,15 @@ public class Seed( public val name: String? get() = __name.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Seed) return false + return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || + Objects.equals(name, other.name)) + } + + override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name) + @Generated public companion object { private val nameDefault: () -> String? = diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/Query.kt index 6dccd0fe..5648adce 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/Query.kt @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceWithUnderscoreFields.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,15 @@ public class Query( public val `is`: List? get() = __is.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__is === isDefault) == (other.__is === isDefault) && (__is === isDefault || + Objects.equals(`is`, other.`is`)) + } + + override fun hashCode(): Int = Objects.hash(if (__is === isDefault) isDefault else `is`) + @Generated public companion object { private val isDefault: () -> List? = diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/T.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/T.kt index ed429fd4..24e6b960 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/T.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/T.kt @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceWithUnderscoreFields.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress import kotlin.jvm.JvmName @@ -31,6 +35,18 @@ public class T( public val id: String? get() = __id.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is T) return false + return (___id === _idDefault) == (other.___id === _idDefault) && (___id === _idDefault || + Objects.equals(_id, other._id)) && + (__id === idDefault) == (other.__id === idDefault) && (__id === idDefault || Objects.equals(id, + other.id)) + } + + override fun hashCode(): Int = Objects.hash(if (___id === _idDefault) _idDefault else _id, + if (__id === idDefault) idDefault else id) + @Generated public companion object { private val _idDefault: () -> String? = 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 08ec1c6e..8cc2edcf 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithEnum.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -29,6 +33,18 @@ public class Query( public val es: List? get() = __es.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__e === eDefault) == (other.__e === eDefault) && (__e === eDefault || Objects.equals(e, + other.e)) && + (__es === esDefault) == (other.__es === esDefault) && (__es === esDefault || Objects.equals(es, + other.es)) + } + + override fun hashCode(): Int = Objects.hash(if (__e === eDefault) eDefault else e, + if (__es === esDefault) esDefault else es) + @Generated public companion object { private val eDefault: () -> E? = 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 7a67eadc..3c1f9314 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithNestedInputs.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -29,6 +33,18 @@ public class Query( public val q2: String? get() = __q2.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__q1 === q1Default) == (other.__q1 === q1Default) && (__q1 === q1Default || + Objects.equals(q1, other.q1)) && + (__q2 === q2Default) == (other.__q2 === q2Default) && (__q2 === q2Default || Objects.equals(q2, + other.q2)) + } + + override fun hashCode(): Int = Objects.hash(if (__q1 === q1Default) q1Default else q1, + if (__q2 === q2Default) q2Default else q2) + @Generated public companion object { private val q1Default: () -> String? = 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 08955f99..8bf03705 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithPrimitiveAndArgs.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val string: String? get() = __string.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__string === stringDefault) == (other.__string === stringDefault) && (__string === + stringDefault || Objects.equals(string, other.string)) + } + + override fun hashCode(): Int = Objects.hash(if (__string === stringDefault) stringDefault else + string) + @Generated public companion object { private val stringDefault: () -> String? = 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 503fb36a..91ed6fef 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithPrimitives.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -30,6 +34,19 @@ public class Query( public val strings: List? get() = __strings.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__string === stringDefault) == (other.__string === stringDefault) && (__string === + stringDefault || Objects.equals(string, other.string)) && + (__strings === stringsDefault) == (other.__strings === stringsDefault) && (__strings === + stringsDefault || Objects.equals(strings, other.strings)) + } + + override fun hashCode(): Int = Objects.hash(if (__string === stringDefault) stringDefault else + string, + if (__strings === stringsDefault) stringsDefault else strings) + @Generated public companion object { private val stringDefault: () -> String? = 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 bd77d370..f0ae5ad1 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithType.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress import kotlin.jvm.JvmName @@ -31,6 +35,19 @@ public class Employee( public val company: String? get() = __company.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Employee) return false + return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && + (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && + (__company === companyDefault) == (other.__company === companyDefault) && (__company === + companyDefault || Objects.equals(company, other.company)) + } + + override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault + else firstname, + if (__company === companyDefault) companyDefault else company) + @Generated public companion object { private val firstnameDefault: () -> 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 d01b70f4..b6cc6ee9 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithType.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -29,6 +33,19 @@ public class Query( public val people: List? get() = __people.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__person === personDefault) == (other.__person === personDefault) && (__person === + personDefault || Objects.equals(person, other.person)) && + (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === + peopleDefault || Objects.equals(people, other.people)) + } + + override fun hashCode(): Int = Objects.hash(if (__person === personDefault) personDefault else + person, + if (__people === peopleDefault) peopleDefault else people) + @Generated public companion object { private val personDefault: () -> Person? = 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 83779272..6e5fd660 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithTypeAndArgs.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress import kotlin.jvm.JvmName @@ -31,6 +35,19 @@ public class Employee( public val company: String? get() = __company.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Employee) return false + return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && + (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && + (__company === companyDefault) == (other.__company === companyDefault) && (__company === + companyDefault || Objects.equals(company, other.company)) + } + + override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault + else firstname, + if (__company === companyDefault) companyDefault else company) + @Generated public companion object { private val firstnameDefault: () -> 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 20a23af1..9c9e712d 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithTypeAndArgs.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.jvm.JvmName @Generated @@ -21,6 +25,16 @@ public class Query( public val person: Person? get() = __person.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__person === personDefault) == (other.__person === personDefault) && (__person === + personDefault || Objects.equals(person, other.person)) + } + + override fun hashCode(): Int = Objects.hash(if (__person === personDefault) personDefault else + person) + @Generated public companion object { private val personDefault: () -> Person? = 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 15c609de..a4093e39 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithUnion.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress import kotlin.jvm.JvmName @@ -32,6 +36,19 @@ public class Employee( public val company: String? get() = __company.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Employee) return false + return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && + (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && + (__company === companyDefault) == (other.__company === companyDefault) && (__company === + companyDefault || Objects.equals(company, other.company)) + } + + override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault + else firstname, + if (__company === companyDefault) companyDefault else company) + @Generated public companion object { private val firstnameDefault: () -> 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 b4d63229..14f565d2 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithUnion.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -29,6 +33,18 @@ public class Query( public val us: List? get() = __us.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__u === uDefault) == (other.__u === uDefault) && (__u === uDefault || Objects.equals(u, + other.u)) && + (__us === usDefault) == (other.__us === usDefault) && (__us === usDefault || Objects.equals(us, + other.us)) + } + + override fun hashCode(): Int = Objects.hash(if (__u === uDefault) uDefault else u, + if (__us === usDefault) usDefault else us) + @Generated public companion object { private val uDefault: () -> U? = 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 16ce6c6c..0dbc74d2 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.skipCodegenOnFields.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -22,6 +26,15 @@ public class Person( public val name: String? get() = __name.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Person) return false + return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || + Objects.equals(name, other.name)) + } + + override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name) + @Generated public companion object { private val nameDefault: () -> String? = 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 96bd85df..ab16518d 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.skipCodegenOnTypes.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -22,6 +26,15 @@ public class Person( public val name: String? get() = __name.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Person) return false + return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || + Objects.equals(name, other.name)) + } + + override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name) + @Generated public companion object { private val nameDefault: () -> String? = 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 cd03452e..b8c91edf 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.union.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -22,6 +26,15 @@ public class Actor( public val name: String? get() = __name.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Actor) return false + return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || + Objects.equals(name, other.name)) + } + + override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name) + @Generated public companion object { private val nameDefault: () -> String? = 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 41ea6b9f..a5be70d2 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.union.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -22,6 +26,15 @@ public class Movie( public val title: String? get() = __title.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Movie) return false + return (__title === titleDefault) == (other.__title === titleDefault) && (__title === + titleDefault || Objects.equals(title, other.title)) + } + + override fun hashCode(): Int = Objects.hash(if (__title === titleDefault) titleDefault else title) + @Generated public companion object { private val titleDefault: () -> String? = 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 2aa3a305..8e57cc93 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.union.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val search: List? get() = __search.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__search === searchDefault) == (other.__search === searchDefault) && (__search === + searchDefault || Objects.equals(search, other.search)) + } + + override fun hashCode(): Int = Objects.hash(if (__search === searchDefault) searchDefault else + search) + @Generated public companion object { private val searchDefault: () -> List? = 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 24834530..f1647ea9 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.unionTypesWithoutInterfaceCanDeserialize.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -36,6 +40,22 @@ public class Droid( public val primaryFunction: String? get() = __primaryFunction.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Droid) return false + return (__id === idDefault) == (other.__id === idDefault) && (__id === idDefault || + Objects.equals(id, other.id)) && + (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || + Objects.equals(name, other.name)) && + (__primaryFunction === primaryFunctionDefault) == (other.__primaryFunction === + primaryFunctionDefault) && (__primaryFunction === primaryFunctionDefault || + Objects.equals(primaryFunction, other.primaryFunction)) + } + + override fun hashCode(): Int = Objects.hash(if (__id === idDefault) idDefault else id, + if (__name === nameDefault) nameDefault else name, + if (__primaryFunction === primaryFunctionDefault) primaryFunctionDefault else primaryFunction) + @Generated public companion object { private val idDefault: () -> String = 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 8cf73097..d9b6aa1c 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 @@ -7,6 +7,9 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.unionTypesWithoutInterfaceCanDeserialize.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -37,6 +40,21 @@ public class Human( public val totalCredits: Int? get() = __totalCredits.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Human) return false + return (__id === idDefault) == (other.__id === idDefault) && (__id === idDefault || + Objects.equals(id, other.id)) && + (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || + Objects.equals(name, other.name)) && + (__totalCredits === totalCreditsDefault) == (other.__totalCredits === totalCreditsDefault) && + (__totalCredits === totalCreditsDefault || Objects.equals(totalCredits, other.totalCredits)) + } + + override fun hashCode(): Int = Objects.hash(if (__id === idDefault) idDefault else id, + if (__name === nameDefault) nameDefault else name, + if (__totalCredits === totalCreditsDefault) totalCreditsDefault else totalCredits) + @Generated public companion object { private val idDefault: () -> String = 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 564fb462..d337d5d2 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.unionTypesWithoutInterfaceCanDeserialize.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.jvm.JvmName @Generated @@ -21,6 +25,16 @@ public class Query( public val search: SearchResultPage? get() = __search.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__search === searchDefault) == (other.__search === searchDefault) && (__search === + searchDefault || Objects.equals(search, other.search)) + } + + override fun hashCode(): Int = Objects.hash(if (__search === searchDefault) searchDefault else + search) + @Generated public companion object { private val searchDefault: () -> SearchResultPage? = 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 c4a2cbe2..9f60997d 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.unionTypesWithoutInterfaceCanDeserialize.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,15 @@ public class SearchResultPage( public val items: List? get() = __items.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is SearchResultPage) return false + return (__items === itemsDefault) == (other.__items === itemsDefault) && (__items === + itemsDefault || Objects.equals(items, other.items)) + } + + override fun hashCode(): Int = Objects.hash(if (__items === itemsDefault) itemsDefault else items) + @Generated public companion object { private val itemsDefault: () -> List? = 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 5da7bad4..eed77ed6 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.unionWithExtendedType.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -22,6 +26,15 @@ public class Actor( public val name: String? get() = __name.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Actor) return false + return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || + Objects.equals(name, other.name)) + } + + override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name) + @Generated public companion object { private val nameDefault: () -> String? = 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 027d987b..222b5b08 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.unionWithExtendedType.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.jvm.JvmName @@ -22,6 +26,15 @@ public class Movie( public val title: String? get() = __title.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Movie) return false + return (__title === titleDefault) == (other.__title === titleDefault) && (__title === + titleDefault || Objects.equals(title, other.title)) + } + + override fun hashCode(): Int = Objects.hash(if (__title === titleDefault) titleDefault else title) + @Generated public companion object { private val titleDefault: () -> String? = 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 2831e29c..727e8c92 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 @@ -7,6 +7,10 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.unionWithExtendedType.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,16 @@ public class Query( public val search: List? get() = __search.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Query) return false + return (__search === searchDefault) == (other.__search === searchDefault) && (__search === + searchDefault || Objects.equals(search, other.search)) + } + + override fun hashCode(): Int = Objects.hash(if (__search === searchDefault) searchDefault else + search) + @Generated public companion object { private val searchDefault: () -> List? = 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 5cb010ab..8ce68bd2 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 @@ -7,6 +7,9 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.unionWithExtendedType.expected.Generated import java.lang.IllegalStateException +import java.util.Objects +import kotlin.Any +import kotlin.Boolean import kotlin.Int import kotlin.jvm.JvmName @@ -22,6 +25,15 @@ public class Rating( public val stars: Int? get() = __stars.invoke() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Rating) return false + return (__stars === starsDefault) == (other.__stars === starsDefault) && (__stars === + starsDefault || Objects.equals(stars, other.stars)) + } + + override fun hashCode(): Int = Objects.hash(if (__stars === starsDefault) starsDefault else stars) + @Generated public companion object { private val starsDefault: () -> Int? = diff --git a/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/kotlin2/GenerateKotlin2DataTypes.kt b/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/kotlin2/GenerateKotlin2DataTypes.kt index 9df488f1..84f74852 100644 --- a/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/kotlin2/GenerateKotlin2DataTypes.kt +++ b/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/kotlin2/GenerateKotlin2DataTypes.kt @@ -37,10 +37,13 @@ import com.netflix.graphql.dgs.codegen.generators.shared.CodeGeneratorUtils.capi import com.netflix.graphql.dgs.codegen.generators.shared.SchemaExtensionsUtils.findTypeExtensions import com.netflix.graphql.dgs.codegen.generators.shared.excludeSchemaTypeExtension import com.netflix.graphql.dgs.codegen.shouldSkip +import com.squareup.kotlinpoet.ANY +import com.squareup.kotlinpoet.BOOLEAN import com.squareup.kotlinpoet.ClassName import com.squareup.kotlinpoet.CodeBlock import com.squareup.kotlinpoet.FileSpec import com.squareup.kotlinpoet.FunSpec +import com.squareup.kotlinpoet.INT import com.squareup.kotlinpoet.KModifier import com.squareup.kotlinpoet.LambdaTypeName import com.squareup.kotlinpoet.ParameterSpec @@ -48,12 +51,14 @@ import com.squareup.kotlinpoet.PropertySpec import com.squareup.kotlinpoet.TypeSpec import com.squareup.kotlinpoet.asClassName import com.squareup.kotlinpoet.buildCodeBlock +import com.squareup.kotlinpoet.joinToCode import graphql.language.Document import graphql.language.FieldDefinition import graphql.language.ObjectTypeDefinition import org.slf4j.Logger import org.slf4j.LoggerFactory import java.io.Serializable +import java.util.Objects internal val logger: Logger = LoggerFactory.getLogger("com.netflix.graphql.dgs.codegen.generators.kotlin2") @@ -128,6 +133,8 @@ fun generateKotlin2DataTypes( }, ).build() + val className = ClassName(config.packageNameTypes, typeDefinition.name) + // create a builder for this class; default to lambda that throws if accessed val builderClassName = ClassName(config.packageNameTypes, typeDefinition.name, "Builder") val builder = @@ -258,9 +265,107 @@ fun generateKotlin2DataTypes( .build(), ).build() }, - ).build() + ) + // add value-based equals/hashCode over the requested fields + .addFunctions(equalsAndHashCodeFunctions(className, fields)) + .build() // return a file per type FileSpec.get(config.packageNameTypes, typeSpec) } } + +/** + * Generates `equals`/`hashCode` for a kotlin2 data type. + * + * These classes have no fixed value per field: a field's backing lambda is either the + * one supplied by the caller (the field was "requested") or the shared `${name}Default` + * lambda from the companion object, which throws when invoked (the field was not + * requested). Two instances are equal iff they requested the exact same set of fields + * and every requested field's value is equal; a field left unrequested on both sides is + * never invoked and counts as equal, while a field requested on only one side makes the + * instances unequal. This keeps the relation symmetric and transitive - comparing only + * the intersection of requested fields would not. + * + * Whether a field was requested is detected by reference-comparing its backing lambda + * against the companion's default lambda, never by invoking it or matching the + * exception message. + */ +private class EqualsHashCodeFieldNames( + field: KotlinFieldInfo, +) { + // Computed as whole identifiers (not "__" + %N) so KotlinPoet's keyword-escaping of a single + // %N argument (e.g. `interface` -> `` `interface` ``) can't land in the middle of a token + // like "__`interface`", which isn't valid Kotlin. + val backing = "__${field.kotlinName}" + val default = "${field.kotlinName}Default" + val getter = field.kotlinName +} + +private fun equalsAndHashCodeFunctions( + className: ClassName, + fields: List, +): List { + if (fields.isEmpty()) { + return emptyList() + } + + val names = fields.map(::EqualsHashCodeFieldNames) + + val equalsFun = + FunSpec + .builder("equals") + .addModifiers(KModifier.OVERRIDE) + .addParameter("other", ANY.copy(nullable = true)) + .returns(BOOLEAN) + .addStatement("if (this === other) return true") + .addStatement("if (other !is %T) return false", className) + .addCode( + buildCodeBlock { + add("return ") + add( + names + .map { n -> + CodeBlock.of( + "(%N === %N) == (other.%N === %N) && (%N === %N || %T.equals(%N, other.%N))", + n.backing, + n.default, + n.backing, + n.default, + n.backing, + n.default, + Objects::class, + n.getter, + n.getter, + ) + }.joinToCode(separator = " &&\n"), + ) + add("\n") + }, + ).build() + + val hashCodeFun = + FunSpec + .builder("hashCode") + .addModifiers(KModifier.OVERRIDE) + .returns(INT) + .addStatement( + "return %T.hash(%L)", + Objects::class, + names + .map { n -> + // Feed the shared default lambda itself as the "unrequested" sentinel: it's + // already a stable per-field singleton, so it doubles as a hashCode marker + // without needing a dedicated sentinel type, and never invoking the supplier. + CodeBlock.of( + "if (%N === %N) %N else %N", + n.backing, + n.default, + n.default, + n.getter, + ) + }.joinToCode(separator = ",\n"), + ).build() + + return listOf(equalsFun, hashCodeFun) +} From 507229f1c72a571cd73fcb976ea506ad9ae26d0b Mon Sep 17 00:00:00 2001 From: yshepilov Date: Mon, 3 Aug 2026 12:00:54 +0200 Subject: [PATCH 2/3] Generate toString rendering only requested fields for kotlin2 data types Renders only the fields the projection actually requested, so an unrequested field's supplier is never invoked. Addresses #638. --- .../expected/types/Person.kt | 4 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Person.kt | 4 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Person.kt | 4 ++ .../expected/types/Query.kt | 5 ++ .../expected/types/Person.kt | 5 ++ .../expected/types/Query.kt | 4 ++ .../dataClassDocs/expected/types/Movie.kt | 3 ++ .../dataClassDocs/expected/types/Query.kt | 4 ++ .../expected/types/Movie.kt | 3 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Person.kt | 3 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/RequiredTestType.kt | 4 ++ .../expected/types/Entity.kt | 5 ++ .../expected/types/EntityConnection.kt | 5 ++ .../expected/types/EntityEdge.kt | 4 ++ .../expected/types/PageInfo.kt | 6 +++ .../expected/types/Query.kt | 5 ++ .../expected/types/Car.kt | 4 ++ .../expected/types/Engine.kt | 5 ++ .../expected/types/Performance.kt | 5 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Employee.kt | 5 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Employee.kt | 5 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Talent.kt | 6 +++ .../expected/types/Person.kt | 4 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Product.kt | 3 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Entity.kt | 5 ++ .../expected/types/EntityEdge.kt | 4 ++ .../expected/types/Query.kt | 5 ++ .../expected/types/Employee.kt | 5 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/MyType.kt | 4 ++ .../expected/types/OtherType.kt | 3 ++ .../expected/types/Person.kt | 4 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/MyType.kt | 5 ++ .../expected/types/MyType.kt | 5 ++ .../expected/types/Person.kt | 4 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/MyType.kt | 5 ++ .../expected/types/Person.kt | 5 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Person.kt | 4 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/SampleType.kt | 3 ++ .../expected/types/Person.kt | 4 ++ .../expected/types/Query.kt | 4 ++ .../cases/enum/expected/types/Query.kt | 4 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Example.kt | 4 ++ .../cases/input/expected/types/Query.kt | 3 ++ .../expected/types/Query.kt | 3 ++ .../expected/types/Query.kt | 3 ++ .../expected/types/Query.kt | 3 ++ .../expected/types/Bird.kt | 6 +++ .../expected/types/Dog.kt | 6 +++ .../expected/types/Dog.kt | 4 ++ .../expected/types/Vegetarian.kt | 4 ++ .../expected/types/Employee.kt | 5 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Seed.kt | 3 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/T.kt | 3 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Query.kt | 3 ++ .../expected/types/Query.kt | 3 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Employee.kt | 4 ++ .../expected/types/Query.kt | 5 ++ .../expected/types/Employee.kt | 4 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Employee.kt | 4 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Person.kt | 3 ++ .../expected/types/Person.kt | 3 ++ .../cases/union/expected/types/Actor.kt | 3 ++ .../cases/union/expected/types/Movie.kt | 3 ++ .../cases/union/expected/types/Query.kt | 4 ++ .../expected/types/Droid.kt | 5 ++ .../expected/types/Human.kt | 4 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/SearchResultPage.kt | 4 ++ .../expected/types/Actor.kt | 3 ++ .../expected/types/Movie.kt | 3 ++ .../expected/types/Query.kt | 4 ++ .../expected/types/Rating.kt | 4 ++ .../kotlin2/GenerateKotlin2DataTypes.kt | 46 ++++++++++++++++++- 99 files changed, 443 insertions(+), 2 deletions(-) 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 efe7c479..c9ac6abb 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 @@ -46,6 +46,10 @@ public class Person( else firstname, if (__lastname === lastnameDefault) lastnameDefault else lastname) + override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else + "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + + lastname).joinToString(prefix = "Person(", postfix = ")") + @Generated public companion object { private val firstnameDefault: () -> String? = 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 6724fa67..20b4f43c 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else people) + override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else + "people=" + people).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val peopleDefault: () -> List? = 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 5ee47b8d..40e8c6e1 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 @@ -46,6 +46,10 @@ public class Person( else firstname, if (__lastname === lastnameDefault) lastnameDefault else lastname) + override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else + "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + + lastname).joinToString(prefix = "Person(", postfix = ")") + @Generated public companion object { private val firstnameDefault: () -> String? = 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 9b8aa1c0..60bf4396 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else people) + override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else + "people=" + people).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val peopleDefault: () -> List? = 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 ef131074..21fcc525 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else people) + override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else + "people=" + people).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val peopleDefault: () -> List? = 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 8e5d2a01..f051dad5 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 @@ -46,6 +46,10 @@ public class Person( else firstname, if (__lastname === lastnameDefault) lastnameDefault else lastname) + override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else + "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + + lastname).joinToString(prefix = "Person(", postfix = ")") + @Generated public companion object { private val firstnameDefault: () -> String? = 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 b830928b..e8268aa1 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -46,6 +47,10 @@ public class Query( people, if (__friends === friendsDefault) friendsDefault else friends) + override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else + "people=" + people, if (__friends === friendsDefault) null else "friends=" + + friends).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val peopleDefault: () -> List? = 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 9fb9241e..451ec53b 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 @@ -56,6 +56,11 @@ public class Person( if (__lastname === lastnameDefault) lastnameDefault else lastname, if (__email === emailDefault) emailDefault else email) + override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else + "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + + lastname, if (__email === emailDefault) null else "email=" + email).joinToString(prefix = + "Person(", postfix = ")") + @Generated public companion object { private val firstnameDefault: () -> String? = 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 c000eb4e..f9dee361 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else people) + override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else + "people=" + people).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val peopleDefault: () -> List? = 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 7122c56d..cd30cde0 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 @@ -39,6 +39,9 @@ public class Movie( override fun hashCode(): Int = Objects.hash(if (__title === titleDefault) titleDefault else title) + override fun toString(): String = listOfNotNull(if (__title === titleDefault) null else "title=" + + title).joinToString(prefix = "Movie(", postfix = ")") + @Generated public companion object { private val titleDefault: () -> String? = 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 7d8b4cdf..82c49b95 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,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.jvm.JvmName @Generated @@ -35,6 +36,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__search === searchDefault) searchDefault else search) + override fun toString(): String = listOfNotNull(if (__search === searchDefault) null else + "search=" + search).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val searchDefault: () -> Movie? = 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 c9610419..b12da880 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 @@ -38,6 +38,9 @@ public class Movie( override fun hashCode(): Int = Objects.hash(if (__title === titleDefault) titleDefault else title) + override fun toString(): String = listOfNotNull(if (__title === titleDefault) null else "title=" + + title).joinToString(prefix = "Movie(", postfix = ")") + @Generated public companion object { private val titleDefault: () -> String? = 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 dc120ce7..7bf71703 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,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.jvm.JvmName @Generated @@ -35,6 +36,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__search === searchDefault) searchDefault else search) + override fun toString(): String = listOfNotNull(if (__search === searchDefault) null else + "search=" + search).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val searchDefault: () -> Movie? = 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 f8fa100b..7bcef632 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 @@ -5,11 +5,14 @@ import com.fasterxml.jackson.`annotation`.JsonTypeInfo import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWIthNoFields.expected.Generated +import kotlin.String @Generated @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Person.Builder::class) public class Person() { + override fun toString(): String = "Person()" + @Generated public companion object 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 5d9dd7ec..e986ec3d 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,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.jvm.JvmName @Generated @@ -34,6 +35,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__me === meDefault) meDefault else me) + override fun toString(): String = listOfNotNull(if (__me === meDefault) null else "me=" + + me).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val meDefault: () -> Person? = 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 02ec3c3a..4c96c4b6 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,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.jvm.JvmName @Generated @@ -34,6 +35,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__test === testDefault) testDefault else test) + override fun toString(): String = listOfNotNull(if (__test === testDefault) null else "test=" + + test).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val testDefault: () -> RequiredTestType? = 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 ccf6f121..008d20b2 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.jvm.JvmName @Generated @@ -35,6 +36,9 @@ public class RequiredTestType( override fun hashCode(): Int = Objects.hash(if (__isRequired === isRequiredDefault) isRequiredDefault else isRequired) + override fun toString(): String = listOfNotNull(if (__isRequired === isRequiredDefault) null else + "isRequired=" + isRequired).joinToString(prefix = "RequiredTestType(", postfix = ")") + @Generated public companion object { private val isRequiredDefault: () -> Boolean = 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 11e10b57..a8d8424f 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,6 +13,7 @@ import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.Long +import kotlin.String import kotlin.jvm.JvmName @Generated @@ -46,6 +47,10 @@ public class Entity( override fun hashCode(): Int = Objects.hash(if (__long === longDefault) longDefault else long, if (__dateTime === dateTimeDefault) dateTimeDefault else dateTime) + override fun toString(): String = listOfNotNull(if (__long === longDefault) null else "long=" + + long, if (__dateTime === dateTimeDefault) null else "dateTime=" + + dateTime).joinToString(prefix = "Entity(", postfix = ")") + @Generated public companion object { private val longDefault: () -> Long? = 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 1d4407bb..5591d992 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -46,6 +47,10 @@ public class EntityConnection( else pageInfo, if (__edges === edgesDefault) edgesDefault else edges) + override fun toString(): String = listOfNotNull(if (__pageInfo === pageInfoDefault) null else + "pageInfo=" + pageInfo, if (__edges === edgesDefault) null else "edges=" + + edges).joinToString(prefix = "EntityConnection(", postfix = ")") + @Generated public companion object { private val pageInfoDefault: () -> PageInfo = 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 f13d02a1..e6c6f44d 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 @@ -46,6 +46,10 @@ public class EntityEdge( cursor, if (__node === nodeDefault) nodeDefault else node) + override fun toString(): String = listOfNotNull(if (__cursor === cursorDefault) null else + "cursor=" + cursor, if (__node === nodeDefault) null else "node=" + node).joinToString(prefix + = "EntityEdge(", postfix = ")") + @Generated public companion object { private val cursorDefault: () -> String = 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 5bf1e279..252acd30 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 @@ -67,6 +67,12 @@ public class PageInfo( if (__hasNextPage === hasNextPageDefault) hasNextPageDefault else hasNextPage, if (__hasPreviousPage === hasPreviousPageDefault) hasPreviousPageDefault else hasPreviousPage) + override fun toString(): String = listOfNotNull(if (__startCursor === startCursorDefault) null + else "startCursor=" + startCursor, if (__endCursor === endCursorDefault) null else + "endCursor=" + endCursor, if (__hasNextPage === hasNextPageDefault) null else "hasNextPage=" + + hasNextPage, if (__hasPreviousPage === hasPreviousPageDefault) null else "hasPreviousPage=" + + hasPreviousPage).joinToString(prefix = "PageInfo(", postfix = ")") + @Generated public companion object { private val startCursorDefault: () -> String? = 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 870b3b71..1a6bebf7 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -47,6 +48,10 @@ public class Query( entity, if (__entityConnection === entityConnectionDefault) entityConnectionDefault else entityConnection) + override fun toString(): String = listOfNotNull(if (__entity === entityDefault) null else + "entity=" + entity, if (__entityConnection === entityConnectionDefault) null else + "entityConnection=" + entityConnection).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val entityDefault: () -> List? = 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 97b0f9aa..849e9775 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 @@ -55,6 +55,10 @@ public class Car( if (__model === modelDefault) modelDefault else model, if (__engine === engineDefault) engineDefault else engine) + override fun toString(): String = listOfNotNull(if (__make === makeDefault) null else "make=" + + make, if (__model === modelDefault) null else "model=" + model, if (__engine === + engineDefault) null else "engine=" + engine).joinToString(prefix = "Car(", postfix = ")") + @Generated public companion object { private val makeDefault: () -> String? = 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 bc77be98..1177db39 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 @@ -66,6 +66,11 @@ public class Engine( if (__size === sizeDefault) sizeDefault else size, if (__performance === performanceDefault) performanceDefault else performance) + override fun toString(): String = listOfNotNull(if (__type === typeDefault) null else "type=" + + type, if (__bhp === bhpDefault) null else "bhp=" + bhp, if (__size === sizeDefault) null else + "size=" + size, if (__performance === performanceDefault) null else "performance=" + + performance).joinToString(prefix = "Engine(", postfix = ")") + @Generated public companion object { private val typeDefault: () -> String? = 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 ff28dac2..3a865ba6 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,6 +12,7 @@ import kotlin.Any import kotlin.Boolean import kotlin.Double import kotlin.Int +import kotlin.String import kotlin.jvm.JvmName @Generated @@ -46,6 +47,10 @@ public class Performance( zeroToSixtyDefault else zeroToSixty, if (__quarterMile === quarterMileDefault) quarterMileDefault else quarterMile) + override fun toString(): String = listOfNotNull(if (__zeroToSixty === zeroToSixtyDefault) null + else "zeroToSixty=" + zeroToSixty, if (__quarterMile === quarterMileDefault) null else + "quarterMile=" + quarterMile).joinToString(prefix = "Performance(", postfix = ")") + @Generated public companion object { private val zeroToSixtyDefault: () -> Double? = 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 fcb4e543..90feba7e 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -35,6 +36,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__cars === carsDefault) carsDefault else cars) + override fun toString(): String = listOfNotNull(if (__cars === carsDefault) null else "cars=" + + cars).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val carsDefault: () -> List? = 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 986849e6..ccedc656 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else people) + override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else + "people=" + people).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val peopleDefault: () -> List? = diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Employee.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Employee.kt index abad5a62..b98c78c6 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Employee.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Employee.kt @@ -70,6 +70,11 @@ public class Employee( if (__company === companyDefault) companyDefault else company, if (__age === ageDefault) ageDefault else age) + override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else + "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + + lastname, if (__company === companyDefault) null else "company=" + company, if (__age === + ageDefault) null else "age=" + age).joinToString(prefix = "Employee(", postfix = ")") + @Generated public companion object { private val firstnameDefault: () -> String = diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Query.kt index 3b109032..15fac46d 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Query.kt @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else people) + override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else + "people=" + people).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val peopleDefault: () -> List? = 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 a9ee5793..c30034e8 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 @@ -59,6 +59,11 @@ public class Employee( if (__lastname === lastnameDefault) lastnameDefault else lastname, if (__company === companyDefault) companyDefault else company) + override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else + "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + + lastname, if (__company === companyDefault) null else "company=" + + company).joinToString(prefix = "Employee(", postfix = ")") + @Generated public companion object { private val firstnameDefault: () -> 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 72c798a6..528c896e 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else people) + override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else + "people=" + people).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val peopleDefault: () -> List? = 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 50b06e98..6a715a15 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else people) + override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else + "people=" + people).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val peopleDefault: () -> List? = 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 db020fa2..3672486e 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 @@ -70,6 +70,12 @@ public class Talent( if (__company === companyDefault) companyDefault else company, if (__imdbProfile === imdbProfileDefault) imdbProfileDefault else imdbProfile) + override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else + "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + + lastname, if (__company === companyDefault) null else "company=" + company, if (__imdbProfile + === imdbProfileDefault) null else "imdbProfile=" + imdbProfile).joinToString(prefix = + "Talent(", postfix = ")") + @Generated public companion object { private val firstnameDefault: () -> String = 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 a7e71b5b..da05b343 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 @@ -46,6 +46,10 @@ public class Person( override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name, if (__email === emailDefault) emailDefault else email) + override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + + name, if (__email === emailDefault) null else "email=" + email).joinToString(prefix = + "Person(", postfix = ")") + @Generated public companion object { private val nameDefault: () -> String? = 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 80f1e02c..607515b5 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else people) + override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else + "people=" + people).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val peopleDefault: () -> List? = 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 778b20ed..1630e73a 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 @@ -39,6 +39,9 @@ public class Product( override fun hashCode(): Int = Objects.hash(if (__id === idDefault) idDefault else id) + override fun toString(): String = listOfNotNull(if (__id === idDefault) null else "id=" + + id).joinToString(prefix = "Product(", postfix = ")") + @Generated public companion object { private val idDefault: () -> String = 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 4e489069..8a967ae1 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__products === productsDefault) productsDefault else products) + override fun toString(): String = listOfNotNull(if (__products === productsDefault) null else + "products=" + products).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val productsDefault: () -> List? = 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 52c5676f..989af327 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,6 +13,7 @@ import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.Long +import kotlin.String import kotlin.jvm.JvmName @Generated @@ -46,6 +47,10 @@ public class Entity( override fun hashCode(): Int = Objects.hash(if (__long === longDefault) longDefault else long, if (__dateTime === dateTimeDefault) dateTimeDefault else dateTime) + override fun toString(): String = listOfNotNull(if (__long === longDefault) null else "long=" + + long, if (__dateTime === dateTimeDefault) null else "dateTime=" + + dateTime).joinToString(prefix = "Entity(", postfix = ")") + @Generated public companion object { private val longDefault: () -> Long? = 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 e8763721..77a9a946 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 @@ -46,6 +46,10 @@ public class EntityEdge( cursor, if (__node === nodeDefault) nodeDefault else node) + override fun toString(): String = listOfNotNull(if (__cursor === cursorDefault) null else + "cursor=" + cursor, if (__node === nodeDefault) null else "node=" + node).joinToString(prefix + = "EntityEdge(", postfix = ")") + @Generated public companion object { private val cursorDefault: () -> String = 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 42cddd79..b6428e93 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 @@ -12,6 +12,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -48,6 +49,10 @@ public class Query( entity, if (__entityConnection === entityConnectionDefault) entityConnectionDefault else entityConnection) + override fun toString(): String = listOfNotNull(if (__entity === entityDefault) null else + "entity=" + entity, if (__entityConnection === entityConnectionDefault) null else + "entityConnection=" + entityConnection).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val entityDefault: () -> List? = 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 ee11b4b3..327803a8 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 @@ -60,6 +60,11 @@ public class Employee( if (__lastname === lastnameDefault) lastnameDefault else lastname, if (__company === companyDefault) companyDefault else company) + override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else + "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + + lastname, if (__company === companyDefault) null else "company=" + + company).joinToString(prefix = "Employee(", postfix = ")") + @Generated public companion object { private val firstnameDefault: () -> 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 ad76917b..f48492e6 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else people) + override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else + "people=" + people).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val peopleDefault: () -> List? = 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 cd2c65c3..2b470eda 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,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.jvm.JvmName @Generated @@ -34,6 +35,9 @@ public class MyType( override fun hashCode(): Int = Objects.hash(if (__other === otherDefault) otherDefault else other) + override fun toString(): String = listOfNotNull(if (__other === otherDefault) null else "other=" + + other).joinToString(prefix = "MyType(", postfix = ")") + @Generated public companion object { private val otherDefault: () -> OtherType = 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 3f58afb1..7a727467 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 @@ -35,6 +35,9 @@ public class OtherType( override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name) + override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + + name).joinToString(prefix = "OtherType(", postfix = ")") + @Generated public companion object { private val nameDefault: () -> String = 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 fb748ef1..5fd5d1ca 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 @@ -46,6 +46,10 @@ public class Person( override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name, if (__email === emailDefault) emailDefault else email) + override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + + name, if (__email === emailDefault) null else "email=" + email).joinToString(prefix = + "Person(", postfix = ")") + @Generated public companion object { private val nameDefault: () -> String = 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 fbc48a0d..3947fd55 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else people) + override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else + "people=" + people).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val peopleDefault: () -> List? = 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 e8b8f87f..db589320 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 @@ -12,6 +12,7 @@ import kotlin.Any import kotlin.Boolean import kotlin.Double import kotlin.Int +import kotlin.String import kotlin.jvm.JvmName @Generated @@ -55,6 +56,10 @@ public class MyType( if (__truth === truthDefault) truthDefault else truth, if (__floaty === floatyDefault) floatyDefault else floaty) + override fun toString(): String = listOfNotNull(if (__count === countDefault) null else "count=" + + count, if (__truth === truthDefault) null else "truth=" + truth, if (__floaty === + floatyDefault) null else "floaty=" + floaty).joinToString(prefix = "MyType(", postfix = ")") + @Generated public companion object { private val countDefault: () -> Int = 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 d6408759..bb42b12e 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 @@ -12,6 +12,7 @@ import kotlin.Any import kotlin.Boolean import kotlin.Double import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -56,6 +57,10 @@ public class MyType( if (__truth === truthDefault) truthDefault else truth, if (__floaty === floatyDefault) floatyDefault else floaty) + override fun toString(): String = listOfNotNull(if (__count === countDefault) null else "count=" + + count, if (__truth === truthDefault) null else "truth=" + truth, if (__floaty === + floatyDefault) null else "floaty=" + floaty).joinToString(prefix = "MyType(", postfix = ")") + @Generated public companion object { private val countDefault: () -> List? = 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 e05f6f20..194f1b86 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 @@ -46,6 +46,10 @@ public class Person( override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name, if (__email === emailDefault) emailDefault else email) + override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + + name, if (__email === emailDefault) null else "email=" + email).joinToString(prefix = + "Person(", postfix = ")") + @Generated public companion object { private val nameDefault: () -> String = 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 e6899c5f..ce81e90d 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else people) + override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else + "people=" + people).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val peopleDefault: () -> List? = 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 8cc35b68..b68de60e 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 @@ -12,6 +12,7 @@ import kotlin.Any import kotlin.Boolean import kotlin.Double import kotlin.Int +import kotlin.String import kotlin.jvm.JvmName @Generated @@ -55,6 +56,10 @@ public class MyType( if (__truth === truthDefault) truthDefault else truth, if (__floaty === floatyDefault) floatyDefault else floaty) + override fun toString(): String = listOfNotNull(if (__count === countDefault) null else "count=" + + count, if (__truth === truthDefault) null else "truth=" + truth, if (__floaty === + floatyDefault) null else "floaty=" + floaty).joinToString(prefix = "MyType(", postfix = ")") + @Generated public companion object { private val countDefault: () -> Int? = 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 b39fe57f..cee267ff 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 @@ -57,6 +57,11 @@ public class Person( if (__lastname === lastnameDefault) lastnameDefault else lastname, if (__friends === friendsDefault) friendsDefault else friends) + override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else + "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + + lastname, if (__friends === friendsDefault) null else "friends=" + + friends).joinToString(prefix = "Person(", postfix = ")") + @Generated public companion object { private val firstnameDefault: () -> String? = 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 a1f44c57..bc61791b 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else people) + override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else + "people=" + people).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val peopleDefault: () -> List? = diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Person.kt index 478b2ee2..ab0b9c3c 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Person.kt @@ -45,6 +45,10 @@ public class Person( override fun hashCode(): Int = Objects.hash(if (__info === infoDefault) infoDefault else info, if (__interface === interfaceDefault) interfaceDefault else `interface`) + override fun toString(): String = listOfNotNull(if (__info === infoDefault) null else "info=" + + info, if (__interface === interfaceDefault) null else "interface=" + + `interface`).joinToString(prefix = "Person(", postfix = ")") + @Generated public companion object { private val infoDefault: () -> String? = diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Query.kt index 1f894e64..fcec2611 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Query.kt @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else people) + override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else + "people=" + people).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val peopleDefault: () -> List? = 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 1250317c..ef035e3a 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 @@ -36,6 +36,9 @@ public class SampleType( override fun hashCode(): Int = Objects.hash(if (__return === returnDefault) returnDefault else `return`) + override fun toString(): String = listOfNotNull(if (__return === returnDefault) null else + "return=" + `return`).joinToString(prefix = "SampleType(", postfix = ")") + @Generated public companion object { private val returnDefault: () -> String = 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 50c2c2ba..ad946882 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 @@ -46,6 +46,10 @@ public class Person( else firstname, if (__lastname === lastnameDefault) lastnameDefault else lastname) + override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else + "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + + lastname).joinToString(prefix = "Person(", postfix = ")") + @Generated public companion object { private val firstnameDefault: () -> String? = 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 e4c5f00a..7e7bf661 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else people) + override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else + "people=" + people).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val peopleDefault: () -> List? = 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 60e8b468..7f9699e4 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -35,6 +36,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__types === typesDefault) typesDefault else types) + override fun toString(): String = listOfNotNull(if (__types === typesDefault) null else "types=" + + types).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val typesDefault: () -> List? = 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 ece69b20..c37f9de3 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -35,6 +36,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__types === typesDefault) typesDefault else types) + override fun toString(): String = listOfNotNull(if (__types === typesDefault) null else "types=" + + types).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val typesDefault: () -> List? = diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/extendedDataClassWithInterface/expected/types/Example.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/extendedDataClassWithInterface/expected/types/Example.kt index 70e0d474..8f4dc31c 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/extendedDataClassWithInterface/expected/types/Example.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/extendedDataClassWithInterface/expected/types/Example.kt @@ -49,6 +49,10 @@ public class Example( override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name, if (__age === ageDefault) ageDefault else age) + override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + + name, if (__age === ageDefault) null else "age=" + age).joinToString(prefix = "Example(", + postfix = ")") + @Generated public companion object { private val nameDefault: () -> String? = 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 1c8a83cd..3174d4c9 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 @@ -37,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__movies === moviesDefault) moviesDefault else movies) + override fun toString(): String = listOfNotNull(if (__movies === moviesDefault) null else + "movies=" + movies).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val moviesDefault: () -> List? = diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultBigDecimal/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultBigDecimal/expected/types/Query.kt index 3c77fc1e..6c483682 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultBigDecimal/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultBigDecimal/expected/types/Query.kt @@ -36,6 +36,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__orders === ordersDefault) ordersDefault else orders) + override fun toString(): String = listOfNotNull(if (__orders === ordersDefault) null else + "orders=" + orders).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val ordersDefault: () -> String? = diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultCurrency/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultCurrency/expected/types/Query.kt index de758e74..7d707ded 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultCurrency/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultCurrency/expected/types/Query.kt @@ -36,6 +36,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__orders === ordersDefault) ordersDefault else orders) + override fun toString(): String = listOfNotNull(if (__orders === ordersDefault) null else + "orders=" + orders).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val ordersDefault: () -> String? = 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 0e89914f..d3f14c74 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 @@ -37,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__movies === moviesDefault) moviesDefault else movies) + override fun toString(): String = listOfNotNull(if (__movies === moviesDefault) null else + "movies=" + movies).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val moviesDefault: () -> List? = 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 ace62ed8..698601d1 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 @@ -93,6 +93,12 @@ public class Bird( if (__father === fatherDefault) fatherDefault else father, if (__parents === parentsDefault) parentsDefault else parents) + override fun toString(): String = listOfNotNull(if (__id === idDefault) null else "id=" + id, if + (__name === nameDefault) null else "name=" + name, if (__address === addressDefault) null else + "address=" + address, if (__mother === motherDefault) null else "mother=" + mother, if + (__father === fatherDefault) null else "father=" + father, if (__parents === parentsDefault) + null else "parents=" + parents).joinToString(prefix = "Bird(", postfix = ")") + @Generated public companion object { private val idDefault: () -> String = 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 ca09ddd5..3c3355c4 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 @@ -93,6 +93,12 @@ public class Dog( if (__father === fatherDefault) fatherDefault else father, if (__parents === parentsDefault) parentsDefault else parents) + override fun toString(): String = listOfNotNull(if (__id === idDefault) null else "id=" + id, if + (__name === nameDefault) null else "name=" + name, if (__address === addressDefault) null else + "address=" + address, if (__mother === motherDefault) null else "mother=" + mother, if + (__father === fatherDefault) null else "father=" + father, if (__parents === parentsDefault) + null else "parents=" + parents).joinToString(prefix = "Dog(", postfix = ")") + @Generated public companion object { private val idDefault: () -> 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 21baf959..e8df2d87 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 @@ -48,6 +48,10 @@ public class Dog( override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name, if (__diet === dietDefault) dietDefault else diet) + override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + + name, if (__diet === dietDefault) null else "diet=" + diet).joinToString(prefix = "Dog(", + postfix = ")") + @Generated public companion object { private val nameDefault: () -> String? = 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 5b8d4700..15e4ae18 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 @@ -49,6 +49,10 @@ public class Vegetarian( else calories, if (__vegetables === vegetablesDefault) vegetablesDefault else vegetables) + override fun toString(): String = listOfNotNull(if (__calories === caloriesDefault) null else + "calories=" + calories, if (__vegetables === vegetablesDefault) null else "vegetables=" + + vegetables).joinToString(prefix = "Vegetarian(", postfix = ")") + @Generated public companion object { private val caloriesDefault: () -> String? = 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 90614113..e5871c5e 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 @@ -59,6 +59,11 @@ public class Employee( if (__lastname === lastnameDefault) lastnameDefault else lastname, if (__company === companyDefault) companyDefault else company) + override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else + "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + + lastname, if (__company === companyDefault) null else "company=" + + company).joinToString(prefix = "Employee(", postfix = ")") + @Generated public companion object { private val firstnameDefault: () -> 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 3bb31bfb..b09d10e2 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else people) + override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else + "people=" + people).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val peopleDefault: () -> 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 feac8daf..de29fe2a 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__fruits === fruitsDefault) fruitsDefault else fruits) + override fun toString(): String = listOfNotNull(if (__fruits === fruitsDefault) null else + "fruits=" + fruits).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val fruitsDefault: () -> List? = 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 d56f8bdd..1aa70f5f 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 @@ -35,6 +35,9 @@ public class Seed( override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name) + override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + + name).joinToString(prefix = "Seed(", postfix = ")") + @Generated public companion object { private val nameDefault: () -> String? = diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/Query.kt index 5648adce..2de60ac4 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/Query.kt @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -35,6 +36,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__is === isDefault) isDefault else `is`) + override fun toString(): String = listOfNotNull(if (__is === isDefault) null else "is=" + + `is`).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val isDefault: () -> List? = diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/T.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/T.kt index 24e6b960..0b37d412 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/T.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/T.kt @@ -47,6 +47,9 @@ public class T( override fun hashCode(): Int = Objects.hash(if (___id === _idDefault) _idDefault else _id, if (__id === idDefault) idDefault else id) + override fun toString(): String = listOfNotNull(if (___id === _idDefault) null else "_id=" + _id, + if (__id === idDefault) null else "id=" + id).joinToString(prefix = "T(", postfix = ")") + @Generated public companion object { private val _idDefault: () -> String? = 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 8cc2edcf..3749ba52 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -45,6 +46,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__e === eDefault) eDefault else e, if (__es === esDefault) esDefault else es) + override fun toString(): String = listOfNotNull(if (__e === eDefault) null else "e=" + e, if (__es + === esDefault) null else "es=" + es).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val eDefault: () -> E? = 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 3c1f9314..0060233e 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 @@ -45,6 +45,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__q1 === q1Default) q1Default else q1, if (__q2 === q2Default) q2Default else q2) + override fun toString(): String = listOfNotNull(if (__q1 === q1Default) null else "q1=" + q1, if + (__q2 === q2Default) null else "q2=" + q2).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val q1Default: () -> String? = 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 8bf03705..9ab097bb 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 @@ -36,6 +36,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__string === stringDefault) stringDefault else string) + override fun toString(): String = listOfNotNull(if (__string === stringDefault) null else + "string=" + string).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val stringDefault: () -> String? = 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 91ed6fef..3d0077d9 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 @@ -47,6 +47,10 @@ public class Query( string, if (__strings === stringsDefault) stringsDefault else strings) + override fun toString(): String = listOfNotNull(if (__string === stringDefault) null else + "string=" + string, if (__strings === stringsDefault) null else "strings=" + + strings).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val stringDefault: () -> String? = 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 f0ae5ad1..fd7e111b 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 @@ -48,6 +48,10 @@ public class Employee( else firstname, if (__company === companyDefault) companyDefault else company) + override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else + "firstname=" + firstname, if (__company === companyDefault) null else "company=" + + company).joinToString(prefix = "Employee(", postfix = ")") + @Generated public companion object { private val firstnameDefault: () -> 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 b6cc6ee9..da40eb53 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -46,6 +47,10 @@ public class Query( person, if (__people === peopleDefault) peopleDefault else people) + override fun toString(): String = listOfNotNull(if (__person === personDefault) null else + "person=" + person, if (__people === peopleDefault) null else "people=" + + people).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val personDefault: () -> Person? = 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 6e5fd660..d38d1793 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 @@ -48,6 +48,10 @@ public class Employee( else firstname, if (__company === companyDefault) companyDefault else company) + override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else + "firstname=" + firstname, if (__company === companyDefault) null else "company=" + + company).joinToString(prefix = "Employee(", postfix = ")") + @Generated public companion object { private val firstnameDefault: () -> 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 9c9e712d..1e1a6934 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,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.jvm.JvmName @Generated @@ -35,6 +36,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__person === personDefault) personDefault else person) + override fun toString(): String = listOfNotNull(if (__person === personDefault) null else + "person=" + person).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val personDefault: () -> Person? = 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 a4093e39..3ba6ec7e 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 @@ -49,6 +49,10 @@ public class Employee( else firstname, if (__company === companyDefault) companyDefault else company) + override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else + "firstname=" + firstname, if (__company === companyDefault) null else "company=" + + company).joinToString(prefix = "Employee(", postfix = ")") + @Generated public companion object { private val firstnameDefault: () -> 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 14f565d2..fecc738e 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -45,6 +46,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__u === uDefault) uDefault else u, if (__us === usDefault) usDefault else us) + override fun toString(): String = listOfNotNull(if (__u === uDefault) null else "u=" + u, if (__us + === usDefault) null else "us=" + us).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val uDefault: () -> U? = 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 0dbc74d2..15e5587e 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 @@ -35,6 +35,9 @@ public class Person( override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name) + override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + + name).joinToString(prefix = "Person(", postfix = ")") + @Generated public companion object { private val nameDefault: () -> String? = 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 ab16518d..c60a1dd3 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 @@ -35,6 +35,9 @@ public class Person( override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name) + override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + + name).joinToString(prefix = "Person(", postfix = ")") + @Generated public companion object { private val nameDefault: () -> String? = 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 b8c91edf..35a8a037 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 @@ -35,6 +35,9 @@ public class Actor( override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name) + override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + + name).joinToString(prefix = "Actor(", postfix = ")") + @Generated public companion object { private val nameDefault: () -> String? = 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 a5be70d2..152b8bac 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 @@ -35,6 +35,9 @@ public class Movie( override fun hashCode(): Int = Objects.hash(if (__title === titleDefault) titleDefault else title) + override fun toString(): String = listOfNotNull(if (__title === titleDefault) null else "title=" + + title).joinToString(prefix = "Movie(", postfix = ")") + @Generated public companion object { private val titleDefault: () -> String? = 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 8e57cc93..310887b8 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__search === searchDefault) searchDefault else search) + override fun toString(): String = listOfNotNull(if (__search === searchDefault) null else + "search=" + search).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val searchDefault: () -> List? = 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 f1647ea9..6cfdba8e 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 @@ -56,6 +56,11 @@ public class Droid( if (__name === nameDefault) nameDefault else name, if (__primaryFunction === primaryFunctionDefault) primaryFunctionDefault else primaryFunction) + override fun toString(): String = listOfNotNull(if (__id === idDefault) null else "id=" + id, if + (__name === nameDefault) null else "name=" + name, if (__primaryFunction === + primaryFunctionDefault) null else "primaryFunction=" + primaryFunction).joinToString(prefix = + "Droid(", postfix = ")") + @Generated public companion object { private val idDefault: () -> String = 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 d9b6aa1c..c4d04213 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 @@ -55,6 +55,10 @@ public class Human( if (__name === nameDefault) nameDefault else name, if (__totalCredits === totalCreditsDefault) totalCreditsDefault else totalCredits) + override fun toString(): String = listOfNotNull(if (__id === idDefault) null else "id=" + id, if + (__name === nameDefault) null else "name=" + name, if (__totalCredits === totalCreditsDefault) + null else "totalCredits=" + totalCredits).joinToString(prefix = "Human(", postfix = ")") + @Generated public companion object { private val idDefault: () -> String = 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 d337d5d2..ccb5fb85 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,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.jvm.JvmName @Generated @@ -35,6 +36,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__search === searchDefault) searchDefault else search) + override fun toString(): String = listOfNotNull(if (__search === searchDefault) null else + "search=" + search).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val searchDefault: () -> SearchResultPage? = 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 9f60997d..debe958e 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -35,6 +36,9 @@ public class SearchResultPage( override fun hashCode(): Int = Objects.hash(if (__items === itemsDefault) itemsDefault else items) + override fun toString(): String = listOfNotNull(if (__items === itemsDefault) null else "items=" + + items).joinToString(prefix = "SearchResultPage(", postfix = ")") + @Generated public companion object { private val itemsDefault: () -> List? = 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 eed77ed6..274e16c2 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 @@ -35,6 +35,9 @@ public class Actor( override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name) + override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + + name).joinToString(prefix = "Actor(", postfix = ")") + @Generated public companion object { private val nameDefault: () -> String? = 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 222b5b08..9dbf604e 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 @@ -35,6 +35,9 @@ public class Movie( override fun hashCode(): Int = Objects.hash(if (__title === titleDefault) titleDefault else title) + override fun toString(): String = listOfNotNull(if (__title === titleDefault) null else "title=" + + title).joinToString(prefix = "Movie(", postfix = ")") + @Generated public companion object { private val titleDefault: () -> String? = 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 727e8c92..9b854be1 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -36,6 +37,9 @@ public class Query( override fun hashCode(): Int = Objects.hash(if (__search === searchDefault) searchDefault else search) + override fun toString(): String = listOfNotNull(if (__search === searchDefault) null else + "search=" + search).joinToString(prefix = "Query(", postfix = ")") + @Generated public companion object { private val searchDefault: () -> List? = 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 8ce68bd2..9f3a36a9 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 @@ -11,6 +11,7 @@ import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int +import kotlin.String import kotlin.jvm.JvmName @Generated @@ -34,6 +35,9 @@ public class Rating( override fun hashCode(): Int = Objects.hash(if (__stars === starsDefault) starsDefault else stars) + override fun toString(): String = listOfNotNull(if (__stars === starsDefault) null else "stars=" + + stars).joinToString(prefix = "Rating(", postfix = ")") + @Generated public companion object { private val starsDefault: () -> Int? = diff --git a/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/kotlin2/GenerateKotlin2DataTypes.kt b/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/kotlin2/GenerateKotlin2DataTypes.kt index 84f74852..fc371104 100644 --- a/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/kotlin2/GenerateKotlin2DataTypes.kt +++ b/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/kotlin2/GenerateKotlin2DataTypes.kt @@ -48,6 +48,7 @@ import com.squareup.kotlinpoet.KModifier import com.squareup.kotlinpoet.LambdaTypeName import com.squareup.kotlinpoet.ParameterSpec import com.squareup.kotlinpoet.PropertySpec +import com.squareup.kotlinpoet.STRING import com.squareup.kotlinpoet.TypeSpec import com.squareup.kotlinpoet.asClassName import com.squareup.kotlinpoet.buildCodeBlock @@ -268,6 +269,8 @@ fun generateKotlin2DataTypes( ) // add value-based equals/hashCode over the requested fields .addFunctions(equalsAndHashCodeFunctions(className, fields)) + // add a toString rendering only the requested fields + .addFunction(toStringFunction(className, fields)) .build() // return a file per type @@ -291,7 +294,7 @@ fun generateKotlin2DataTypes( * against the companion's default lambda, never by invoking it or matching the * exception message. */ -private class EqualsHashCodeFieldNames( +private class GeneratedFieldNames( field: KotlinFieldInfo, ) { // Computed as whole identifiers (not "__" + %N) so KotlinPoet's keyword-escaping of a single @@ -310,7 +313,7 @@ private fun equalsAndHashCodeFunctions( return emptyList() } - val names = fields.map(::EqualsHashCodeFieldNames) + val names = fields.map(::GeneratedFieldNames) val equalsFun = FunSpec @@ -369,3 +372,42 @@ private fun equalsAndHashCodeFunctions( return listOf(equalsFun, hashCodeFun) } + +/** + * Generates a `toString` for a kotlin2 data type that renders only the fields that were + * requested, in declaration order - not the full, possibly-throwing set of fields a fixed-field + * data class would show. See [Netflix/dgs-codegen#638](https://github.com/Netflix/dgs-codegen/issues/638). + */ +private fun toStringFunction( + className: ClassName, + fields: List, +): FunSpec { + val builder = + FunSpec + .builder("toString") + .addModifiers(KModifier.OVERRIDE) + .returns(STRING) + + if (fields.isEmpty()) { + return builder.addStatement("return %S", "${className.simpleName}()").build() + } + + val names = fields.map(::GeneratedFieldNames) + + return builder + .addStatement( + "return listOfNotNull(%L).joinToString(prefix = %S, postfix = %S)", + names + .map { n -> + CodeBlock.of( + "if (%N === %N) null else %S + %N", + n.backing, + n.default, + "${n.getter}=", + n.getter, + ) + }.joinToCode(separator = ", "), + "${className.simpleName}(", + ")", + ).build() +} From 78b449e49ed7a8bb6590c36847bbc2a55539ca52 Mon Sep 17 00:00:00 2001 From: yshepilov Date: Mon, 3 Aug 2026 10:59:52 +0200 Subject: [PATCH 3/3] Restructure kotlin2 equals/hashCode/toString for readability Same semantics as before (same-class check, identical requested-field set required, never invoke an unrequested supplier, absent != requested-null, never throws) - purely a shape change, requested by review because the previous joinToCode-based bodies wrapped badly. - equals/hashCode now delegate to a private `__$fieldValues(): List` helper that snapshots every field (using the field's own default lambda as the "unrequested" placeholder instead of invoking it). Two instances are equal iff `this === other || (other is T && fieldValues() == other.fieldValues())`; hashCode is `fieldValues().hashCode()`. A mismatched requested-field set already forces a mismatched list entry at that field's index, so no separate "same requested set" check is needed on top - verified by the existing runtime test, left unmodified. - toString gets its own `__$fieldStrings(): List` helper (it needs field names, so it can't reuse fieldValues()), then joins them. - Both helper names are backtick-escaped and contain "$", which GraphQL Names can never contain, so they can't collide with a member derived from any field (e.g. a field literally named `fieldValues`). - The list literals are built from plain "\n"-containing string literals, not KotlinPoet's indent()/unindent(), which - confirmed by reproducing it in isolation - leaves the CodeWriter's indent level unbalanced after a single-expression function body collapses to `= ...`. Regenerates 97 golden expected-output files (the one zero-field case's toString was already just "ClassName()" and is unchanged). --- .../expected/types/Person.kt | 31 +-- .../expected/types/Query.kt | 24 +- .../expected/types/Person.kt | 31 +-- .../expected/types/Query.kt | 24 +- .../expected/types/Query.kt | 24 +- .../expected/types/Person.kt | 31 +-- .../expected/types/Query.kt | 30 +-- .../expected/types/Person.kt | 37 ++- .../expected/types/Query.kt | 24 +- .../dataClassDocs/expected/types/Movie.kt | 24 +- .../dataClassDocs/expected/types/Query.kt | 25 +- .../expected/types/Movie.kt | 24 +- .../expected/types/Query.kt | 25 +- .../expected/types/Query.kt | 24 +- .../expected/types/Query.kt | 24 +- .../expected/types/RequiredTestType.kt | 25 +- .../expected/types/Entity.kt | 30 +-- .../expected/types/EntityConnection.kt | 30 +-- .../expected/types/EntityEdge.kt | 31 +-- .../expected/types/PageInfo.kt | 47 ++-- .../expected/types/Query.kt | 33 +-- .../expected/types/Car.kt | 34 +-- .../expected/types/Engine.kt | 41 ++-- .../expected/types/Performance.kt | 31 +-- .../expected/types/Query.kt | 23 +- .../expected/types/Query.kt | 24 +- .../expected/types/Employee.kt | 42 ++-- .../expected/types/Query.kt | 24 +- .../expected/types/Employee.kt | 37 ++- .../expected/types/Query.kt | 24 +- .../expected/types/Query.kt | 24 +- .../expected/types/Talent.kt | 45 ++-- .../expected/types/Person.kt | 29 +-- .../expected/types/Query.kt | 24 +- .../expected/types/Product.kt | 24 +- .../expected/types/Query.kt | 24 +- .../expected/types/Entity.kt | 30 +-- .../expected/types/EntityEdge.kt | 31 +-- .../expected/types/Query.kt | 33 +-- .../expected/types/Employee.kt | 37 ++- .../expected/types/Query.kt | 24 +- .../expected/types/MyType.kt | 24 +- .../expected/types/OtherType.kt | 24 +- .../expected/types/Person.kt | 29 +-- .../expected/types/Query.kt | 24 +- .../expected/types/MyType.kt | 35 +-- .../expected/types/MyType.kt | 34 +-- .../expected/types/Person.kt | 29 +-- .../expected/types/Query.kt | 24 +- .../expected/types/MyType.kt | 35 +-- .../expected/types/Person.kt | 36 ++- .../expected/types/Query.kt | 24 +- .../expected/types/Person.kt | 30 +-- .../expected/types/Query.kt | 24 +- .../expected/types/SampleType.kt | 25 +- .../expected/types/Person.kt | 31 +-- .../expected/types/Query.kt | 24 +- .../cases/enum/expected/types/Query.kt | 23 +- .../expected/types/Query.kt | 23 +- .../expected/types/Example.kt | 30 +-- .../cases/input/expected/types/Query.kt | 24 +- .../expected/types/Query.kt | 25 +- .../expected/types/Query.kt | 25 +- .../expected/types/Query.kt | 24 +- .../expected/types/Bird.kt | 55 ++--- .../expected/types/Dog.kt | 54 ++--- .../expected/types/Dog.kt | 29 +-- .../expected/types/Vegetarian.kt | 30 +-- .../expected/types/Employee.kt | 37 ++- .../expected/types/Query.kt | 24 +- .../expected/types/Query.kt | 24 +- .../expected/types/Seed.kt | 24 +- .../expected/types/Query.kt | 23 +- .../expected/types/T.kt | 28 +-- .../expected/types/Query.kt | 28 +-- .../expected/types/Query.kt | 29 +-- .../expected/types/Query.kt | 25 +- .../expected/types/Query.kt | 30 +-- .../expected/types/Employee.kt | 31 +-- .../expected/types/Query.kt | 30 +-- .../expected/types/Employee.kt | 31 +-- .../expected/types/Query.kt | 25 +- .../expected/types/Employee.kt | 31 +-- .../expected/types/Query.kt | 28 +-- .../expected/types/Person.kt | 24 +- .../expected/types/Person.kt | 24 +- .../cases/union/expected/types/Actor.kt | 24 +- .../cases/union/expected/types/Movie.kt | 24 +- .../cases/union/expected/types/Query.kt | 24 +- .../expected/types/Droid.kt | 38 +-- .../expected/types/Human.kt | 35 +-- .../expected/types/Query.kt | 25 +- .../expected/types/SearchResultPage.kt | 23 +- .../expected/types/Actor.kt | 24 +- .../expected/types/Movie.kt | 24 +- .../expected/types/Query.kt | 24 +- .../expected/types/Rating.kt | 24 +- .../kotlin2/GenerateKotlin2DataTypes.kt | 219 +++++++++++------- 98 files changed, 1602 insertions(+), 1399 deletions(-) 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 c9ac6abb..3d308fb4 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.constantsForInputTypes.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -33,22 +33,23 @@ public class Person( public val lastname: String? get() = __lastname.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Person) return false - return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && - (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && - (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === - lastnameDefault || Objects.equals(lastname, other.lastname)) - } + private fun `__$fieldValues`(): List = listOf( + if (__firstname === firstnameDefault) firstnameDefault else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Person && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault - else firstname, - if (__lastname === lastnameDefault) lastnameDefault else lastname) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__lastname === lastnameDefault) null else "lastname=" + lastname, + ) - override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else - "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + - lastname).joinToString(prefix = "Person(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Person(", postfix = + ")") @Generated public companion object { 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 20b4f43c..a5ea5e2a 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.constantsForInputTypes.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val people: List? get() = __people.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === - peopleDefault || Objects.equals(people, other.people)) - } + private fun `__$fieldValues`(): List = listOf( + if (__people === peopleDefault) peopleDefault else people, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else - people) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) - override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else - "people=" + people).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 40e8c6e1..ff06cace 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedInputTypes.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -33,22 +33,23 @@ public class Person( public val lastname: String? get() = __lastname.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Person) return false - return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && - (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && - (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === - lastnameDefault || Objects.equals(lastname, other.lastname)) - } + private fun `__$fieldValues`(): List = listOf( + if (__firstname === firstnameDefault) firstnameDefault else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Person && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault - else firstname, - if (__lastname === lastnameDefault) lastnameDefault else lastname) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__lastname === lastnameDefault) null else "lastname=" + lastname, + ) - override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else - "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + - lastname).joinToString(prefix = "Person(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Person(", postfix = + ")") @Generated public companion object { 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 60bf4396..52726052 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedInputTypes.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val people: List? get() = __people.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === - peopleDefault || Objects.equals(people, other.people)) - } + private fun `__$fieldValues`(): List = listOf( + if (__people === peopleDefault) peopleDefault else people, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else - people) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) - override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else - "people=" + people).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 21fcc525..4a0cf538 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedInterface.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val people: List? get() = __people.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === - peopleDefault || Objects.equals(people, other.people)) - } + private fun `__$fieldValues`(): List = listOf( + if (__people === peopleDefault) peopleDefault else people, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else - people) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) - override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else - "people=" + people).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 f051dad5..c3a94267 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedQuery.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -33,22 +33,23 @@ public class Person( public val lastname: String? get() = __lastname.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Person) return false - return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && - (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && - (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === - lastnameDefault || Objects.equals(lastname, other.lastname)) - } + private fun `__$fieldValues`(): List = listOf( + if (__firstname === firstnameDefault) firstnameDefault else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Person && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault - else firstname, - if (__lastname === lastnameDefault) lastnameDefault else lastname) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__lastname === lastnameDefault) null else "lastname=" + lastname, + ) - override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else - "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + - lastname).joinToString(prefix = "Person(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Person(", postfix = + ")") @Generated public companion object { 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 e8268aa1..9b4c2545 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedQuery.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -34,22 +33,23 @@ public class Query( public val friends: List? get() = __friends.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === - peopleDefault || Objects.equals(people, other.people)) && - (__friends === friendsDefault) == (other.__friends === friendsDefault) && (__friends === - friendsDefault || Objects.equals(friends, other.friends)) - } + private fun `__$fieldValues`(): List = listOf( + if (__people === peopleDefault) peopleDefault else people, + if (__friends === friendsDefault) friendsDefault else friends, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else - people, - if (__friends === friendsDefault) friendsDefault else friends) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + if (__friends === friendsDefault) null else "friends=" + friends, + ) - override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else - "people=" + people, if (__friends === friendsDefault) null else "friends=" + - friends).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 451ec53b..09f907a0 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedTypes.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -40,26 +40,25 @@ public class Person( public val email: String? get() = __email.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Person) return false - return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && - (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && - (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === - lastnameDefault || Objects.equals(lastname, other.lastname)) && - (__email === emailDefault) == (other.__email === emailDefault) && (__email === emailDefault || - Objects.equals(email, other.email)) - } + private fun `__$fieldValues`(): List = listOf( + if (__firstname === firstnameDefault) firstnameDefault else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname, + if (__email === emailDefault) emailDefault else email, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Person && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault - else firstname, - if (__lastname === lastnameDefault) lastnameDefault else lastname, - if (__email === emailDefault) emailDefault else email) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__lastname === lastnameDefault) null else "lastname=" + lastname, + if (__email === emailDefault) null else "email=" + email, + ) - override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else - "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + - lastname, if (__email === emailDefault) null else "email=" + email).joinToString(prefix = - "Person(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Person(", postfix = + ")") @Generated public companion object { 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 f9dee361..7c8b4a93 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.constantsWithExtendedTypes.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val people: List? get() = __people.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === - peopleDefault || Objects.equals(people, other.people)) - } + private fun `__$fieldValues`(): List = listOf( + if (__people === peopleDefault) peopleDefault else people, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else - people) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) - override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else - "people=" + people).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 cd30cde0..fc2074c8 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassDocs.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName /** @@ -30,17 +30,21 @@ public class Movie( public val title: String? get() = __title.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Movie) return false - return (__title === titleDefault) == (other.__title === titleDefault) && (__title === - titleDefault || Objects.equals(title, other.title)) - } + private fun `__$fieldValues`(): List = listOf( + if (__title === titleDefault) titleDefault else title, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Movie && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__title === titleDefault) titleDefault else title) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__title === titleDefault) null else "title=" + title, + ) - override fun toString(): String = listOfNotNull(if (__title === titleDefault) null else "title=" + - title).joinToString(prefix = "Movie(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Movie(", postfix = + ")") @Generated public companion object { 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 82c49b95..8ba720db 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassDocs.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,18 +26,21 @@ public class Query( public val search: Movie? get() = __search.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__search === searchDefault) == (other.__search === searchDefault) && (__search === - searchDefault || Objects.equals(search, other.search)) - } + private fun `__$fieldValues`(): List = listOf( + if (__search === searchDefault) searchDefault else search, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__search === searchDefault) searchDefault else - search) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__search === searchDefault) null else "search=" + search, + ) - override fun toString(): String = listOfNotNull(if (__search === searchDefault) null else - "search=" + search).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 b12da880..e81a957f 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassFieldDocs.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -29,17 +29,21 @@ public class Movie( public val title: String? get() = __title.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Movie) return false - return (__title === titleDefault) == (other.__title === titleDefault) && (__title === - titleDefault || Objects.equals(title, other.title)) - } + private fun `__$fieldValues`(): List = listOf( + if (__title === titleDefault) titleDefault else title, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Movie && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__title === titleDefault) titleDefault else title) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__title === titleDefault) null else "title=" + title, + ) - override fun toString(): String = listOfNotNull(if (__title === titleDefault) null else "title=" + - title).joinToString(prefix = "Movie(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Movie(", postfix = + ")") @Generated public companion object { 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 7bf71703..d22aff0b 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassFieldDocs.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,18 +26,21 @@ public class Query( public val search: Movie? get() = __search.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__search === searchDefault) == (other.__search === searchDefault) && (__search === - searchDefault || Objects.equals(search, other.search)) - } + private fun `__$fieldValues`(): List = listOf( + if (__search === searchDefault) searchDefault else search, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__search === searchDefault) searchDefault else - search) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__search === searchDefault) null else "search=" + search, + ) - override fun toString(): String = listOfNotNull(if (__search === searchDefault) null else - "search=" + search).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 e986ec3d..e711576a 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWIthNoFields.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,17 +26,21 @@ public class Query( public val me: Person? get() = __me.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__me === meDefault) == (other.__me === meDefault) && (__me === meDefault || - Objects.equals(me, other.me)) - } + private fun `__$fieldValues`(): List = listOf( + if (__me === meDefault) meDefault else me, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__me === meDefault) meDefault else me) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__me === meDefault) null else "me=" + me, + ) - override fun toString(): String = listOfNotNull(if (__me === meDefault) null else "me=" + - me).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 4c96c4b6..71a5258c 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithBooleanField.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,17 +26,21 @@ public class Query( public val test: RequiredTestType? get() = __test.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__test === testDefault) == (other.__test === testDefault) && (__test === testDefault || - Objects.equals(test, other.test)) - } + private fun `__$fieldValues`(): List = listOf( + if (__test === testDefault) testDefault else test, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__test === testDefault) testDefault else test) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__test === testDefault) null else "test=" + test, + ) - override fun toString(): String = listOfNotNull(if (__test === testDefault) null else "test=" + - test).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 008d20b2..7d6fabe5 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithBooleanField.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,18 +26,21 @@ public class RequiredTestType( public val isRequired: Boolean get() = __isRequired.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is RequiredTestType) return false - return (__isRequired === isRequiredDefault) == (other.__isRequired === isRequiredDefault) && - (__isRequired === isRequiredDefault || Objects.equals(isRequired, other.isRequired)) - } + private fun `__$fieldValues`(): List = listOf( + if (__isRequired === isRequiredDefault) isRequiredDefault else isRequired, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is RequiredTestType && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__isRequired === isRequiredDefault) - isRequiredDefault else isRequired) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__isRequired === isRequiredDefault) null else "isRequired=" + isRequired, + ) - override fun toString(): String = listOfNotNull(if (__isRequired === isRequiredDefault) null else - "isRequired=" + isRequired).joinToString(prefix = "RequiredTestType(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "RequiredTestType(", + postfix = ")") @Generated public companion object { 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 a8d8424f..22b20e0f 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 @@ -8,12 +8,12 @@ import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expected.Generated import java.lang.IllegalStateException import java.time.OffsetDateTime -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.Long import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -35,21 +35,23 @@ public class Entity( public val dateTime: OffsetDateTime? get() = __dateTime.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Entity) return false - return (__long === longDefault) == (other.__long === longDefault) && (__long === longDefault || - Objects.equals(long, other.long)) && - (__dateTime === dateTimeDefault) == (other.__dateTime === dateTimeDefault) && (__dateTime === - dateTimeDefault || Objects.equals(dateTime, other.dateTime)) - } + private fun `__$fieldValues`(): List = listOf( + if (__long === longDefault) longDefault else long, + if (__dateTime === dateTimeDefault) dateTimeDefault else dateTime, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Entity && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__long === longDefault) longDefault else long, - if (__dateTime === dateTimeDefault) dateTimeDefault else dateTime) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__long === longDefault) null else "long=" + long, + if (__dateTime === dateTimeDefault) null else "dateTime=" + dateTime, + ) - override fun toString(): String = listOfNotNull(if (__long === longDefault) null else "long=" + - long, if (__dateTime === dateTimeDefault) null else "dateTime=" + - dateTime).joinToString(prefix = "Entity(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Entity(", postfix = + ")") @Generated public companion object { 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 5591d992..60741bc5 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -34,22 +33,23 @@ public class EntityConnection( public val edges: List? get() = __edges.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is EntityConnection) return false - return (__pageInfo === pageInfoDefault) == (other.__pageInfo === pageInfoDefault) && (__pageInfo - === pageInfoDefault || Objects.equals(pageInfo, other.pageInfo)) && - (__edges === edgesDefault) == (other.__edges === edgesDefault) && (__edges === edgesDefault || - Objects.equals(edges, other.edges)) - } + private fun `__$fieldValues`(): List = listOf( + if (__pageInfo === pageInfoDefault) pageInfoDefault else pageInfo, + if (__edges === edgesDefault) edgesDefault else edges, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is EntityConnection && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__pageInfo === pageInfoDefault) pageInfoDefault - else pageInfo, - if (__edges === edgesDefault) edgesDefault else edges) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__pageInfo === pageInfoDefault) null else "pageInfo=" + pageInfo, + if (__edges === edgesDefault) null else "edges=" + edges, + ) - override fun toString(): String = listOfNotNull(if (__pageInfo === pageInfoDefault) null else - "pageInfo=" + pageInfo, if (__edges === edgesDefault) null else "edges=" + - edges).joinToString(prefix = "EntityConnection(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "EntityConnection(", + postfix = ")") @Generated public companion object { 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 e6c6f44d..7ad032c6 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -33,22 +33,23 @@ public class EntityEdge( public val node: Entity? get() = __node.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is EntityEdge) return false - return (__cursor === cursorDefault) == (other.__cursor === cursorDefault) && (__cursor === - cursorDefault || Objects.equals(cursor, other.cursor)) && - (__node === nodeDefault) == (other.__node === nodeDefault) && (__node === nodeDefault || - Objects.equals(node, other.node)) - } + private fun `__$fieldValues`(): List = listOf( + if (__cursor === cursorDefault) cursorDefault else cursor, + if (__node === nodeDefault) nodeDefault else node, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is EntityEdge && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__cursor === cursorDefault) cursorDefault else - cursor, - if (__node === nodeDefault) nodeDefault else node) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__cursor === cursorDefault) null else "cursor=" + cursor, + if (__node === nodeDefault) null else "node=" + node, + ) - override fun toString(): String = listOfNotNull(if (__cursor === cursorDefault) null else - "cursor=" + cursor, if (__node === nodeDefault) null else "node=" + node).joinToString(prefix - = "EntityEdge(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "EntityEdge(", postfix + = ")") @Generated public companion object { 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 252acd30..08a1f27c 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -47,31 +47,28 @@ public class PageInfo( public val hasPreviousPage: Boolean get() = __hasPreviousPage.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is PageInfo) return false - return (__startCursor === startCursorDefault) == (other.__startCursor === startCursorDefault) && - (__startCursor === startCursorDefault || Objects.equals(startCursor, other.startCursor)) && - (__endCursor === endCursorDefault) == (other.__endCursor === endCursorDefault) && (__endCursor - === endCursorDefault || Objects.equals(endCursor, other.endCursor)) && - (__hasNextPage === hasNextPageDefault) == (other.__hasNextPage === hasNextPageDefault) && - (__hasNextPage === hasNextPageDefault || Objects.equals(hasNextPage, other.hasNextPage)) && - (__hasPreviousPage === hasPreviousPageDefault) == (other.__hasPreviousPage === - hasPreviousPageDefault) && (__hasPreviousPage === hasPreviousPageDefault || - Objects.equals(hasPreviousPage, other.hasPreviousPage)) - } + private fun `__$fieldValues`(): List = listOf( + if (__startCursor === startCursorDefault) startCursorDefault else startCursor, + if (__endCursor === endCursorDefault) endCursorDefault else endCursor, + if (__hasNextPage === hasNextPageDefault) hasNextPageDefault else hasNextPage, + if (__hasPreviousPage === hasPreviousPageDefault) hasPreviousPageDefault else hasPreviousPage, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is PageInfo && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__startCursor === startCursorDefault) null else "startCursor=" + startCursor, + if (__endCursor === endCursorDefault) null else "endCursor=" + endCursor, + if (__hasNextPage === hasNextPageDefault) null else "hasNextPage=" + hasNextPage, + if (__hasPreviousPage === hasPreviousPageDefault) null else "hasPreviousPage=" + + hasPreviousPage, + ) - override fun hashCode(): Int = Objects.hash(if (__startCursor === startCursorDefault) - startCursorDefault else startCursor, - if (__endCursor === endCursorDefault) endCursorDefault else endCursor, - if (__hasNextPage === hasNextPageDefault) hasNextPageDefault else hasNextPage, - if (__hasPreviousPage === hasPreviousPageDefault) hasPreviousPageDefault else hasPreviousPage) - - override fun toString(): String = listOfNotNull(if (__startCursor === startCursorDefault) null - else "startCursor=" + startCursor, if (__endCursor === endCursorDefault) null else - "endCursor=" + endCursor, if (__hasNextPage === hasNextPageDefault) null else "hasNextPage=" + - hasNextPage, if (__hasPreviousPage === hasPreviousPageDefault) null else "hasPreviousPage=" + - hasPreviousPage).joinToString(prefix = "PageInfo(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "PageInfo(", postfix = + ")") @Generated public companion object { 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 1a6bebf7..3ec4eac8 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithDeclaredScalars.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -34,23 +33,25 @@ public class Query( public val entityConnection: EntityConnection? get() = __entityConnection.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__entity === entityDefault) == (other.__entity === entityDefault) && (__entity === - entityDefault || Objects.equals(entity, other.entity)) && - (__entityConnection === entityConnectionDefault) == (other.__entityConnection === - entityConnectionDefault) && (__entityConnection === entityConnectionDefault || - Objects.equals(entityConnection, other.entityConnection)) - } + private fun `__$fieldValues`(): List = listOf( + if (__entity === entityDefault) entityDefault else entity, + if (__entityConnection === entityConnectionDefault) entityConnectionDefault else + entityConnection, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__entity === entityDefault) entityDefault else - entity, - if (__entityConnection === entityConnectionDefault) entityConnectionDefault else entityConnection) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__entity === entityDefault) null else "entity=" + entity, + if (__entityConnection === entityConnectionDefault) null else "entityConnection=" + + entityConnection, + ) - override fun toString(): String = listOfNotNull(if (__entity === entityDefault) null else - "entity=" + entity, if (__entityConnection === entityConnectionDefault) null else - "entityConnection=" + entityConnection).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 849e9775..966af459 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithDeeplyNestedComplexField.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -40,24 +40,24 @@ public class Car( public val engine: Engine? get() = __engine.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Car) return false - return (__make === makeDefault) == (other.__make === makeDefault) && (__make === makeDefault || - Objects.equals(make, other.make)) && - (__model === modelDefault) == (other.__model === modelDefault) && (__model === modelDefault || - Objects.equals(model, other.model)) && - (__engine === engineDefault) == (other.__engine === engineDefault) && (__engine === - engineDefault || Objects.equals(engine, other.engine)) - } + private fun `__$fieldValues`(): List = listOf( + if (__make === makeDefault) makeDefault else make, + if (__model === modelDefault) modelDefault else model, + if (__engine === engineDefault) engineDefault else engine, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Car && `__$fieldValues`() + == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__make === makeDefault) makeDefault else make, - if (__model === modelDefault) modelDefault else model, - if (__engine === engineDefault) engineDefault else engine) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__make === makeDefault) null else "make=" + make, + if (__model === modelDefault) null else "model=" + model, + if (__engine === engineDefault) null else "engine=" + engine, + ) - override fun toString(): String = listOfNotNull(if (__make === makeDefault) null else "make=" + - make, if (__model === modelDefault) null else "model=" + model, if (__engine === - engineDefault) null else "engine=" + engine).joinToString(prefix = "Car(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Car(", postfix = ")") @Generated public companion object { 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 1177db39..09a097e1 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 @@ -7,12 +7,12 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithDeeplyNestedComplexField.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Double import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -48,28 +48,27 @@ public class Engine( public val performance: Performance? get() = __performance.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Engine) return false - return (__type === typeDefault) == (other.__type === typeDefault) && (__type === typeDefault || - Objects.equals(type, other.type)) && - (__bhp === bhpDefault) == (other.__bhp === bhpDefault) && (__bhp === bhpDefault || - Objects.equals(bhp, other.bhp)) && - (__size === sizeDefault) == (other.__size === sizeDefault) && (__size === sizeDefault || - Objects.equals(size, other.size)) && - (__performance === performanceDefault) == (other.__performance === performanceDefault) && - (__performance === performanceDefault || Objects.equals(performance, other.performance)) - } + private fun `__$fieldValues`(): List = listOf( + if (__type === typeDefault) typeDefault else type, + if (__bhp === bhpDefault) bhpDefault else bhp, + if (__size === sizeDefault) sizeDefault else size, + if (__performance === performanceDefault) performanceDefault else performance, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Engine && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__type === typeDefault) typeDefault else type, - if (__bhp === bhpDefault) bhpDefault else bhp, - if (__size === sizeDefault) sizeDefault else size, - if (__performance === performanceDefault) performanceDefault else performance) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__type === typeDefault) null else "type=" + type, + if (__bhp === bhpDefault) null else "bhp=" + bhp, + if (__size === sizeDefault) null else "size=" + size, + if (__performance === performanceDefault) null else "performance=" + performance, + ) - override fun toString(): String = listOfNotNull(if (__type === typeDefault) null else "type=" + - type, if (__bhp === bhpDefault) null else "bhp=" + bhp, if (__size === sizeDefault) null else - "size=" + size, if (__performance === performanceDefault) null else "performance=" + - performance).joinToString(prefix = "Engine(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Engine(", postfix = + ")") @Generated public companion object { 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 3a865ba6..7526fb87 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 @@ -7,12 +7,12 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithDeeplyNestedComplexField.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Double import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -34,22 +34,23 @@ public class Performance( public val quarterMile: Double? get() = __quarterMile.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Performance) return false - return (__zeroToSixty === zeroToSixtyDefault) == (other.__zeroToSixty === zeroToSixtyDefault) && - (__zeroToSixty === zeroToSixtyDefault || Objects.equals(zeroToSixty, other.zeroToSixty)) && - (__quarterMile === quarterMileDefault) == (other.__quarterMile === quarterMileDefault) && - (__quarterMile === quarterMileDefault || Objects.equals(quarterMile, other.quarterMile)) - } + private fun `__$fieldValues`(): List = listOf( + if (__zeroToSixty === zeroToSixtyDefault) zeroToSixtyDefault else zeroToSixty, + if (__quarterMile === quarterMileDefault) quarterMileDefault else quarterMile, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Performance && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__zeroToSixty === zeroToSixtyDefault) - zeroToSixtyDefault else zeroToSixty, - if (__quarterMile === quarterMileDefault) quarterMileDefault else quarterMile) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__zeroToSixty === zeroToSixtyDefault) null else "zeroToSixty=" + zeroToSixty, + if (__quarterMile === quarterMileDefault) null else "quarterMile=" + quarterMile, + ) - override fun toString(): String = listOfNotNull(if (__zeroToSixty === zeroToSixtyDefault) null - else "zeroToSixty=" + zeroToSixty, if (__quarterMile === quarterMileDefault) null else - "quarterMile=" + quarterMile).joinToString(prefix = "Performance(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Performance(", + postfix = ")") @Generated public companion object { 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 90feba7e..8077936d 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithDeeplyNestedComplexField.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,17 +26,21 @@ public class Query( public val cars: List? get() = __cars.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__cars === carsDefault) == (other.__cars === carsDefault) && (__cars === carsDefault || - Objects.equals(cars, other.cars)) - } + private fun `__$fieldValues`(): List = listOf( + if (__cars === carsDefault) carsDefault else cars, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__cars === carsDefault) carsDefault else cars) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__cars === carsDefault) null else "cars=" + cars, + ) - override fun toString(): String = listOfNotNull(if (__cars === carsDefault) null else "cars=" + - cars).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 ccedc656..87ce38e2 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithExtendedInterface.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val people: List? get() = __people.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === - peopleDefault || Objects.equals(people, other.people)) - } + private fun `__$fieldValues`(): List = listOf( + if (__people === peopleDefault) peopleDefault else people, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else - people) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) - override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else - "people=" + people).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Employee.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Employee.kt index b98c78c6..5c7f06e5 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Employee.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Employee.kt @@ -7,12 +7,12 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithExtendedInterfaceInheritance.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -51,29 +51,27 @@ public class Employee( override val age: Int get() = __age.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Employee) return false - return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && - (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && - (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === - lastnameDefault || Objects.equals(lastname, other.lastname)) && - (__company === companyDefault) == (other.__company === companyDefault) && (__company === - companyDefault || Objects.equals(company, other.company)) && - (__age === ageDefault) == (other.__age === ageDefault) && (__age === ageDefault || - Objects.equals(age, other.age)) - } + private fun `__$fieldValues`(): List = listOf( + if (__firstname === firstnameDefault) firstnameDefault else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname, + if (__company === companyDefault) companyDefault else company, + if (__age === ageDefault) ageDefault else age, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Employee && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault - else firstname, - if (__lastname === lastnameDefault) lastnameDefault else lastname, - if (__company === companyDefault) companyDefault else company, - if (__age === ageDefault) ageDefault else age) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__lastname === lastnameDefault) null else "lastname=" + lastname, + if (__company === companyDefault) null else "company=" + company, + if (__age === ageDefault) null else "age=" + age, + ) - override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else - "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + - lastname, if (__company === companyDefault) null else "company=" + company, if (__age === - ageDefault) null else "age=" + age).joinToString(prefix = "Employee(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Employee(", postfix = + ")") @Generated public companion object { diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Query.kt index 15fac46d..127e7f67 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithExtendedInterfaceInheritance/expected/types/Query.kt @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithExtendedInterfaceInheritance.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val people: List? get() = __people.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === - peopleDefault || Objects.equals(people, other.people)) - } + private fun `__$fieldValues`(): List = listOf( + if (__people === peopleDefault) peopleDefault else people, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else - people) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) - override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else - "people=" + people).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 c30034e8..64eaa1b5 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 @@ -7,12 +7,12 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithInterface.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -43,26 +43,25 @@ public class Employee( public val company: String? get() = __company.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Employee) return false - return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && - (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && - (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === - lastnameDefault || Objects.equals(lastname, other.lastname)) && - (__company === companyDefault) == (other.__company === companyDefault) && (__company === - companyDefault || Objects.equals(company, other.company)) - } + private fun `__$fieldValues`(): List = listOf( + if (__firstname === firstnameDefault) firstnameDefault else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname, + if (__company === companyDefault) companyDefault else company, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Employee && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault - else firstname, - if (__lastname === lastnameDefault) lastnameDefault else lastname, - if (__company === companyDefault) companyDefault else company) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__lastname === lastnameDefault) null else "lastname=" + lastname, + if (__company === companyDefault) null else "company=" + company, + ) - override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else - "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + - lastname, if (__company === companyDefault) null else "company=" + - company).joinToString(prefix = "Employee(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Employee(", postfix = + ")") @Generated public companion object { 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 528c896e..b1f0e47b 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithInterface.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val people: List? get() = __people.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === - peopleDefault || Objects.equals(people, other.people)) - } + private fun `__$fieldValues`(): List = listOf( + if (__people === peopleDefault) peopleDefault else people, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else - people) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) - override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else - "people=" + people).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 6a715a15..815b29b6 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithInterfaceInheritance.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val people: List? get() = __people.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === - peopleDefault || Objects.equals(people, other.people)) - } + private fun `__$fieldValues`(): List = listOf( + if (__people === peopleDefault) peopleDefault else people, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else - people) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) - override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else - "people=" + people).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 3672486e..0a13f043 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 @@ -7,12 +7,12 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithInterfaceInheritance.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -51,30 +51,27 @@ public class Talent( public val imdbProfile: String? get() = __imdbProfile.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Talent) return false - return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && - (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && - (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === - lastnameDefault || Objects.equals(lastname, other.lastname)) && - (__company === companyDefault) == (other.__company === companyDefault) && (__company === - companyDefault || Objects.equals(company, other.company)) && - (__imdbProfile === imdbProfileDefault) == (other.__imdbProfile === imdbProfileDefault) && - (__imdbProfile === imdbProfileDefault || Objects.equals(imdbProfile, other.imdbProfile)) - } + private fun `__$fieldValues`(): List = listOf( + if (__firstname === firstnameDefault) firstnameDefault else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname, + if (__company === companyDefault) companyDefault else company, + if (__imdbProfile === imdbProfileDefault) imdbProfileDefault else imdbProfile, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Talent && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__lastname === lastnameDefault) null else "lastname=" + lastname, + if (__company === companyDefault) null else "company=" + company, + if (__imdbProfile === imdbProfileDefault) null else "imdbProfile=" + imdbProfile, + ) - override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault - else firstname, - if (__lastname === lastnameDefault) lastnameDefault else lastname, - if (__company === companyDefault) companyDefault else company, - if (__imdbProfile === imdbProfileDefault) imdbProfileDefault else imdbProfile) - - override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else - "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + - lastname, if (__company === companyDefault) null else "company=" + company, if (__imdbProfile - === imdbProfileDefault) null else "imdbProfile=" + imdbProfile).joinToString(prefix = - "Talent(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Talent(", postfix = + ")") @Generated public companion object { 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 da05b343..4d4dc97d 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithListProperties.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -34,21 +33,23 @@ public class Person( public val email: List? get() = __email.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Person) return false - return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || - Objects.equals(name, other.name)) && - (__email === emailDefault) == (other.__email === emailDefault) && (__email === emailDefault || - Objects.equals(email, other.email)) - } + private fun `__$fieldValues`(): List = listOf( + if (__name === nameDefault) nameDefault else name, + if (__email === emailDefault) emailDefault else email, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Person && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name, - if (__email === emailDefault) emailDefault else email) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + if (__email === emailDefault) null else "email=" + email, + ) - override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + - name, if (__email === emailDefault) null else "email=" + email).joinToString(prefix = - "Person(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Person(", postfix = + ")") @Generated public companion object { 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 607515b5..5f28b358 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithListProperties.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val people: List? get() = __people.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === - peopleDefault || Objects.equals(people, other.people)) - } + private fun `__$fieldValues`(): List = listOf( + if (__people === peopleDefault) peopleDefault else people, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else - people) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) - override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else - "people=" + people).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 1630e73a..d0340369 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 @@ -8,12 +8,12 @@ import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedInterfaces.expected.Generated import com.netflix.graphql.dgs.codegen.fixtures.Node import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -30,17 +30,21 @@ public class Product( override val id: String get() = __id.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Product) return false - return (__id === idDefault) == (other.__id === idDefault) && (__id === idDefault || - Objects.equals(id, other.id)) - } + private fun `__$fieldValues`(): List = listOf( + if (__id === idDefault) idDefault else id, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Product && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__id === idDefault) idDefault else id) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__id === idDefault) null else "id=" + id, + ) - override fun toString(): String = listOfNotNull(if (__id === idDefault) null else "id=" + - id).joinToString(prefix = "Product(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Product(", postfix = + ")") @Generated public companion object { 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 8a967ae1..3c77ea41 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedInterfaces.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val products: List? get() = __products.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__products === productsDefault) == (other.__products === productsDefault) && (__products - === productsDefault || Objects.equals(products, other.products)) - } + private fun `__$fieldValues`(): List = listOf( + if (__products === productsDefault) productsDefault else products, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__products === productsDefault) productsDefault - else products) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__products === productsDefault) null else "products=" + products, + ) - override fun toString(): String = listOfNotNull(if (__products === productsDefault) null else - "products=" + products).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 989af327..45611eaf 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 @@ -8,12 +8,12 @@ import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedTypes.expected.Generated import java.lang.IllegalStateException import java.time.OffsetDateTime -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.Long import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -35,21 +35,23 @@ public class Entity( public val dateTime: OffsetDateTime? get() = __dateTime.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Entity) return false - return (__long === longDefault) == (other.__long === longDefault) && (__long === longDefault || - Objects.equals(long, other.long)) && - (__dateTime === dateTimeDefault) == (other.__dateTime === dateTimeDefault) && (__dateTime === - dateTimeDefault || Objects.equals(dateTime, other.dateTime)) - } + private fun `__$fieldValues`(): List = listOf( + if (__long === longDefault) longDefault else long, + if (__dateTime === dateTimeDefault) dateTimeDefault else dateTime, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Entity && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__long === longDefault) longDefault else long, - if (__dateTime === dateTimeDefault) dateTimeDefault else dateTime) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__long === longDefault) null else "long=" + long, + if (__dateTime === dateTimeDefault) null else "dateTime=" + dateTime, + ) - override fun toString(): String = listOfNotNull(if (__long === longDefault) null else "long=" + - long, if (__dateTime === dateTimeDefault) null else "dateTime=" + - dateTime).joinToString(prefix = "Entity(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Entity(", postfix = + ")") @Generated public companion object { 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 77a9a946..193f3f1d 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedTypes.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -33,22 +33,23 @@ public class EntityEdge( public val node: Entity? get() = __node.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is EntityEdge) return false - return (__cursor === cursorDefault) == (other.__cursor === cursorDefault) && (__cursor === - cursorDefault || Objects.equals(cursor, other.cursor)) && - (__node === nodeDefault) == (other.__node === nodeDefault) && (__node === nodeDefault || - Objects.equals(node, other.node)) - } + private fun `__$fieldValues`(): List = listOf( + if (__cursor === cursorDefault) cursorDefault else cursor, + if (__node === nodeDefault) nodeDefault else node, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is EntityEdge && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__cursor === cursorDefault) cursorDefault else - cursor, - if (__node === nodeDefault) nodeDefault else node) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__cursor === cursorDefault) null else "cursor=" + cursor, + if (__node === nodeDefault) null else "node=" + node, + ) - override fun toString(): String = listOfNotNull(if (__cursor === cursorDefault) null else - "cursor=" + cursor, if (__node === nodeDefault) null else "node=" + node).joinToString(prefix - = "EntityEdge(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "EntityEdge(", postfix + = ")") @Generated public companion object { 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 b6428e93..63e62843 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 @@ -8,7 +8,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithMappedTypes.expected.Generated import graphql.relay.SimpleListConnection import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -35,23 +34,25 @@ public class Query( public val entityConnection: SimpleListConnection? get() = __entityConnection.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__entity === entityDefault) == (other.__entity === entityDefault) && (__entity === - entityDefault || Objects.equals(entity, other.entity)) && - (__entityConnection === entityConnectionDefault) == (other.__entityConnection === - entityConnectionDefault) && (__entityConnection === entityConnectionDefault || - Objects.equals(entityConnection, other.entityConnection)) - } + private fun `__$fieldValues`(): List = listOf( + if (__entity === entityDefault) entityDefault else entity, + if (__entityConnection === entityConnectionDefault) entityConnectionDefault else + entityConnection, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__entity === entityDefault) entityDefault else - entity, - if (__entityConnection === entityConnectionDefault) entityConnectionDefault else entityConnection) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__entity === entityDefault) null else "entity=" + entity, + if (__entityConnection === entityConnectionDefault) null else "entityConnection=" + + entityConnection, + ) - override fun toString(): String = listOfNotNull(if (__entity === entityDefault) null else - "entity=" + entity, if (__entityConnection === entityConnectionDefault) null else - "entityConnection=" + entityConnection).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 327803a8..983dafa1 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 @@ -7,12 +7,12 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableAndInterface.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -44,26 +44,25 @@ public class Employee( override val company: String? get() = __company.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Employee) return false - return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && - (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && - (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === - lastnameDefault || Objects.equals(lastname, other.lastname)) && - (__company === companyDefault) == (other.__company === companyDefault) && (__company === - companyDefault || Objects.equals(company, other.company)) - } + private fun `__$fieldValues`(): List = listOf( + if (__firstname === firstnameDefault) firstnameDefault else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname, + if (__company === companyDefault) companyDefault else company, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Employee && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault - else firstname, - if (__lastname === lastnameDefault) lastnameDefault else lastname, - if (__company === companyDefault) companyDefault else company) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__lastname === lastnameDefault) null else "lastname=" + lastname, + if (__company === companyDefault) null else "company=" + company, + ) - override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else - "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + - lastname, if (__company === companyDefault) null else "company=" + - company).joinToString(prefix = "Employee(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Employee(", postfix = + ")") @Generated public companion object { 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 f48492e6..751156a5 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableAndInterface.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val people: List? get() = __people.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === - peopleDefault || Objects.equals(people, other.people)) - } + private fun `__$fieldValues`(): List = listOf( + if (__people === peopleDefault) peopleDefault else people, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else - people) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) - override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else - "people=" + people).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 2b470eda..a75e9dbd 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableComplexType.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,17 +26,21 @@ public class MyType( public val other: OtherType get() = __other.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is MyType) return false - return (__other === otherDefault) == (other.__other === otherDefault) && (__other === - otherDefault || Objects.equals(other, other.other)) - } + private fun `__$fieldValues`(): List = listOf( + if (__other === otherDefault) otherDefault else other, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is MyType && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__other === otherDefault) otherDefault else other) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__other === otherDefault) null else "other=" + other, + ) - override fun toString(): String = listOfNotNull(if (__other === otherDefault) null else "other=" + - other).joinToString(prefix = "MyType(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "MyType(", postfix = + ")") @Generated public companion object { 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 7a727467..5286d9fd 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableComplexType.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,17 +26,21 @@ public class OtherType( public val name: String get() = __name.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is OtherType) return false - return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || - Objects.equals(name, other.name)) - } + private fun `__$fieldValues`(): List = listOf( + if (__name === nameDefault) nameDefault else name, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is OtherType && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + ) - override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + - name).joinToString(prefix = "OtherType(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "OtherType(", postfix + = ")") @Generated public companion object { 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 5fd5d1ca..b017ba28 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableListOfNullableValues.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -34,21 +33,23 @@ public class Person( public val email: List get() = __email.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Person) return false - return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || - Objects.equals(name, other.name)) && - (__email === emailDefault) == (other.__email === emailDefault) && (__email === emailDefault || - Objects.equals(email, other.email)) - } + private fun `__$fieldValues`(): List = listOf( + if (__name === nameDefault) nameDefault else name, + if (__email === emailDefault) emailDefault else email, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Person && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name, - if (__email === emailDefault) emailDefault else email) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + if (__email === emailDefault) null else "email=" + email, + ) - override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + - name, if (__email === emailDefault) null else "email=" + email).joinToString(prefix = - "Person(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Person(", postfix = + ")") @Generated public companion object { 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 3947fd55..734138eb 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableListOfNullableValues.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val people: List? get() = __people.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === - peopleDefault || Objects.equals(people, other.people)) - } + private fun `__$fieldValues`(): List = listOf( + if (__people === peopleDefault) peopleDefault else people, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else - people) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) - override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else - "people=" + people).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 db589320..1c989ea0 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 @@ -7,12 +7,12 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullablePrimitive.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Double import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -41,24 +41,25 @@ public class MyType( public val floaty: Double get() = __floaty.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is MyType) return false - return (__count === countDefault) == (other.__count === countDefault) && (__count === - countDefault || Objects.equals(count, other.count)) && - (__truth === truthDefault) == (other.__truth === truthDefault) && (__truth === truthDefault || - Objects.equals(truth, other.truth)) && - (__floaty === floatyDefault) == (other.__floaty === floatyDefault) && (__floaty === - floatyDefault || Objects.equals(floaty, other.floaty)) - } + private fun `__$fieldValues`(): List = listOf( + if (__count === countDefault) countDefault else count, + if (__truth === truthDefault) truthDefault else truth, + if (__floaty === floatyDefault) floatyDefault else floaty, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is MyType && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__count === countDefault) countDefault else count, - if (__truth === truthDefault) truthDefault else truth, - if (__floaty === floatyDefault) floatyDefault else floaty) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__count === countDefault) null else "count=" + count, + if (__truth === truthDefault) null else "truth=" + truth, + if (__floaty === floatyDefault) null else "floaty=" + floaty, + ) - override fun toString(): String = listOfNotNull(if (__count === countDefault) null else "count=" + - count, if (__truth === truthDefault) null else "truth=" + truth, if (__floaty === - floatyDefault) null else "floaty=" + floaty).joinToString(prefix = "MyType(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "MyType(", postfix = + ")") @Generated public companion object { 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 bb42b12e..8dd8fb5a 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullablePrimitiveInList.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Double @@ -42,24 +41,25 @@ public class MyType( public val floaty: List? get() = __floaty.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is MyType) return false - return (__count === countDefault) == (other.__count === countDefault) && (__count === - countDefault || Objects.equals(count, other.count)) && - (__truth === truthDefault) == (other.__truth === truthDefault) && (__truth === truthDefault || - Objects.equals(truth, other.truth)) && - (__floaty === floatyDefault) == (other.__floaty === floatyDefault) && (__floaty === - floatyDefault || Objects.equals(floaty, other.floaty)) - } + private fun `__$fieldValues`(): List = listOf( + if (__count === countDefault) countDefault else count, + if (__truth === truthDefault) truthDefault else truth, + if (__floaty === floatyDefault) floatyDefault else floaty, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is MyType && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__count === countDefault) countDefault else count, - if (__truth === truthDefault) truthDefault else truth, - if (__floaty === floatyDefault) floatyDefault else floaty) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__count === countDefault) null else "count=" + count, + if (__truth === truthDefault) null else "truth=" + truth, + if (__floaty === floatyDefault) null else "floaty=" + floaty, + ) - override fun toString(): String = listOfNotNull(if (__count === countDefault) null else "count=" + - count, if (__truth === truthDefault) null else "truth=" + truth, if (__floaty === - floatyDefault) null else "floaty=" + floaty).joinToString(prefix = "MyType(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "MyType(", postfix = + ")") @Generated public companion object { 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 194f1b86..34aa3447 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableProperties.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -34,21 +33,23 @@ public class Person( public val email: List get() = __email.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Person) return false - return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || - Objects.equals(name, other.name)) && - (__email === emailDefault) == (other.__email === emailDefault) && (__email === emailDefault || - Objects.equals(email, other.email)) - } + private fun `__$fieldValues`(): List = listOf( + if (__name === nameDefault) nameDefault else name, + if (__email === emailDefault) emailDefault else email, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Person && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name, - if (__email === emailDefault) emailDefault else email) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + if (__email === emailDefault) null else "email=" + email, + ) - override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + - name, if (__email === emailDefault) null else "email=" + email).joinToString(prefix = - "Person(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Person(", postfix = + ")") @Generated public companion object { 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 ce81e90d..9ec99527 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNonNullableProperties.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val people: List? get() = __people.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === - peopleDefault || Objects.equals(people, other.people)) - } + private fun `__$fieldValues`(): List = listOf( + if (__people === peopleDefault) peopleDefault else people, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else - people) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) - override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else - "people=" + people).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 b68de60e..b52daef7 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 @@ -7,12 +7,12 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithNullablePrimitive.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Double import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -41,24 +41,25 @@ public class MyType( public val floaty: Double? get() = __floaty.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is MyType) return false - return (__count === countDefault) == (other.__count === countDefault) && (__count === - countDefault || Objects.equals(count, other.count)) && - (__truth === truthDefault) == (other.__truth === truthDefault) && (__truth === truthDefault || - Objects.equals(truth, other.truth)) && - (__floaty === floatyDefault) == (other.__floaty === floatyDefault) && (__floaty === - floatyDefault || Objects.equals(floaty, other.floaty)) - } + private fun `__$fieldValues`(): List = listOf( + if (__count === countDefault) countDefault else count, + if (__truth === truthDefault) truthDefault else truth, + if (__floaty === floatyDefault) floatyDefault else floaty, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is MyType && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__count === countDefault) countDefault else count, - if (__truth === truthDefault) truthDefault else truth, - if (__floaty === floatyDefault) floatyDefault else floaty) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__count === countDefault) null else "count=" + count, + if (__truth === truthDefault) null else "truth=" + truth, + if (__floaty === floatyDefault) null else "floaty=" + floaty, + ) - override fun toString(): String = listOfNotNull(if (__count === countDefault) null else "count=" + - count, if (__truth === truthDefault) null else "truth=" + truth, if (__floaty === - floatyDefault) null else "floaty=" + floaty).joinToString(prefix = "MyType(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "MyType(", postfix = + ")") @Generated public companion object { 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 cee267ff..10b65e3f 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithRecursiveField.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -41,26 +40,25 @@ public class Person( public val friends: List? get() = __friends.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Person) return false - return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && - (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && - (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === - lastnameDefault || Objects.equals(lastname, other.lastname)) && - (__friends === friendsDefault) == (other.__friends === friendsDefault) && (__friends === - friendsDefault || Objects.equals(friends, other.friends)) - } + private fun `__$fieldValues`(): List = listOf( + if (__firstname === firstnameDefault) firstnameDefault else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname, + if (__friends === friendsDefault) friendsDefault else friends, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Person && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault - else firstname, - if (__lastname === lastnameDefault) lastnameDefault else lastname, - if (__friends === friendsDefault) friendsDefault else friends) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__lastname === lastnameDefault) null else "lastname=" + lastname, + if (__friends === friendsDefault) null else "friends=" + friends, + ) - override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else - "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + - lastname, if (__friends === friendsDefault) null else "friends=" + - friends).joinToString(prefix = "Person(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Person(", postfix = + ")") @Generated public companion object { 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 bc61791b..89a820dc 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithRecursiveField.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val people: List? get() = __people.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === - peopleDefault || Objects.equals(people, other.people)) - } + private fun `__$fieldValues`(): List = listOf( + if (__people === peopleDefault) peopleDefault else people, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else - people) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) - override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else - "people=" + people).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Person.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Person.kt index ab0b9c3c..4f01b0da 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Person.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Person.kt @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithReservedWord.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -33,21 +33,23 @@ public class Person( public val `interface`: String? get() = __interface.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Person) return false - return (__info === infoDefault) == (other.__info === infoDefault) && (__info === infoDefault || - Objects.equals(info, other.info)) && - (__interface === interfaceDefault) == (other.__interface === interfaceDefault) && (__interface - === interfaceDefault || Objects.equals(`interface`, other.`interface`)) - } + private fun `__$fieldValues`(): List = listOf( + if (__info === infoDefault) infoDefault else info, + if (__interface === interfaceDefault) interfaceDefault else `interface`, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Person && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__info === infoDefault) infoDefault else info, - if (__interface === interfaceDefault) interfaceDefault else `interface`) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__info === infoDefault) null else "info=" + info, + if (__interface === interfaceDefault) null else "interface=" + `interface`, + ) - override fun toString(): String = listOfNotNull(if (__info === infoDefault) null else "info=" + - info, if (__interface === interfaceDefault) null else "interface=" + - `interface`).joinToString(prefix = "Person(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Person(", postfix = + ")") @Generated public companion object { diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Query.kt index fcec2611..9a76114f 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/dataClassWithReservedWord/expected/types/Query.kt @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithReservedWord.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val people: List? get() = __people.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === - peopleDefault || Objects.equals(people, other.people)) - } + private fun `__$fieldValues`(): List = listOf( + if (__people === peopleDefault) peopleDefault else people, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else - people) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) - override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else - "people=" + people).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 ef035e3a..35f6e591 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithReservedWord.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,18 +26,21 @@ public class SampleType( public val `return`: String get() = __return.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is SampleType) return false - return (__return === returnDefault) == (other.__return === returnDefault) && (__return === - returnDefault || Objects.equals(`return`, other.`return`)) - } + private fun `__$fieldValues`(): List = listOf( + if (__return === returnDefault) returnDefault else `return`, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is SampleType && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__return === returnDefault) returnDefault else - `return`) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__return === returnDefault) null else "return=" + `return`, + ) - override fun toString(): String = listOfNotNull(if (__return === returnDefault) null else - "return=" + `return`).joinToString(prefix = "SampleType(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "SampleType(", postfix + = ")") @Generated public companion object { 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 ad946882..e5b4521a 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithStringProperties.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -33,22 +33,23 @@ public class Person( public val lastname: String? get() = __lastname.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Person) return false - return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && - (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && - (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === - lastnameDefault || Objects.equals(lastname, other.lastname)) - } + private fun `__$fieldValues`(): List = listOf( + if (__firstname === firstnameDefault) firstnameDefault else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Person && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault - else firstname, - if (__lastname === lastnameDefault) lastnameDefault else lastname) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__lastname === lastnameDefault) null else "lastname=" + lastname, + ) - override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else - "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + - lastname).joinToString(prefix = "Person(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Person(", postfix = + ")") @Generated public companion object { 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 7e7bf661..58594504 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.dataClassWithStringProperties.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val people: List? get() = __people.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === - peopleDefault || Objects.equals(people, other.people)) - } + private fun `__$fieldValues`(): List = listOf( + if (__people === peopleDefault) peopleDefault else people, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else - people) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) - override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else - "people=" + people).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 7f9699e4..b6b8507c 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.`enum`.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,17 +26,21 @@ public class Query( public val types: List? get() = __types.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__types === typesDefault) == (other.__types === typesDefault) && (__types === - typesDefault || Objects.equals(types, other.types)) - } + private fun `__$fieldValues`(): List = listOf( + if (__types === typesDefault) typesDefault else types, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__types === typesDefault) typesDefault else types) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__types === typesDefault) null else "types=" + types, + ) - override fun toString(): String = listOfNotNull(if (__types === typesDefault) null else "types=" + - types).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 c37f9de3..ccf743bc 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.enumWithExtendedType.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,17 +26,21 @@ public class Query( public val types: List? get() = __types.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__types === typesDefault) == (other.__types === typesDefault) && (__types === - typesDefault || Objects.equals(types, other.types)) - } + private fun `__$fieldValues`(): List = listOf( + if (__types === typesDefault) typesDefault else types, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__types === typesDefault) typesDefault else types) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__types === typesDefault) null else "types=" + types, + ) - override fun toString(): String = listOfNotNull(if (__types === typesDefault) null else "types=" + - types).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/extendedDataClassWithInterface/expected/types/Example.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/extendedDataClassWithInterface/expected/types/Example.kt index 8f4dc31c..62fa7fb6 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/extendedDataClassWithInterface/expected/types/Example.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/extendedDataClassWithInterface/expected/types/Example.kt @@ -7,12 +7,12 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.extendedDataClassWithInterface.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -37,21 +37,23 @@ public class Example( override val age: Int? get() = __age.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Example) return false - return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || - Objects.equals(name, other.name)) && - (__age === ageDefault) == (other.__age === ageDefault) && (__age === ageDefault || - Objects.equals(age, other.age)) - } + private fun `__$fieldValues`(): List = listOf( + if (__name === nameDefault) nameDefault else name, + if (__age === ageDefault) ageDefault else age, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Example && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name, - if (__age === ageDefault) ageDefault else age) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + if (__age === ageDefault) null else "age=" + age, + ) - override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + - name, if (__age === ageDefault) null else "age=" + age).joinToString(prefix = "Example(", - postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Example(", postfix = + ")") @Generated public companion object { 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 3174d4c9..5355b9e0 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.input.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val movies: List? get() = __movies.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__movies === moviesDefault) == (other.__movies === moviesDefault) && (__movies === - moviesDefault || Objects.equals(movies, other.movies)) - } + private fun `__$fieldValues`(): List = listOf( + if (__movies === moviesDefault) moviesDefault else movies, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__movies === moviesDefault) moviesDefault else - movies) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__movies === moviesDefault) null else "movies=" + movies, + ) - override fun toString(): String = listOfNotNull(if (__movies === moviesDefault) null else - "movies=" + movies).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultBigDecimal/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultBigDecimal/expected/types/Query.kt index 6c483682..0a29e1ef 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultBigDecimal/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultBigDecimal/expected/types/Query.kt @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.inputWithDefaultBigDecimal.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,18 +26,21 @@ public class Query( public val orders: String? get() = __orders.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__orders === ordersDefault) == (other.__orders === ordersDefault) && (__orders === - ordersDefault || Objects.equals(orders, other.orders)) - } + private fun `__$fieldValues`(): List = listOf( + if (__orders === ordersDefault) ordersDefault else orders, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__orders === ordersDefault) ordersDefault else - orders) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__orders === ordersDefault) null else "orders=" + orders, + ) - override fun toString(): String = listOfNotNull(if (__orders === ordersDefault) null else - "orders=" + orders).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultCurrency/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultCurrency/expected/types/Query.kt index 7d707ded..33465414 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultCurrency/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/inputWithDefaultCurrency/expected/types/Query.kt @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.inputWithDefaultCurrency.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,18 +26,21 @@ public class Query( public val orders: String? get() = __orders.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__orders === ordersDefault) == (other.__orders === ordersDefault) && (__orders === - ordersDefault || Objects.equals(orders, other.orders)) - } + private fun `__$fieldValues`(): List = listOf( + if (__orders === ordersDefault) ordersDefault else orders, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__orders === ordersDefault) ordersDefault else - orders) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__orders === ordersDefault) null else "orders=" + orders, + ) - override fun toString(): String = listOfNotNull(if (__orders === ordersDefault) null else - "orders=" + orders).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 d3f14c74..fcdf793a 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.inputWithExtendedType.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val movies: List? get() = __movies.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__movies === moviesDefault) == (other.__movies === moviesDefault) && (__movies === - moviesDefault || Objects.equals(movies, other.movies)) - } + private fun `__$fieldValues`(): List = listOf( + if (__movies === moviesDefault) moviesDefault else movies, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__movies === moviesDefault) moviesDefault else - movies) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__movies === moviesDefault) null else "movies=" + movies, + ) - override fun toString(): String = listOfNotNull(if (__movies === moviesDefault) null else - "movies=" + movies).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 698601d1..bdb23ef8 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceClassWithInterfaceFields.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -69,35 +68,31 @@ public class Bird( override val parents: List? get() = __parents.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Bird) return false - return (__id === idDefault) == (other.__id === idDefault) && (__id === idDefault || - Objects.equals(id, other.id)) && - (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || - Objects.equals(name, other.name)) && - (__address === addressDefault) == (other.__address === addressDefault) && (__address === - addressDefault || Objects.equals(address, other.address)) && - (__mother === motherDefault) == (other.__mother === motherDefault) && (__mother === - motherDefault || Objects.equals(mother, other.mother)) && - (__father === fatherDefault) == (other.__father === fatherDefault) && (__father === - fatherDefault || Objects.equals(father, other.father)) && - (__parents === parentsDefault) == (other.__parents === parentsDefault) && (__parents === - parentsDefault || Objects.equals(parents, other.parents)) - } - - override fun hashCode(): Int = Objects.hash(if (__id === idDefault) idDefault else id, - if (__name === nameDefault) nameDefault else name, - if (__address === addressDefault) addressDefault else address, - if (__mother === motherDefault) motherDefault else mother, - if (__father === fatherDefault) fatherDefault else father, - if (__parents === parentsDefault) parentsDefault else parents) - - override fun toString(): String = listOfNotNull(if (__id === idDefault) null else "id=" + id, if - (__name === nameDefault) null else "name=" + name, if (__address === addressDefault) null else - "address=" + address, if (__mother === motherDefault) null else "mother=" + mother, if - (__father === fatherDefault) null else "father=" + father, if (__parents === parentsDefault) - null else "parents=" + parents).joinToString(prefix = "Bird(", postfix = ")") + private fun `__$fieldValues`(): List = listOf( + if (__id === idDefault) idDefault else id, + if (__name === nameDefault) nameDefault else name, + if (__address === addressDefault) addressDefault else address, + if (__mother === motherDefault) motherDefault else mother, + if (__father === fatherDefault) fatherDefault else father, + if (__parents === parentsDefault) parentsDefault else parents, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Bird && `__$fieldValues`() + == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__id === idDefault) null else "id=" + id, + if (__name === nameDefault) null else "name=" + name, + if (__address === addressDefault) null else "address=" + address, + if (__mother === motherDefault) null else "mother=" + mother, + if (__father === fatherDefault) null else "father=" + father, + if (__parents === parentsDefault) null else "parents=" + parents, + ) + + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Bird(", postfix = + ")") @Generated public companion object { 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 3c3355c4..a286e518 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceClassWithInterfaceFields.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -69,35 +68,30 @@ public class Dog( override val parents: List? get() = __parents.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Dog) return false - return (__id === idDefault) == (other.__id === idDefault) && (__id === idDefault || - Objects.equals(id, other.id)) && - (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || - Objects.equals(name, other.name)) && - (__address === addressDefault) == (other.__address === addressDefault) && (__address === - addressDefault || Objects.equals(address, other.address)) && - (__mother === motherDefault) == (other.__mother === motherDefault) && (__mother === - motherDefault || Objects.equals(mother, other.mother)) && - (__father === fatherDefault) == (other.__father === fatherDefault) && (__father === - fatherDefault || Objects.equals(father, other.father)) && - (__parents === parentsDefault) == (other.__parents === parentsDefault) && (__parents === - parentsDefault || Objects.equals(parents, other.parents)) - } - - override fun hashCode(): Int = Objects.hash(if (__id === idDefault) idDefault else id, - if (__name === nameDefault) nameDefault else name, - if (__address === addressDefault) addressDefault else address, - if (__mother === motherDefault) motherDefault else mother, - if (__father === fatherDefault) fatherDefault else father, - if (__parents === parentsDefault) parentsDefault else parents) - - override fun toString(): String = listOfNotNull(if (__id === idDefault) null else "id=" + id, if - (__name === nameDefault) null else "name=" + name, if (__address === addressDefault) null else - "address=" + address, if (__mother === motherDefault) null else "mother=" + mother, if - (__father === fatherDefault) null else "father=" + father, if (__parents === parentsDefault) - null else "parents=" + parents).joinToString(prefix = "Dog(", postfix = ")") + private fun `__$fieldValues`(): List = listOf( + if (__id === idDefault) idDefault else id, + if (__name === nameDefault) nameDefault else name, + if (__address === addressDefault) addressDefault else address, + if (__mother === motherDefault) motherDefault else mother, + if (__father === fatherDefault) fatherDefault else father, + if (__parents === parentsDefault) parentsDefault else parents, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Dog && `__$fieldValues`() + == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__id === idDefault) null else "id=" + id, + if (__name === nameDefault) null else "name=" + name, + if (__address === addressDefault) null else "address=" + address, + if (__mother === motherDefault) null else "mother=" + mother, + if (__father === fatherDefault) null else "father=" + father, + if (__parents === parentsDefault) null else "parents=" + parents, + ) + + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Dog(", postfix = ")") @Generated public companion object { 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 e8df2d87..f305b79a 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 @@ -7,12 +7,12 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceClassWithInterfaceFieldsOfDifferentType.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -36,21 +36,22 @@ public class Dog( override val diet: Vegetarian? get() = __diet.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Dog) return false - return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || - Objects.equals(name, other.name)) && - (__diet === dietDefault) == (other.__diet === dietDefault) && (__diet === dietDefault || - Objects.equals(diet, other.diet)) - } + private fun `__$fieldValues`(): List = listOf( + if (__name === nameDefault) nameDefault else name, + if (__diet === dietDefault) dietDefault else diet, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Dog && `__$fieldValues`() + == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name, - if (__diet === dietDefault) dietDefault else diet) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + if (__diet === dietDefault) null else "diet=" + diet, + ) - override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + - name, if (__diet === dietDefault) null else "diet=" + diet).joinToString(prefix = "Dog(", - postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Dog(", postfix = ")") @Generated public companion object { 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 15e4ae18..305d09e6 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceClassWithInterfaceFieldsOfDifferentType.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -36,22 +35,23 @@ public class Vegetarian( public val vegetables: List? get() = __vegetables.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Vegetarian) return false - return (__calories === caloriesDefault) == (other.__calories === caloriesDefault) && (__calories - === caloriesDefault || Objects.equals(calories, other.calories)) && - (__vegetables === vegetablesDefault) == (other.__vegetables === vegetablesDefault) && - (__vegetables === vegetablesDefault || Objects.equals(vegetables, other.vegetables)) - } + private fun `__$fieldValues`(): List = listOf( + if (__calories === caloriesDefault) caloriesDefault else calories, + if (__vegetables === vegetablesDefault) vegetablesDefault else vegetables, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Vegetarian && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__calories === caloriesDefault) caloriesDefault - else calories, - if (__vegetables === vegetablesDefault) vegetablesDefault else vegetables) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__calories === caloriesDefault) null else "calories=" + calories, + if (__vegetables === vegetablesDefault) null else "vegetables=" + vegetables, + ) - override fun toString(): String = listOfNotNull(if (__calories === caloriesDefault) null else - "calories=" + calories, if (__vegetables === vegetablesDefault) null else "vegetables=" + - vegetables).joinToString(prefix = "Vegetarian(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Vegetarian(", postfix + = ")") @Generated public companion object { 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 e5871c5e..d82616f0 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 @@ -7,12 +7,12 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceClassWithNonNullableFields.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -43,26 +43,25 @@ public class Employee( public val company: String? get() = __company.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Employee) return false - return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && - (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && - (__lastname === lastnameDefault) == (other.__lastname === lastnameDefault) && (__lastname === - lastnameDefault || Objects.equals(lastname, other.lastname)) && - (__company === companyDefault) == (other.__company === companyDefault) && (__company === - companyDefault || Objects.equals(company, other.company)) - } + private fun `__$fieldValues`(): List = listOf( + if (__firstname === firstnameDefault) firstnameDefault else firstname, + if (__lastname === lastnameDefault) lastnameDefault else lastname, + if (__company === companyDefault) companyDefault else company, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Employee && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault - else firstname, - if (__lastname === lastnameDefault) lastnameDefault else lastname, - if (__company === companyDefault) companyDefault else company) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__lastname === lastnameDefault) null else "lastname=" + lastname, + if (__company === companyDefault) null else "company=" + company, + ) - override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else - "firstname=" + firstname, if (__lastname === lastnameDefault) null else "lastname=" + - lastname, if (__company === companyDefault) null else "company=" + - company).joinToString(prefix = "Employee(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Employee(", postfix = + ")") @Generated public companion object { 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 b09d10e2..e74f19a2 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceClassWithNonNullableFields.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val people: List? get() = __people.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === - peopleDefault || Objects.equals(people, other.people)) - } + private fun `__$fieldValues`(): List = listOf( + if (__people === peopleDefault) peopleDefault else people, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__people === peopleDefault) peopleDefault else - people) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) - override fun toString(): String = listOfNotNull(if (__people === peopleDefault) null else - "people=" + people).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 de29fe2a..afb3a13d 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceWithInterfaceInheritance.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val fruits: List? get() = __fruits.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__fruits === fruitsDefault) == (other.__fruits === fruitsDefault) && (__fruits === - fruitsDefault || Objects.equals(fruits, other.fruits)) - } + private fun `__$fieldValues`(): List = listOf( + if (__fruits === fruitsDefault) fruitsDefault else fruits, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__fruits === fruitsDefault) fruitsDefault else - fruits) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__fruits === fruitsDefault) null else "fruits=" + fruits, + ) - override fun toString(): String = listOfNotNull(if (__fruits === fruitsDefault) null else - "fruits=" + fruits).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 1aa70f5f..e9787313 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceWithInterfaceInheritance.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,17 +26,21 @@ public class Seed( public val name: String? get() = __name.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Seed) return false - return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || - Objects.equals(name, other.name)) - } + private fun `__$fieldValues`(): List = listOf( + if (__name === nameDefault) nameDefault else name, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Seed && `__$fieldValues`() + == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + ) - override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + - name).joinToString(prefix = "Seed(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Seed(", postfix = + ")") @Generated public companion object { diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/Query.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/Query.kt index 2de60ac4..1286a256 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/Query.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/Query.kt @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceWithUnderscoreFields.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,17 +26,21 @@ public class Query( public val `is`: List? get() = __is.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__is === isDefault) == (other.__is === isDefault) && (__is === isDefault || - Objects.equals(`is`, other.`is`)) - } + private fun `__$fieldValues`(): List = listOf( + if (__is === isDefault) isDefault else `is`, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__is === isDefault) isDefault else `is`) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__is === isDefault) null else "is=" + `is`, + ) - override fun toString(): String = listOfNotNull(if (__is === isDefault) null else "is=" + - `is`).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { diff --git a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/T.kt b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/T.kt index 0b37d412..25020492 100644 --- a/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/T.kt +++ b/graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/interfaceWithUnderscoreFields/expected/types/T.kt @@ -7,12 +7,12 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.interfaceWithUnderscoreFields.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -35,20 +35,22 @@ public class T( public val id: String? get() = __id.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is T) return false - return (___id === _idDefault) == (other.___id === _idDefault) && (___id === _idDefault || - Objects.equals(_id, other._id)) && - (__id === idDefault) == (other.__id === idDefault) && (__id === idDefault || Objects.equals(id, - other.id)) - } + private fun `__$fieldValues`(): List = listOf( + if (___id === _idDefault) _idDefault else _id, + if (__id === idDefault) idDefault else id, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is T && `__$fieldValues`() == + other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (___id === _idDefault) _idDefault else _id, - if (__id === idDefault) idDefault else id) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (___id === _idDefault) null else "_id=" + _id, + if (__id === idDefault) null else "id=" + id, + ) - override fun toString(): String = listOfNotNull(if (___id === _idDefault) null else "_id=" + _id, - if (__id === idDefault) null else "id=" + id).joinToString(prefix = "T(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "T(", postfix = ")") @Generated public companion object { 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 3749ba52..8e8b553c 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithEnum.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -34,20 +33,23 @@ public class Query( public val es: List? get() = __es.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__e === eDefault) == (other.__e === eDefault) && (__e === eDefault || Objects.equals(e, - other.e)) && - (__es === esDefault) == (other.__es === esDefault) && (__es === esDefault || Objects.equals(es, - other.es)) - } + private fun `__$fieldValues`(): List = listOf( + if (__e === eDefault) eDefault else e, + if (__es === esDefault) esDefault else es, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__e === eDefault) eDefault else e, - if (__es === esDefault) esDefault else es) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__e === eDefault) null else "e=" + e, + if (__es === esDefault) null else "es=" + es, + ) - override fun toString(): String = listOfNotNull(if (__e === eDefault) null else "e=" + e, if (__es - === esDefault) null else "es=" + es).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 0060233e..01e0f7e4 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithNestedInputs.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -33,20 +33,23 @@ public class Query( public val q2: String? get() = __q2.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__q1 === q1Default) == (other.__q1 === q1Default) && (__q1 === q1Default || - Objects.equals(q1, other.q1)) && - (__q2 === q2Default) == (other.__q2 === q2Default) && (__q2 === q2Default || Objects.equals(q2, - other.q2)) - } + private fun `__$fieldValues`(): List = listOf( + if (__q1 === q1Default) q1Default else q1, + if (__q2 === q2Default) q2Default else q2, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__q1 === q1Default) q1Default else q1, - if (__q2 === q2Default) q2Default else q2) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__q1 === q1Default) null else "q1=" + q1, + if (__q2 === q2Default) null else "q2=" + q2, + ) - override fun toString(): String = listOfNotNull(if (__q1 === q1Default) null else "q1=" + q1, if - (__q2 === q2Default) null else "q2=" + q2).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 9ab097bb..45418aa0 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithPrimitiveAndArgs.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,18 +26,21 @@ public class Query( public val string: String? get() = __string.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__string === stringDefault) == (other.__string === stringDefault) && (__string === - stringDefault || Objects.equals(string, other.string)) - } + private fun `__$fieldValues`(): List = listOf( + if (__string === stringDefault) stringDefault else string, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__string === stringDefault) stringDefault else - string) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__string === stringDefault) null else "string=" + string, + ) - override fun toString(): String = listOfNotNull(if (__string === stringDefault) null else - "string=" + string).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 3d0077d9..3b2e10af 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithPrimitives.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -34,22 +33,23 @@ public class Query( public val strings: List? get() = __strings.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__string === stringDefault) == (other.__string === stringDefault) && (__string === - stringDefault || Objects.equals(string, other.string)) && - (__strings === stringsDefault) == (other.__strings === stringsDefault) && (__strings === - stringsDefault || Objects.equals(strings, other.strings)) - } + private fun `__$fieldValues`(): List = listOf( + if (__string === stringDefault) stringDefault else string, + if (__strings === stringsDefault) stringsDefault else strings, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__string === stringDefault) stringDefault else - string, - if (__strings === stringsDefault) stringsDefault else strings) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__string === stringDefault) null else "string=" + string, + if (__strings === stringsDefault) null else "strings=" + strings, + ) - override fun toString(): String = listOfNotNull(if (__string === stringDefault) null else - "string=" + string, if (__strings === stringsDefault) null else "strings=" + - strings).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 fd7e111b..b414d77e 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 @@ -7,12 +7,12 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithType.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -35,22 +35,23 @@ public class Employee( public val company: String? get() = __company.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Employee) return false - return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && - (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && - (__company === companyDefault) == (other.__company === companyDefault) && (__company === - companyDefault || Objects.equals(company, other.company)) - } + private fun `__$fieldValues`(): List = listOf( + if (__firstname === firstnameDefault) firstnameDefault else firstname, + if (__company === companyDefault) companyDefault else company, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Employee && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault - else firstname, - if (__company === companyDefault) companyDefault else company) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__company === companyDefault) null else "company=" + company, + ) - override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else - "firstname=" + firstname, if (__company === companyDefault) null else "company=" + - company).joinToString(prefix = "Employee(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Employee(", postfix = + ")") @Generated public companion object { 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 da40eb53..1a8de31d 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithType.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -34,22 +33,23 @@ public class Query( public val people: List? get() = __people.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__person === personDefault) == (other.__person === personDefault) && (__person === - personDefault || Objects.equals(person, other.person)) && - (__people === peopleDefault) == (other.__people === peopleDefault) && (__people === - peopleDefault || Objects.equals(people, other.people)) - } + private fun `__$fieldValues`(): List = listOf( + if (__person === personDefault) personDefault else person, + if (__people === peopleDefault) peopleDefault else people, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__person === personDefault) personDefault else - person, - if (__people === peopleDefault) peopleDefault else people) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__person === personDefault) null else "person=" + person, + if (__people === peopleDefault) null else "people=" + people, + ) - override fun toString(): String = listOfNotNull(if (__person === personDefault) null else - "person=" + person, if (__people === peopleDefault) null else "people=" + - people).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 d38d1793..b863017a 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 @@ -7,12 +7,12 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithTypeAndArgs.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -35,22 +35,23 @@ public class Employee( public val company: String? get() = __company.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Employee) return false - return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && - (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && - (__company === companyDefault) == (other.__company === companyDefault) && (__company === - companyDefault || Objects.equals(company, other.company)) - } + private fun `__$fieldValues`(): List = listOf( + if (__firstname === firstnameDefault) firstnameDefault else firstname, + if (__company === companyDefault) companyDefault else company, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Employee && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault - else firstname, - if (__company === companyDefault) companyDefault else company) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__company === companyDefault) null else "company=" + company, + ) - override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else - "firstname=" + firstname, if (__company === companyDefault) null else "company=" + - company).joinToString(prefix = "Employee(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Employee(", postfix = + ")") @Generated public companion object { 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 1e1a6934..881ac718 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithTypeAndArgs.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,18 +26,21 @@ public class Query( public val person: Person? get() = __person.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__person === personDefault) == (other.__person === personDefault) && (__person === - personDefault || Objects.equals(person, other.person)) - } + private fun `__$fieldValues`(): List = listOf( + if (__person === personDefault) personDefault else person, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__person === personDefault) personDefault else - person) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__person === personDefault) null else "person=" + person, + ) - override fun toString(): String = listOfNotNull(if (__person === personDefault) null else - "person=" + person).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 3ba6ec7e..5cbe7f44 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 @@ -7,12 +7,12 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithUnion.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -36,22 +36,23 @@ public class Employee( public val company: String? get() = __company.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Employee) return false - return (__firstname === firstnameDefault) == (other.__firstname === firstnameDefault) && - (__firstname === firstnameDefault || Objects.equals(firstname, other.firstname)) && - (__company === companyDefault) == (other.__company === companyDefault) && (__company === - companyDefault || Objects.equals(company, other.company)) - } + private fun `__$fieldValues`(): List = listOf( + if (__firstname === firstnameDefault) firstnameDefault else firstname, + if (__company === companyDefault) companyDefault else company, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Employee && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__firstname === firstnameDefault) firstnameDefault - else firstname, - if (__company === companyDefault) companyDefault else company) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__company === companyDefault) null else "company=" + company, + ) - override fun toString(): String = listOfNotNull(if (__firstname === firstnameDefault) null else - "firstname=" + firstname, if (__company === companyDefault) null else "company=" + - company).joinToString(prefix = "Employee(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Employee(", postfix = + ")") @Generated public companion object { 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 fecc738e..2412b2d7 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.projectionWithUnion.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -34,20 +33,23 @@ public class Query( public val us: List? get() = __us.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__u === uDefault) == (other.__u === uDefault) && (__u === uDefault || Objects.equals(u, - other.u)) && - (__us === usDefault) == (other.__us === usDefault) && (__us === usDefault || Objects.equals(us, - other.us)) - } + private fun `__$fieldValues`(): List = listOf( + if (__u === uDefault) uDefault else u, + if (__us === usDefault) usDefault else us, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__u === uDefault) uDefault else u, - if (__us === usDefault) usDefault else us) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__u === uDefault) null else "u=" + u, + if (__us === usDefault) null else "us=" + us, + ) - override fun toString(): String = listOfNotNull(if (__u === uDefault) null else "u=" + u, if (__us - === usDefault) null else "us=" + us).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 15e5587e..3a3e6463 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.skipCodegenOnFields.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,17 +26,21 @@ public class Person( public val name: String? get() = __name.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Person) return false - return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || - Objects.equals(name, other.name)) - } + private fun `__$fieldValues`(): List = listOf( + if (__name === nameDefault) nameDefault else name, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Person && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + ) - override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + - name).joinToString(prefix = "Person(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Person(", postfix = + ")") @Generated public companion object { 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 c60a1dd3..f658a497 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.skipCodegenOnTypes.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,17 +26,21 @@ public class Person( public val name: String? get() = __name.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Person) return false - return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || - Objects.equals(name, other.name)) - } + private fun `__$fieldValues`(): List = listOf( + if (__name === nameDefault) nameDefault else name, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Person && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + ) - override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + - name).joinToString(prefix = "Person(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Person(", postfix = + ")") @Generated public companion object { 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 35a8a037..e37f3376 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.union.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,17 +26,21 @@ public class Actor( public val name: String? get() = __name.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Actor) return false - return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || - Objects.equals(name, other.name)) - } + private fun `__$fieldValues`(): List = listOf( + if (__name === nameDefault) nameDefault else name, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Actor && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + ) - override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + - name).joinToString(prefix = "Actor(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Actor(", postfix = + ")") @Generated public companion object { 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 152b8bac..42037926 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.union.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,17 +26,21 @@ public class Movie( public val title: String? get() = __title.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Movie) return false - return (__title === titleDefault) == (other.__title === titleDefault) && (__title === - titleDefault || Objects.equals(title, other.title)) - } + private fun `__$fieldValues`(): List = listOf( + if (__title === titleDefault) titleDefault else title, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Movie && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__title === titleDefault) titleDefault else title) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__title === titleDefault) null else "title=" + title, + ) - override fun toString(): String = listOfNotNull(if (__title === titleDefault) null else "title=" + - title).joinToString(prefix = "Movie(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Movie(", postfix = + ")") @Generated public companion object { 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 310887b8..6a0f72cb 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.union.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val search: List? get() = __search.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__search === searchDefault) == (other.__search === searchDefault) && (__search === - searchDefault || Objects.equals(search, other.search)) - } + private fun `__$fieldValues`(): List = listOf( + if (__search === searchDefault) searchDefault else search, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__search === searchDefault) searchDefault else - search) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__search === searchDefault) null else "search=" + search, + ) - override fun toString(): String = listOfNotNull(if (__search === searchDefault) null else - "search=" + search).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 6cfdba8e..3a0522f0 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.unionTypesWithoutInterfaceCanDeserialize.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -40,26 +40,26 @@ public class Droid( public val primaryFunction: String? get() = __primaryFunction.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Droid) return false - return (__id === idDefault) == (other.__id === idDefault) && (__id === idDefault || - Objects.equals(id, other.id)) && - (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || - Objects.equals(name, other.name)) && - (__primaryFunction === primaryFunctionDefault) == (other.__primaryFunction === - primaryFunctionDefault) && (__primaryFunction === primaryFunctionDefault || - Objects.equals(primaryFunction, other.primaryFunction)) - } + private fun `__$fieldValues`(): List = listOf( + if (__id === idDefault) idDefault else id, + if (__name === nameDefault) nameDefault else name, + if (__primaryFunction === primaryFunctionDefault) primaryFunctionDefault else primaryFunction, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Droid && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__id === idDefault) idDefault else id, - if (__name === nameDefault) nameDefault else name, - if (__primaryFunction === primaryFunctionDefault) primaryFunctionDefault else primaryFunction) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__id === idDefault) null else "id=" + id, + if (__name === nameDefault) null else "name=" + name, + if (__primaryFunction === primaryFunctionDefault) null else "primaryFunction=" + + primaryFunction, + ) - override fun toString(): String = listOfNotNull(if (__id === idDefault) null else "id=" + id, if - (__name === nameDefault) null else "name=" + name, if (__primaryFunction === - primaryFunctionDefault) null else "primaryFunction=" + primaryFunction).joinToString(prefix = - "Droid(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Droid(", postfix = + ")") @Generated public companion object { 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 c4d04213..01570169 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.unionTypesWithoutInterfaceCanDeserialize.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -40,24 +40,25 @@ public class Human( public val totalCredits: Int? get() = __totalCredits.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Human) return false - return (__id === idDefault) == (other.__id === idDefault) && (__id === idDefault || - Objects.equals(id, other.id)) && - (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || - Objects.equals(name, other.name)) && - (__totalCredits === totalCreditsDefault) == (other.__totalCredits === totalCreditsDefault) && - (__totalCredits === totalCreditsDefault || Objects.equals(totalCredits, other.totalCredits)) - } + private fun `__$fieldValues`(): List = listOf( + if (__id === idDefault) idDefault else id, + if (__name === nameDefault) nameDefault else name, + if (__totalCredits === totalCreditsDefault) totalCreditsDefault else totalCredits, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Human && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__id === idDefault) idDefault else id, - if (__name === nameDefault) nameDefault else name, - if (__totalCredits === totalCreditsDefault) totalCreditsDefault else totalCredits) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__id === idDefault) null else "id=" + id, + if (__name === nameDefault) null else "name=" + name, + if (__totalCredits === totalCreditsDefault) null else "totalCredits=" + totalCredits, + ) - override fun toString(): String = listOfNotNull(if (__id === idDefault) null else "id=" + id, if - (__name === nameDefault) null else "name=" + name, if (__totalCredits === totalCreditsDefault) - null else "totalCredits=" + totalCredits).joinToString(prefix = "Human(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Human(", postfix = + ")") @Generated public companion object { 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 ccb5fb85..0e653f20 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.unionTypesWithoutInterfaceCanDeserialize.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,18 +26,21 @@ public class Query( public val search: SearchResultPage? get() = __search.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__search === searchDefault) == (other.__search === searchDefault) && (__search === - searchDefault || Objects.equals(search, other.search)) - } + private fun `__$fieldValues`(): List = listOf( + if (__search === searchDefault) searchDefault else search, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__search === searchDefault) searchDefault else - search) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__search === searchDefault) null else "search=" + search, + ) - override fun toString(): String = listOfNotNull(if (__search === searchDefault) null else - "search=" + search).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 debe958e..62bba1b2 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.unionTypesWithoutInterfaceCanDeserialize.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,17 +26,21 @@ public class SearchResultPage( public val items: List? get() = __items.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is SearchResultPage) return false - return (__items === itemsDefault) == (other.__items === itemsDefault) && (__items === - itemsDefault || Objects.equals(items, other.items)) - } + private fun `__$fieldValues`(): List = listOf( + if (__items === itemsDefault) itemsDefault else items, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is SearchResultPage && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__items === itemsDefault) itemsDefault else items) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__items === itemsDefault) null else "items=" + items, + ) - override fun toString(): String = listOfNotNull(if (__items === itemsDefault) null else "items=" + - items).joinToString(prefix = "SearchResultPage(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "SearchResultPage(", + postfix = ")") @Generated public companion object { 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 274e16c2..29257052 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.unionWithExtendedType.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,17 +26,21 @@ public class Actor( public val name: String? get() = __name.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Actor) return false - return (__name === nameDefault) == (other.__name === nameDefault) && (__name === nameDefault || - Objects.equals(name, other.name)) - } + private fun `__$fieldValues`(): List = listOf( + if (__name === nameDefault) nameDefault else name, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Actor && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__name === nameDefault) nameDefault else name) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + ) - override fun toString(): String = listOfNotNull(if (__name === nameDefault) null else "name=" + - name).joinToString(prefix = "Actor(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Actor(", postfix = + ")") @Generated public companion object { 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 9dbf604e..fc4e2068 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.unionWithExtendedType.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,17 +26,21 @@ public class Movie( public val title: String? get() = __title.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Movie) return false - return (__title === titleDefault) == (other.__title === titleDefault) && (__title === - titleDefault || Objects.equals(title, other.title)) - } + private fun `__$fieldValues`(): List = listOf( + if (__title === titleDefault) titleDefault else title, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Movie && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__title === titleDefault) titleDefault else title) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__title === titleDefault) null else "title=" + title, + ) - override fun toString(): String = listOfNotNull(if (__title === titleDefault) null else "title=" + - title).joinToString(prefix = "Movie(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Movie(", postfix = + ")") @Generated public companion object { 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 9b854be1..912b09b2 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 @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.unionWithExtendedType.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int @@ -27,18 +26,21 @@ public class Query( public val search: List? get() = __search.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Query) return false - return (__search === searchDefault) == (other.__search === searchDefault) && (__search === - searchDefault || Objects.equals(search, other.search)) - } + private fun `__$fieldValues`(): List = listOf( + if (__search === searchDefault) searchDefault else search, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Query && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__search === searchDefault) searchDefault else - search) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__search === searchDefault) null else "search=" + search, + ) - override fun toString(): String = listOfNotNull(if (__search === searchDefault) null else - "search=" + search).joinToString(prefix = "Query(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Query(", postfix = + ")") @Generated public companion object { 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 9f3a36a9..61e25f1b 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 @@ -7,11 +7,11 @@ import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import com.netflix.graphql.dgs.codegen.cases.unionWithExtendedType.expected.Generated import java.lang.IllegalStateException -import java.util.Objects import kotlin.Any import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,17 +26,21 @@ public class Rating( public val stars: Int? get() = __stars.invoke() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is Rating) return false - return (__stars === starsDefault) == (other.__stars === starsDefault) && (__stars === - starsDefault || Objects.equals(stars, other.stars)) - } + private fun `__$fieldValues`(): List = listOf( + if (__stars === starsDefault) starsDefault else stars, + ) + + override fun equals(other: Any?): Boolean = this === other || (other is Rating && + `__$fieldValues`() == other.`__$fieldValues`()) + + override fun hashCode(): Int = `__$fieldValues`().hashCode() - override fun hashCode(): Int = Objects.hash(if (__stars === starsDefault) starsDefault else stars) + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__stars === starsDefault) null else "stars=" + stars, + ) - override fun toString(): String = listOfNotNull(if (__stars === starsDefault) null else "stars=" + - stars).joinToString(prefix = "Rating(", postfix = ")") + override fun toString(): String = `__$fieldStrings`().joinToString(prefix = "Rating(", postfix = + ")") @Generated public companion object { diff --git a/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/kotlin2/GenerateKotlin2DataTypes.kt b/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/kotlin2/GenerateKotlin2DataTypes.kt index fc371104..c4be12d0 100644 --- a/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/kotlin2/GenerateKotlin2DataTypes.kt +++ b/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/kotlin2/GenerateKotlin2DataTypes.kt @@ -45,21 +45,21 @@ import com.squareup.kotlinpoet.FileSpec import com.squareup.kotlinpoet.FunSpec import com.squareup.kotlinpoet.INT import com.squareup.kotlinpoet.KModifier +import com.squareup.kotlinpoet.LIST import com.squareup.kotlinpoet.LambdaTypeName import com.squareup.kotlinpoet.ParameterSpec +import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy import com.squareup.kotlinpoet.PropertySpec import com.squareup.kotlinpoet.STRING import com.squareup.kotlinpoet.TypeSpec import com.squareup.kotlinpoet.asClassName import com.squareup.kotlinpoet.buildCodeBlock -import com.squareup.kotlinpoet.joinToCode import graphql.language.Document import graphql.language.FieldDefinition import graphql.language.ObjectTypeDefinition import org.slf4j.Logger import org.slf4j.LoggerFactory import java.io.Serializable -import java.util.Objects internal val logger: Logger = LoggerFactory.getLogger("com.netflix.graphql.dgs.codegen.generators.kotlin2") @@ -270,7 +270,7 @@ fun generateKotlin2DataTypes( // add value-based equals/hashCode over the requested fields .addFunctions(equalsAndHashCodeFunctions(className, fields)) // add a toString rendering only the requested fields - .addFunction(toStringFunction(className, fields)) + .addFunctions(toStringFunctions(className, fields)) .build() // return a file per type @@ -278,22 +278,6 @@ fun generateKotlin2DataTypes( } } -/** - * Generates `equals`/`hashCode` for a kotlin2 data type. - * - * These classes have no fixed value per field: a field's backing lambda is either the - * one supplied by the caller (the field was "requested") or the shared `${name}Default` - * lambda from the companion object, which throws when invoked (the field was not - * requested). Two instances are equal iff they requested the exact same set of fields - * and every requested field's value is equal; a field left unrequested on both sides is - * never invoked and counts as equal, while a field requested on only one side makes the - * instances unequal. This keeps the relation symmetric and transitive - comparing only - * the intersection of requested fields would not. - * - * Whether a field was requested is detected by reference-comparing its backing lambda - * against the companion's default lambda, never by invoking it or matching the - * exception message. - */ private class GeneratedFieldNames( field: KotlinFieldInfo, ) { @@ -305,6 +289,60 @@ private class GeneratedFieldNames( val getter = field.kotlinName } +// "$"-containing and backtick-escaped (KotlinPoet escapes automatically) so these names can +// never collide with a member derived from a GraphQL field: GraphQL Names only ever contain +// letters, digits, and "_" (never "$"), so no field's backing property ("__name"), companion +// default ("nameDefault"), or getter ("name") can ever equal one of these, however the field +// is named. +private const val FIELD_VALUES_FUN = "__\$fieldValues" +private const val FIELD_STRINGS_FUN = "__\$fieldStrings" + +/** + * Builds a `listOf(...)` / `listOfNotNull(...)` literal, one item per line, using plain + * literal "\n" text rather than KotlinPoet's `indent()`/`unindent()`. Those two, paired with a + * function body that's collapsed into a single-expression `= ...` (as every caller here is), + * leave the CodeWriter's indent level unbalanced for every class member declared afterward - + * confirmed by reproducing it in isolation before picking this approach. Literal text sidesteps + * that indent-tracking machinery entirely. + */ +private fun multilineListLiteral( + invocation: String, + items: List, +): CodeBlock = + buildCodeBlock { + add("%L(\n", invocation) + items.forEach { item -> + add(" ") + add(item) + add(",\n") + } + add(")") + } + +/** + * Generates `equals`/`hashCode` for a kotlin2 data type by delegating to a private + * [FIELD_VALUES_FUN] helper: a `List` snapshot of every field, in declaration order. + * + * These classes have no fixed value per field: a field's backing lambda is either the one + * supplied by the caller (the field was "requested") or the shared `${name}Default` lambda from + * the companion object, which throws when invoked (the field was not requested). + * [FIELD_VALUES_FUN] represents an unrequested field with that same default-lambda object + * rather than invoking it, so: + * - same requested-field set + equal requested values -> the two `List` snapshots are + * structurally equal (via `List.equals`), so `equals` is true and `hashCode` matches; + * - a field requested on only one side puts a real value at that index on one side and the + * (distinct) default-lambda object on the other, so the lists - and therefore the + * instances - compare unequal; this also covers requested-null vs. absent, since `null` is + * never equal to the default-lambda object; + * - a field left unrequested on both sides contributes the same default-lambda object to both + * lists without either supplier ever being invoked. + * This keeps the relation symmetric and transitive - comparing only the intersection of + * requested fields would not - with no separate "same requested set" check needed: a mismatched + * requested set already forces a mismatched entry at that field's list index. + * + * Whether a field was requested is detected by reference-comparing its backing lambda against + * the companion's default lambda, never by invoking it or matching the exception message. + */ private fun equalsAndHashCodeFunctions( className: ClassName, fields: List, @@ -315,36 +353,38 @@ private fun equalsAndHashCodeFunctions( val names = fields.map(::GeneratedFieldNames) + val fieldValuesFun = + FunSpec + .builder(FIELD_VALUES_FUN) + .addModifiers(KModifier.PRIVATE) + .returns(LIST.parameterizedBy(ANY.copy(nullable = true))) + .addStatement( + "return %L", + multilineListLiteral( + "listOf", + names.map { n -> + CodeBlock.of( + "if (%N === %N) %N else %N", + n.backing, + n.default, + n.default, + n.getter, + ) + }, + ), + ).build() + val equalsFun = FunSpec .builder("equals") .addModifiers(KModifier.OVERRIDE) .addParameter("other", ANY.copy(nullable = true)) .returns(BOOLEAN) - .addStatement("if (this === other) return true") - .addStatement("if (other !is %T) return false", className) - .addCode( - buildCodeBlock { - add("return ") - add( - names - .map { n -> - CodeBlock.of( - "(%N === %N) == (other.%N === %N) && (%N === %N || %T.equals(%N, other.%N))", - n.backing, - n.default, - n.backing, - n.default, - n.backing, - n.default, - Objects::class, - n.getter, - n.getter, - ) - }.joinToCode(separator = " &&\n"), - ) - add("\n") - }, + .addStatement( + "return this === other || (other is %T && %N() == other.%N())", + className, + FIELD_VALUES_FUN, + FIELD_VALUES_FUN, ).build() val hashCodeFun = @@ -352,62 +392,69 @@ private fun equalsAndHashCodeFunctions( .builder("hashCode") .addModifiers(KModifier.OVERRIDE) .returns(INT) - .addStatement( - "return %T.hash(%L)", - Objects::class, - names - .map { n -> - // Feed the shared default lambda itself as the "unrequested" sentinel: it's - // already a stable per-field singleton, so it doubles as a hashCode marker - // without needing a dedicated sentinel type, and never invoking the supplier. - CodeBlock.of( - "if (%N === %N) %N else %N", - n.backing, - n.default, - n.default, - n.getter, - ) - }.joinToCode(separator = ",\n"), - ).build() + .addStatement("return %N().hashCode()", FIELD_VALUES_FUN) + .build() - return listOf(equalsFun, hashCodeFun) + return listOf(fieldValuesFun, equalsFun, hashCodeFun) } /** * Generates a `toString` for a kotlin2 data type that renders only the fields that were * requested, in declaration order - not the full, possibly-throwing set of fields a fixed-field * data class would show. See [Netflix/dgs-codegen#638](https://github.com/Netflix/dgs-codegen/issues/638). + * + * `toString` needs field *names*, not just values, so it can't reuse [FIELD_VALUES_FUN]; it gets + * its own private [FIELD_STRINGS_FUN] helper instead, built the same way. */ -private fun toStringFunction( +private fun toStringFunctions( className: ClassName, fields: List, -): FunSpec { - val builder = - FunSpec - .builder("toString") - .addModifiers(KModifier.OVERRIDE) - .returns(STRING) - +): List { if (fields.isEmpty()) { - return builder.addStatement("return %S", "${className.simpleName}()").build() + return listOf( + FunSpec + .builder("toString") + .addModifiers(KModifier.OVERRIDE) + .returns(STRING) + .addStatement("return %S", "${className.simpleName}()") + .build(), + ) } val names = fields.map(::GeneratedFieldNames) - return builder - .addStatement( - "return listOfNotNull(%L).joinToString(prefix = %S, postfix = %S)", - names - .map { n -> - CodeBlock.of( - "if (%N === %N) null else %S + %N", - n.backing, - n.default, - "${n.getter}=", - n.getter, - ) - }.joinToCode(separator = ", "), - "${className.simpleName}(", - ")", - ).build() + val fieldStringsFun = + FunSpec + .builder(FIELD_STRINGS_FUN) + .addModifiers(KModifier.PRIVATE) + .returns(LIST.parameterizedBy(STRING)) + .addStatement( + "return %L", + multilineListLiteral( + "listOfNotNull", + names.map { n -> + CodeBlock.of( + "if (%N === %N) null else %S + %N", + n.backing, + n.default, + "${n.getter}=", + n.getter, + ) + }, + ), + ).build() + + val toStringFun = + FunSpec + .builder("toString") + .addModifiers(KModifier.OVERRIDE) + .returns(STRING) + .addStatement( + "return %N().joinToString(prefix = %S, postfix = %S)", + FIELD_STRINGS_FUN, + "${className.simpleName}(", + ")", + ).build() + + return listOf(fieldStringsFun, toStringFun) }