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..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -29,6 +33,24 @@ public class Person( public val lastname: String? get() = __lastname.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__lastname === lastnameDefault) null else "lastname=" + lastname, + ) + + override fun toString(): String = `__$fieldStrings`().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 867f3259..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val people: List? get() = __people.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) + + override fun toString(): String = `__$fieldStrings`().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 05d1bcbb..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -29,6 +33,24 @@ public class Person( public val lastname: String? get() = __lastname.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__lastname === lastnameDefault) null else "lastname=" + lastname, + ) + + override fun toString(): String = `__$fieldStrings`().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 74aae422..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val people: List? get() = __people.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) + + override fun toString(): String = `__$fieldStrings`().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 c2420035..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val people: List? get() = __people.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) + + override fun toString(): String = `__$fieldStrings`().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 00098ad8..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -29,6 +33,24 @@ public class Person( public val lastname: String? get() = __lastname.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__lastname === lastnameDefault) null else "lastname=" + lastname, + ) + + override fun toString(): String = `__$fieldStrings`().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 18106a44..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -29,6 +33,24 @@ public class Query( public val friends: List? get() = __friends.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + if (__friends === friendsDefault) null else "friends=" + friends, + ) + + override fun toString(): String = `__$fieldStrings`().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 fc0e0103..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -36,6 +40,26 @@ public class Person( public val email: String? get() = __email.invoke() + 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() + + 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 = `__$fieldStrings`().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 802d4b6f..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val people: List? get() = __people.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) + + override fun toString(): String = `__$fieldStrings`().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 50ea0d9d..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName /** @@ -26,6 +30,22 @@ public class Movie( public val title: String? get() = __title.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__title === titleDefault) null else "title=" + title, + ) + + override fun toString(): String = `__$fieldStrings`().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 c77209a0..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,6 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -21,6 +26,22 @@ public class Query( public val search: Movie? get() = __search.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__search === searchDefault) null else "search=" + search, + ) + + override fun toString(): String = `__$fieldStrings`().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 d54c13c9..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -25,6 +29,22 @@ public class Movie( public val title: String? get() = __title.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__title === titleDefault) null else "title=" + title, + ) + + override fun toString(): String = `__$fieldStrings`().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 e48e0b95..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,6 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -21,6 +26,22 @@ public class Query( public val search: Movie? get() = __search.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__search === searchDefault) null else "search=" + search, + ) + + override fun toString(): String = `__$fieldStrings`().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 49770de7..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,6 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -21,6 +26,22 @@ public class Query( public val me: Person? get() = __me.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__me === meDefault) null else "me=" + me, + ) + + override fun toString(): String = `__$fieldStrings`().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 ac3c921b..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,6 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -21,6 +26,22 @@ public class Query( public val test: RequiredTestType? get() = __test.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__test === testDefault) null else "test=" + test, + ) + + override fun toString(): String = `__$fieldStrings`().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 9d5b1e95..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,7 +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 kotlin.Any import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -22,6 +26,22 @@ public class RequiredTestType( public val isRequired: Boolean get() = __isRequired.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__isRequired === isRequiredDefault) null else "isRequired=" + isRequired, + ) + + override fun toString(): String = `__$fieldStrings`().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 591f4376..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.Long +import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -30,6 +35,24 @@ public class Entity( public val dateTime: OffsetDateTime? get() = __dateTime.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__long === longDefault) null else "long=" + long, + if (__dateTime === dateTimeDefault) null else "dateTime=" + dateTime, + ) + + override fun toString(): String = `__$fieldStrings`().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 3aa2af32..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -29,6 +33,24 @@ public class EntityConnection( public val edges: List? get() = __edges.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__pageInfo === pageInfoDefault) null else "pageInfo=" + pageInfo, + if (__edges === edgesDefault) null else "edges=" + edges, + ) + + override fun toString(): String = `__$fieldStrings`().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 69760476..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -29,6 +33,24 @@ public class EntityEdge( public val node: Entity? get() = __node.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__cursor === cursorDefault) null else "cursor=" + cursor, + if (__node === nodeDefault) null else "node=" + node, + ) + + override fun toString(): String = `__$fieldStrings`().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 88d1c7c1..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,8 +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 kotlin.Any import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -44,6 +47,29 @@ public class PageInfo( public val hasPreviousPage: Boolean get() = __hasPreviousPage.invoke() + 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 toString(): String = `__$fieldStrings`().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 1000c951..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -29,6 +33,26 @@ public class Query( public val entityConnection: EntityConnection? get() = __entityConnection.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__entity === entityDefault) null else "entity=" + entity, + if (__entityConnection === entityConnectionDefault) null else "entityConnection=" + + entityConnection, + ) + + override fun toString(): String = `__$fieldStrings`().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 d0553d90..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -36,6 +40,25 @@ public class Car( public val engine: Engine? get() = __engine.invoke() + 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() + + 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 = `__$fieldStrings`().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 dd50e0fb..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,9 +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 kotlin.Any +import kotlin.Boolean import kotlin.Double import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -45,6 +48,28 @@ public class Engine( public val performance: Performance? get() = __performance.invoke() + 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() + + 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 = `__$fieldStrings`().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 c3dafbb5..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,7 +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 kotlin.Any +import kotlin.Boolean import kotlin.Double +import kotlin.Int +import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -29,6 +34,24 @@ public class Performance( public val quarterMile: Double? get() = __quarterMile.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__zeroToSixty === zeroToSixtyDefault) null else "zeroToSixty=" + zeroToSixty, + if (__quarterMile === quarterMileDefault) null else "quarterMile=" + quarterMile, + ) + + override fun toString(): String = `__$fieldStrings`().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 c49e4872..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val cars: List? get() = __cars.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__cars === carsDefault) null else "cars=" + cars, + ) + + override fun toString(): String = `__$fieldStrings`().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 77fc6a94..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val people: List? get() = __people.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) + + override fun toString(): String = `__$fieldStrings`().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 93fb8b81..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,9 +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 kotlin.Any +import kotlin.Boolean import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -48,6 +51,28 @@ public class Employee( override val age: Int get() = __age.invoke() + 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() + + 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 = `__$fieldStrings`().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 9d23111b..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val people: List? get() = __people.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) + + override fun toString(): String = `__$fieldStrings`().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 0319fb56..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,8 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -39,6 +43,26 @@ public class Employee( public val company: String? get() = __company.invoke() + 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() + + 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 = `__$fieldStrings`().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 77c64378..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val people: List? get() = __people.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) + + override fun toString(): String = `__$fieldStrings`().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 1166dd79..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val people: List? get() = __people.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) + + override fun toString(): String = `__$fieldStrings`().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 55f9487f..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,8 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -47,6 +51,28 @@ public class Talent( public val imdbProfile: String? get() = __imdbProfile.invoke() + 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 toString(): String = `__$fieldStrings`().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 e2e3e651..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,6 +7,9 @@ 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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -30,6 +33,24 @@ public class Person( public val email: List? get() = __email.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + if (__email === emailDefault) null else "email=" + email, + ) + + override fun toString(): String = `__$fieldStrings`().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 1eec46af..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val people: List? get() = __people.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) + + override fun toString(): String = `__$fieldStrings`().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 cb3548ad..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,8 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -26,6 +30,22 @@ public class Product( override val id: String get() = __id.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__id === idDefault) null else "id=" + id, + ) + + override fun toString(): String = `__$fieldStrings`().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 d2d426ba..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val products: List? get() = __products.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__products === productsDefault) null else "products=" + products, + ) + + override fun toString(): String = `__$fieldStrings`().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 c0338b52..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.Long +import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -30,6 +35,24 @@ public class Entity( public val dateTime: OffsetDateTime? get() = __dateTime.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__long === longDefault) null else "long=" + long, + if (__dateTime === dateTimeDefault) null else "dateTime=" + dateTime, + ) + + override fun toString(): String = `__$fieldStrings`().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 364cd5c7..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -29,6 +33,24 @@ public class EntityEdge( public val node: Entity? get() = __node.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__cursor === cursorDefault) null else "cursor=" + cursor, + if (__node === nodeDefault) null else "node=" + node, + ) + + override fun toString(): String = `__$fieldStrings`().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 1fb057f0..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -30,6 +34,26 @@ public class Query( public val entityConnection: SimpleListConnection? get() = __entityConnection.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__entity === entityDefault) null else "entity=" + entity, + if (__entityConnection === entityConnectionDefault) null else "entityConnection=" + + entityConnection, + ) + + override fun toString(): String = `__$fieldStrings`().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 30d8f241..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,8 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -40,6 +44,26 @@ public class Employee( override val company: String? get() = __company.invoke() + 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() + + 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 = `__$fieldStrings`().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 cc1994f5..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val people: List? get() = __people.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) + + override fun toString(): String = `__$fieldStrings`().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 cebd92b9..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,6 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -21,6 +26,22 @@ public class MyType( public val other: OtherType get() = __other.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__other === otherDefault) null else "other=" + other, + ) + + override fun toString(): String = `__$fieldStrings`().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 51282e0d..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -22,6 +26,22 @@ public class OtherType( public val name: String get() = __name.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + ) + + override fun toString(): String = `__$fieldStrings`().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 4a41f86c..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,6 +7,9 @@ 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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -30,6 +33,24 @@ public class Person( public val email: List get() = __email.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + if (__email === emailDefault) null else "email=" + email, + ) + + override fun toString(): String = `__$fieldStrings`().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 3241da1b..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val people: List? get() = __people.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) + + override fun toString(): String = `__$fieldStrings`().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 189a1a36..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,9 +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 kotlin.Any import kotlin.Boolean import kotlin.Double import kotlin.Int +import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -38,6 +41,26 @@ public class MyType( public val floaty: Double get() = __floaty.invoke() + 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() + + 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 = `__$fieldStrings`().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 80bbb167..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,9 +7,11 @@ 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 kotlin.Any import kotlin.Boolean import kotlin.Double import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -39,6 +41,26 @@ public class MyType( public val floaty: List? get() = __floaty.invoke() + 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() + + 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 = `__$fieldStrings`().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 df789bf6..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,6 +7,9 @@ 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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -30,6 +33,24 @@ public class Person( public val email: List get() = __email.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + if (__email === emailDefault) null else "email=" + email, + ) + + override fun toString(): String = `__$fieldStrings`().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 179851bb..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val people: List? get() = __people.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) + + override fun toString(): String = `__$fieldStrings`().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 f3164c40..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,9 +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 kotlin.Any import kotlin.Boolean import kotlin.Double import kotlin.Int +import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -38,6 +41,26 @@ public class MyType( public val floaty: Double? get() = __floaty.invoke() + 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() + + 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 = `__$fieldStrings`().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 351585e1..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,6 +7,9 @@ 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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -37,6 +40,26 @@ public class Person( public val friends: List? get() = __friends.invoke() + 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() + + 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 = `__$fieldStrings`().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 1f1f3810..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val people: List? get() = __people.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) + + override fun toString(): String = `__$fieldStrings`().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 16166bf4..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -29,6 +33,24 @@ public class Person( public val `interface`: String? get() = __interface.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__info === infoDefault) null else "info=" + info, + if (__interface === interfaceDefault) null else "interface=" + `interface`, + ) + + override fun toString(): String = `__$fieldStrings`().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 dfbfa2a3..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val people: List? get() = __people.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) + + override fun toString(): String = `__$fieldStrings`().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 fec342e0..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -22,6 +26,22 @@ public class SampleType( public val `return`: String get() = __return.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__return === returnDefault) null else "return=" + `return`, + ) + + override fun toString(): String = `__$fieldStrings`().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 a719af1c..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -29,6 +33,24 @@ public class Person( public val lastname: String? get() = __lastname.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__lastname === lastnameDefault) null else "lastname=" + lastname, + ) + + override fun toString(): String = `__$fieldStrings`().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 aef99ad4..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val people: List? get() = __people.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) + + override fun toString(): String = `__$fieldStrings`().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 2c519850..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val types: List? get() = __types.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__types === typesDefault) null else "types=" + types, + ) + + override fun toString(): String = `__$fieldStrings`().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 04d3b802..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val types: List? get() = __types.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__types === typesDefault) null else "types=" + types, + ) + + override fun toString(): String = `__$fieldStrings`().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 1e5f76c2..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,9 +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 kotlin.Any +import kotlin.Boolean import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -34,6 +37,24 @@ public class Example( override val age: Int? get() = __age.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + if (__age === ageDefault) null else "age=" + age, + ) + + override fun toString(): String = `__$fieldStrings`().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 83f27dc5..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,6 +7,9 @@ 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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -23,6 +26,22 @@ public class Query( public val movies: List? get() = __movies.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__movies === moviesDefault) null else "movies=" + movies, + ) + + override fun toString(): String = `__$fieldStrings`().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 2d08886d..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -22,6 +26,22 @@ public class Query( public val orders: String? get() = __orders.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__orders === ordersDefault) null else "orders=" + orders, + ) + + override fun toString(): String = `__$fieldStrings`().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 451b3c28..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -22,6 +26,22 @@ public class Query( public val orders: String? get() = __orders.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__orders === ordersDefault) null else "orders=" + orders, + ) + + override fun toString(): String = `__$fieldStrings`().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 f6a722b5..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,6 +7,9 @@ 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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -23,6 +26,22 @@ public class Query( public val movies: List? get() = __movies.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__movies === moviesDefault) null else "movies=" + movies, + ) + + override fun toString(): String = `__$fieldStrings`().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 83d4ecd8..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,6 +7,9 @@ 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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress import kotlin.collections.List @@ -65,6 +68,32 @@ public class Bird( override val parents: List? get() = __parents.invoke() + 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 { 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..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,6 +7,9 @@ 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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress import kotlin.collections.List @@ -65,6 +68,31 @@ public class Dog( override val parents: List? get() = __parents.invoke() + 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 { 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..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,8 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -32,6 +36,23 @@ public class Dog( override val diet: Vegetarian? get() = __diet.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + if (__diet === dietDefault) null else "diet=" + diet, + ) + + override fun toString(): String = `__$fieldStrings`().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 41a4ac0c..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,6 +7,9 @@ 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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress import kotlin.collections.List @@ -32,6 +35,24 @@ public class Vegetarian( public val vegetables: List? get() = __vegetables.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__calories === caloriesDefault) null else "calories=" + calories, + if (__vegetables === vegetablesDefault) null else "vegetables=" + vegetables, + ) + + override fun toString(): String = `__$fieldStrings`().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 29ca5ac4..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,8 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -39,6 +43,26 @@ public class Employee( public val company: String? get() = __company.invoke() + 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() + + 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 = `__$fieldStrings`().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 66cd0113..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val people: List? get() = __people.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__people === peopleDefault) null else "people=" + people, + ) + + override fun toString(): String = `__$fieldStrings`().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 4b6d570d..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val fruits: List? get() = __fruits.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__fruits === fruitsDefault) null else "fruits=" + fruits, + ) + + override fun toString(): String = `__$fieldStrings`().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 fc2b21e1..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -22,6 +26,22 @@ public class Seed( public val name: String? get() = __name.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + ) + + override fun toString(): String = `__$fieldStrings`().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 6dccd0fe..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val `is`: List? get() = __is.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__is === isDefault) null else "is=" + `is`, + ) + + override fun toString(): String = `__$fieldStrings`().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 ed429fd4..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,8 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -31,6 +35,23 @@ public class T( public val id: String? get() = __id.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (___id === _idDefault) null else "_id=" + _id, + if (__id === idDefault) null else "id=" + id, + ) + + override fun toString(): String = `__$fieldStrings`().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 08ec1c6e..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -29,6 +33,24 @@ public class Query( public val es: List? get() = __es.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__e === eDefault) null else "e=" + e, + if (__es === esDefault) null else "es=" + es, + ) + + override fun toString(): String = `__$fieldStrings`().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 7a67eadc..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -29,6 +33,24 @@ public class Query( public val q2: String? get() = __q2.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__q1 === q1Default) null else "q1=" + q1, + if (__q2 === q2Default) null else "q2=" + q2, + ) + + override fun toString(): String = `__$fieldStrings`().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 08955f99..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -22,6 +26,22 @@ public class Query( public val string: String? get() = __string.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__string === stringDefault) null else "string=" + string, + ) + + override fun toString(): String = `__$fieldStrings`().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 503fb36a..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,6 +7,9 @@ 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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -30,6 +33,24 @@ public class Query( public val strings: List? get() = __strings.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__string === stringDefault) null else "string=" + string, + if (__strings === stringsDefault) null else "strings=" + strings, + ) + + override fun toString(): String = `__$fieldStrings`().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 bd77d370..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,8 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -31,6 +35,24 @@ public class Employee( public val company: String? get() = __company.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__company === companyDefault) null else "company=" + company, + ) + + override fun toString(): String = `__$fieldStrings`().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 d01b70f4..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -29,6 +33,24 @@ public class Query( public val people: List? get() = __people.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__person === personDefault) null else "person=" + person, + if (__people === peopleDefault) null else "people=" + people, + ) + + override fun toString(): String = `__$fieldStrings`().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 83779272..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,8 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -31,6 +35,24 @@ public class Employee( public val company: String? get() = __company.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__company === companyDefault) null else "company=" + company, + ) + + override fun toString(): String = `__$fieldStrings`().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 20a23af1..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,6 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -21,6 +26,22 @@ public class Query( public val person: Person? get() = __person.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__person === personDefault) null else "person=" + person, + ) + + override fun toString(): String = `__$fieldStrings`().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 15c609de..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,8 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String import kotlin.Suppress +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -32,6 +36,24 @@ public class Employee( public val company: String? get() = __company.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__firstname === firstnameDefault) null else "firstname=" + firstname, + if (__company === companyDefault) null else "company=" + company, + ) + + override fun toString(): String = `__$fieldStrings`().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 b4d63229..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -29,6 +33,24 @@ public class Query( public val us: List? get() = __us.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__u === uDefault) null else "u=" + u, + if (__us === usDefault) null else "us=" + us, + ) + + override fun toString(): String = `__$fieldStrings`().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 16ce6c6c..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -22,6 +26,22 @@ public class Person( public val name: String? get() = __name.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + ) + + override fun toString(): String = `__$fieldStrings`().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 96bd85df..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -22,6 +26,22 @@ public class Person( public val name: String? get() = __name.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + ) + + override fun toString(): String = `__$fieldStrings`().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 cd03452e..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -22,6 +26,22 @@ public class Actor( public val name: String? get() = __name.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + ) + + override fun toString(): String = `__$fieldStrings`().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 41ea6b9f..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -22,6 +26,22 @@ public class Movie( public val title: String? get() = __title.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__title === titleDefault) null else "title=" + title, + ) + + override fun toString(): String = `__$fieldStrings`().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 2aa3a305..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val search: List? get() = __search.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__search === searchDefault) null else "search=" + search, + ) + + override fun toString(): String = `__$fieldStrings`().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 24834530..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -36,6 +40,27 @@ public class Droid( public val primaryFunction: String? get() = __primaryFunction.invoke() + 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() + + 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 = `__$fieldStrings`().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 8cf73097..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,8 +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 kotlin.Any +import kotlin.Boolean import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -37,6 +40,26 @@ public class Human( public val totalCredits: Int? get() = __totalCredits.invoke() + 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() + + 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 = `__$fieldStrings`().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 564fb462..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,6 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -21,6 +26,22 @@ public class Query( public val search: SearchResultPage? get() = __search.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__search === searchDefault) null else "search=" + search, + ) + + override fun toString(): String = `__$fieldStrings`().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 c4a2cbe2..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class SearchResultPage( public val items: List? get() = __items.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__items === itemsDefault) null else "items=" + items, + ) + + override fun toString(): String = `__$fieldStrings`().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 5da7bad4..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -22,6 +26,22 @@ public class Actor( public val name: String? get() = __name.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__name === nameDefault) null else "name=" + name, + ) + + override fun toString(): String = `__$fieldStrings`().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 027d987b..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,7 +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 kotlin.Any +import kotlin.Boolean +import kotlin.Int import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -22,6 +26,22 @@ public class Movie( public val title: String? get() = __title.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__title === titleDefault) null else "title=" + title, + ) + + override fun toString(): String = `__$fieldStrings`().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 2831e29c..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,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 kotlin.Any +import kotlin.Boolean +import kotlin.Int +import kotlin.String import kotlin.collections.List import kotlin.jvm.JvmName @@ -22,6 +26,22 @@ public class Query( public val search: List? get() = __search.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__search === searchDefault) null else "search=" + search, + ) + + override fun toString(): String = `__$fieldStrings`().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 5cb010ab..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,7 +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 kotlin.Any +import kotlin.Boolean import kotlin.Int +import kotlin.String +import kotlin.collections.List import kotlin.jvm.JvmName @Generated @@ -22,6 +26,22 @@ public class Rating( public val stars: Int? get() = __stars.invoke() + 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() + + private fun `__$fieldStrings`(): List = listOfNotNull( + if (__stars === starsDefault) null else "stars=" + stars, + ) + + override fun toString(): String = `__$fieldStrings`().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 9df488f1..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 @@ -37,14 +37,20 @@ 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.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 @@ -128,6 +134,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 +266,195 @@ fun generateKotlin2DataTypes( .build(), ).build() }, - ).build() + ) + // add value-based equals/hashCode over the requested fields + .addFunctions(equalsAndHashCodeFunctions(className, fields)) + // add a toString rendering only the requested fields + .addFunctions(toStringFunctions(className, fields)) + .build() // return a file per type FileSpec.get(config.packageNameTypes, typeSpec) } } + +private class GeneratedFieldNames( + 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 +} + +// "$"-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, +): List { + if (fields.isEmpty()) { + return emptyList() + } + + 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( + "return this === other || (other is %T && %N() == other.%N())", + className, + FIELD_VALUES_FUN, + FIELD_VALUES_FUN, + ).build() + + val hashCodeFun = + FunSpec + .builder("hashCode") + .addModifiers(KModifier.OVERRIDE) + .returns(INT) + .addStatement("return %N().hashCode()", FIELD_VALUES_FUN) + .build() + + 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 toStringFunctions( + className: ClassName, + fields: List, +): List { + if (fields.isEmpty()) { + return listOf( + FunSpec + .builder("toString") + .addModifiers(KModifier.OVERRIDE) + .returns(STRING) + .addStatement("return %S", "${className.simpleName}()") + .build(), + ) + } + + val names = fields.map(::GeneratedFieldNames) + + 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) +}