Skip to content
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

feat: update graphql-java version with backwards compatible changes #1783

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ class PolymorphicQueryIT(@Autowired private val testClient: WebTestClient) {
.verifyError("Validation error")
.verifyError("WrongType")
.verifyError(
"argument 'type' with value 'EnumValue{name='$unknownType'}' is not a valid 'AnimalType' - " +
"Expected enum literal value not in allowable values - 'EnumValue{name='HELLO'}'"
"Validation error (WrongType@[animal]) : " +
"argument 'type' with value 'EnumValue{name='HELLO'}' is not a valid 'AnimalType' - " +
"Literal value not in allowable values for enum 'AnimalType' - 'EnumValue{name='HELLO'}'"
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 Expedia, Inc
* Copyright 2023 Expedia, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,22 +16,36 @@

package com.expediagroup.graphql.generator.execution

import graphql.TrivialDataFetcher
import graphql.schema.DataFetcher
import graphql.schema.DataFetchingEnvironment
import graphql.schema.GraphQLFieldDefinition
import graphql.schema.LightDataFetcher
import java.util.function.Supplier
import kotlin.reflect.KProperty

/**
* Property [DataFetcher] that directly invokes underlying property getter.
*
* @param propertyGetter Kotlin property getter that will be invoked to resolve a field
* @param propertyGetter Kotlin's property getter that will be invoked to resolve a field
*/
class PropertyDataFetcher(private val propertyGetter: KProperty.Getter<*>) : TrivialDataFetcher<Any?> {
class PropertyDataFetcher(private val propertyGetter: KProperty.Getter<*>) : LightDataFetcher<Any?> {
/**
* Invokes target getter function without instantiating a [DataFetchingEnvironment]
*/
override fun get(
fieldDefinition: GraphQLFieldDefinition,
sourceObject: Any?,
environmentSupplier: Supplier<DataFetchingEnvironment>
): Any? =
sourceObject?.let { instance ->
propertyGetter.call(instance)
}

/**
* Invokes target getter function.
*/
override fun get(environment: DataFetchingEnvironment): Any? = environment.getSource<Any?>()?.let { instance ->
propertyGetter.call(instance)
}
override fun get(environment: DataFetchingEnvironment): Any? =
environment.getSource<Any?>()?.let { instance ->
propertyGetter.call(instance)
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ kotlinxSerializationVersion = 1.3.2

androidPluginVersion = 7.1.2
classGraphVersion = 4.8.149
federationGraphQLVersion = 2.2.0
graphQLJavaVersion = 19.2
federationGraphQLVersion = 3.0.0
graphQLJavaVersion = 20.3
graphQLJavaDataLoaderVersion = 3.2.0
jacksonVersion = 2.13.3
# KotlinPoet v1.12.0+ requires Kotlin v1.7
Expand Down