Skip to content

Don't Merge: Attempt to Update Gradle, Kotlin, and Libraries #1803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,10 @@ max_line_length = 200

# ktlint rules
# https://github.com/pinterest/ktlint/issues/527
disabled_rules=import-ordering
ktlint_standard_import-ordering = disabled
ktlint_standard_filename = disabled
ktlint_standard_no-unused-parameters = disabled
ktlint_standard_class-naming = disabled
ktlint_standard_enum-naming = disabled
ij_kotlin_allow_trailing_comma_on_call_site=false
ij_kotlin_allow_trailing_comma=false
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tasks {
}
detekt {
toolVersion = libs.versions.detekt.get()
config = files("${rootProject.projectDir}/detekt.yml")
config.setFrom("${rootProject.projectDir}/detekt.yml")
}
ktlint {
version.set(libs.versions.ktlint.core.get())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize
import kotlin.reflect.KClass

class EntitiesQuery(
override val variables: Variables,
override val variables: Variables
) : GraphQLClientRequest<EntitiesQuery.Result> {
override val query: String = "ENTITIES_QUERY"

Expand All @@ -37,14 +37,14 @@ class EntitiesQuery(
@JsonSerialize(contentConverter = AnyToAnyConverter::class)
@JsonDeserialize(contentConverter = AnyToAnyConverter::class)
@get:JsonProperty("representations")
public val representations: List<Any>,
public val representations: List<Any>
)

data class Result(
/**
* Union of all types that use the @key directive, including both types native to the schema and
* extended types
*/
val _entities: List<_Entity?>,
val _entities: List<_Entity?>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import kotlin.String
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "__typename",
defaultImpl = Default_EntityImplementation::class,
defaultImpl = Default_EntityImplementation::class
)
@JsonSubTypes(
value = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ import com.fasterxml.jackson.annotation.JsonProperty
enum class TestEnum {
ONE,
TWO,

@JsonProperty("three")
THREE,

@JsonEnumDefaultValue
__UNKNOWN
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ data class InputObject(
@get:JsonProperty("NOT")
val NOT: Boolean = false,
@get:JsonProperty("pID")
val pID: ID = "1",
val pID: ID = "1"
)
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.expediagroup.graphql.client.serialization.serializers

import com.expediagroup.graphql.client.serialization.types.OptionalInput
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.KSerializer
import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.builtins.nullable
Expand All @@ -33,6 +34,7 @@ object OptionalScalarListSerializer : KSerializer<OptionalInput<List<Any?>>> {

override val descriptor: SerialDescriptor = buildClassSerialDescriptor("OptionalScalarList")

@OptIn(ExperimentalSerializationApi::class)
override fun serialize(encoder: Encoder, value: OptionalInput<List<Any?>>) {
when (value) {
is OptionalInput.Undefined -> { return }
Expand All @@ -43,6 +45,7 @@ object OptionalScalarListSerializer : KSerializer<OptionalInput<List<Any?>>> {
}

// undefined is only supported during client serialization
@OptIn(ExperimentalSerializationApi::class)
override fun deserialize(decoder: Decoder): OptionalInput<List<Any?>> = OptionalInput.Defined(
decoder.decodeNullableSerializableValue(delegate.nullable)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ import kotlinx.serialization.Serializable
data class KotlinxGraphQLError(
override val message: String,
override val locations: List<KotlinxGraphQLSourceLocation>? = null,
override val path: List<@Serializable(with = GraphQLErrorPathSerializer::class) Any>? = null,
override val extensions: Map<String, @Serializable(with = AnyKSerializer::class) Any?>? = null
override val path: List<
@Serializable(with = GraphQLErrorPathSerializer::class)
Any
>? = null,
override val extensions: Map<
String,
@Serializable(with = AnyKSerializer::class)
Any?
>? = null
) : GraphQLClientError
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@ import kotlinx.serialization.Serializable
data class KotlinxGraphQLResponse<T>(
override val data: T? = null,
override val errors: List<KotlinxGraphQLError>? = null,
override val extensions: Map<String, @Serializable(with = AnyKSerializer::class) Any?>? = null
override val extensions: Map<
String,
@Serializable(with = AnyKSerializer::class)
Any?
>? = null
) : GraphQLClientResponse<T>
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import kotlinx.serialization.json.JsonObject

@Serializable
class EntitiesQuery(
override val variables: Variables,
override val variables: Variables
) : GraphQLClientRequest<EntitiesQuery.Result> {
@Required
override val query: String = "ENTITIES_QUERY"
Expand All @@ -42,7 +42,10 @@ class EntitiesQuery(
@Generated
@Serializable
public data class Variables(
public val representations: List<@Serializable(with = JsonObjectSerializer::class) JsonObject>,
public val representations: List<
@Serializable(with = JsonObjectSerializer::class)
JsonObject
>
)

@Generated
Expand All @@ -52,6 +55,6 @@ class EntitiesQuery(
* Union of all types that use the @key directive, including both types native to the schema and
* extended types
*/
public val _entities: List<_Entity?>,
public val _entities: List<_Entity?>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,17 @@ class OptionalInputQuery(
@Serializable(with = OptionalScalarSerializer::class)
val optionalBooleanInput: OptionalInput<Boolean> = OptionalInput.Undefined,
@Serializable(with = OptionalUUIDSerializer::class)
val optionalUUIDInput: OptionalInput<@Serializable(with = UUIDSerializer::class) UUID> = OptionalInput.Undefined,
val optionalUUIDInput: OptionalInput<
@Serializable(with = UUIDSerializer::class)
UUID
> = OptionalInput.Undefined,
@Serializable(with = OptionalUUIDListSerializer::class)
val optionalUUIDListInput: OptionalInput<List<@Serializable(with = UUIDSerializer::class) UUID>> = OptionalInput.Undefined,
val optionalUUIDListInput: OptionalInput<
List<
@Serializable(with = UUIDSerializer::class)
UUID
>
> = OptionalInput.Undefined
)

@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class ScalarQuery(
val scalarAlias: ID,
@Serializable(with = UUIDSerializer::class)
val customScalar: UUID,
val customScalarList: List<@Serializable(with = UUIDSerializer::class) UUID>
val customScalarList: List<
@Serializable(with = UUIDSerializer::class)
UUID
>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import kotlinx.serialization.Serializable
enum class TestEnum {
ONE,
TWO,

@SerialName("three")
THREE,
__UNKNOWN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.expediagroup.graphql.client.serialization.data.scalars

import com.expediagroup.graphql.client.serialization.types.OptionalInput
import kotlinx.serialization.ExperimentalSerializationApi
import java.util.UUID
import kotlin.collections.List
import kotlinx.serialization.KSerializer
Expand All @@ -33,6 +34,7 @@ object OptionalUUIDListSerializer : KSerializer<OptionalInput<List<UUID>>> {
override val descriptor: SerialDescriptor =
buildClassSerialDescriptor("OptionalUUIDListSerializer")

@OptIn(ExperimentalSerializationApi::class)
override fun serialize(encoder: Encoder, `value`: OptionalInput<List<UUID>>) {
when (value) {
is OptionalInput.Undefined -> return
Expand All @@ -44,6 +46,7 @@ object OptionalUUIDListSerializer : KSerializer<OptionalInput<List<UUID>>> {
/**
* undefined is only supported during client serialization, this code should never be invoked
*/
@OptIn(ExperimentalSerializationApi::class)
override fun deserialize(decoder: Decoder): OptionalInput<List<UUID>> =
OptionalInput.Defined(decoder.decodeNullableSerializableValue(delegate.nullable))
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,13 @@ class AnyKSerializerTest {

@Serializable
data class AnyMap(
val data: Map<String, @Serializable(with = AnyKSerializer::class) Any?>
val data: Map<
String,
@Serializable(with = AnyKSerializer::class)
Any?
>
)

@Serializable
data class Foo(val bar: String)
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class GraphQLErrorPathSerializerTest {

@Serializable
data class ErrorPathWrapper(
val path: List<@Serializable(with = GraphQLErrorPathSerializer::class) Any>? = null
val path: List<
@Serializable(with = GraphQLErrorPathSerializer::class)
Any
>? = null
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class AutomaticPersistedQueriesCacheProviderTest {

@Test
fun `AutomaticPersistedQueriesProvider should return error when no query with provided hash is in the cache`() {

// First execution fails to find persisted query string

val extensions = mapOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import graphql.schema.DataFetcher
* Represents the signature of a callback that will be executed when a [Level] is dispatched
*/
internal typealias OnLevelDispatchedCallback = (Level, List<ExecutionInput>) -> Unit

/**
* Custom GraphQL [graphql.execution.instrumentation.Instrumentation] that calculate the state of executions
* of all queries sharing the same GraphQLContext map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ class ExecutionLevelDispatchedState(

return object : InstrumentationContext<Any> {
override fun onDispatched(result: CompletableFuture<Any?>) {

executions.computeIfPresent(executionInput) { _, executionState ->
executionState.also { it.increaseDispatchedFetches(level) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ object AstronautGraphQL {
val kotlinDataLoaderRegistry = spyk(
KotlinDataLoaderRegistryFactory(
AstronautDataLoader(),
MissionDataLoader(), MissionsByAstronautDataLoader(),
MissionDataLoader(),
MissionsByAstronautDataLoader(),
PlanetsByMissionDataLoader()
).generate(mockk())
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ class DataLoaderSyncExecutionExhaustedInstrumentationTest {
}
}
}
""".trimIndent(),
""".trimIndent()
)

val (results, kotlinDataLoaderRegistry) = AstronautGraphQL.execute(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

package com.expediagroup.graphql.dataloader

import org.dataloader.DataLoaderRegistry
import graphql.GraphQLContext
import org.dataloader.DataLoaderRegistry

/**
* Generates a [KotlinDataLoaderRegistry] with the configuration provided by all [KotlinDataLoader]s.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class KotlinDataLoaderRegistryTest {
}

val registry = KotlinDataLoaderRegistryFactory(
stringToUpperCaseDataLoader, stringToLowerCaseDataLoader
stringToUpperCaseDataLoader,
stringToLowerCaseDataLoader
).generate(mockk())

registry.getDataLoader<String, String>("ToUppercaseDataLoader").load("touppercase1").handle { _, _ -> }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ open class EntitiesDataFetcher(
) : DataFetcher<CompletableFuture<DataFetcherResult<List<Any?>>>> {

constructor(vararg resolvers: FederatedTypeResolver) : this(resolvers.toList())

/**
* Pre-compute resolvers by typename so, we don't have to search on every request
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ object FederatedTypePromiseResolverExecutor : TypeResolverExecutor<FederatedType
@Suppress("TooGenericExceptionCaught")
private fun resolveEntity(
resolvableEntity: ResolvableEntity<FederatedTypePromiseResolver<*>>,
environment: DataFetchingEnvironment,
environment: DataFetchingEnvironment
): CompletableFuture<Map<Int, Any?>> {
val indexes = resolvableEntity.indexedRepresentations.map(IndexedValue<Map<String, Any>>::index)
val representations = resolvableEntity.indexedRepresentations.map(IndexedValue<Map<String, Any>>::value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal object FederatedTypeSuspendResolverExecutor : TypeResolverExecutor<Fede
@Suppress("TooGenericExceptionCaught")
private suspend fun resolveEntity(
resolvableEntity: ResolvableEntity<FederatedTypeSuspendResolver<*>>,
environment: DataFetchingEnvironment,
environment: DataFetchingEnvironment
): Map<Int, Any?> =
supervisorScope {
resolvableEntity.indexedRepresentations.associateBy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ internal class AuthorResolver : FederatedTypePromiseResolver<Author> {
companion object {
private val authors = mapOf(
1 to Author(1, "Author 1"),
2 to Author(2, "Author 2"),
2 to Author(2, "Author 2")
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ interface Product @extends @key(fields : "id") @key(fields : "upc") {
@ExtendsDirective
interface Product {
@ExternalDirective val id: String

@ExternalDirective val upc: String
fun reviews(): List<Review>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class EntitiesDataFetcherTest {
User(123, "testName"),
User(456, "testName 2"),
Author(1, "Author 1"),
Author(2, "Author 2"),
Author(2, "Author 2")
)
verifyErrors(result.errors)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class FieldSetTest {

@Test
fun `serialize should return the value when a FieldSet`() {

@FieldSet("1")
class MyClass

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class FederatedKeyDirectiveIT {
fun `verifies valid @key directive on entity type without query`() {
assertDoesNotThrow {
val schema = toFederatedSchema(
config = federatedTestConfig("com.expediagroup.graphql.generator.federation.data.integration.key.success._5"),
config = federatedTestConfig("com.expediagroup.graphql.generator.federation.data.integration.key.success._5")
)
validateTypeWasCreatedWithKeyDirective(schema, "FederatedKey")
}
Expand Down
Loading