Maria Sharkina
10/23/2021, 11:24 PMWebTestClient
. I configured it to
.accept(MediaType.APPLICATION_JSON)
.contentType(MediaType.APPLICATION_JSON)
I read our test queries and mutations from .graphql files in our Recource directory, massage them to a proper json format (adding "query key and variables), and all worked fine until I got a mutation which has input type like this :
mutation {
addConsumerAddress(data : {
address : "Address location."
setDefault: true
}) {
id
}
}
I can perfectly run this mutation from postman and my mobile clients, but ``WebTestClient` always return Bad request 400
error.
I solved this by changing setting of webtest client to accept content type graphql
.contentType(MediaType("application", "graphql"))
and passing not formatted String, basically plain .gpaphql file content :
mutation {
addConsumerAddress(data : {
address : "Address location."
setDefault: true
}) {
id
}
}
But just wondering if anyone know what's wrong with MediaType. APPLICATION_JSON or this mutation?Joe
10/29/2021, 6:40 PMhamid
11/17/2021, 9:43 AMSpringSubscriptionGraphQLContextFactory
but this didn't work too because there is no security context available there. I tried coroutineContext[ReactorContext]
and ReactiveSecurityContextHolder.getContext()
but both of them returns null. My question is how can I get the SecurityContext
in this context factory and populate it in GraphqlContext
because it is needed for authorisation in our AuthorizationDataFetcher
?Martin Brehovsky
11/23/2021, 2:11 AMEamonn
11/30/2021, 3:35 PMBook.search(ids.flatten())
, and the resulting list is then filtered for only those that match that same set of ids allBooks.filter { idSet.contains(it.id) }
. Is that filter not superfluous? Thanks, Eamonn https://github.com/ExpediaGroup/graphql-kotlin/blob/master/examples/server/ktor-se[…]aphql/examples/server/ktor/schema/dataloaders/BookDataLoader.ktEamonn
12/02/2021, 9:39 AMoverride
suspend
_fun_ generateContext(request: ServerRequest)
while leaving the new suspend fun generateContextMap(request: ServerRequest): Map<*, Any>?
optional. I wonder if it should not be the other way around - or for backwards compatibility give them both default implementations. Also in the documentation for Generating GraphQL Context in spring server, the examples are for the deprecated method. To me, as a newcommer, it's a little confusing - just my little bit of feedback. Keep up the good work!Neal Sanche
12/09/2021, 9:44 PMJared Rieger
12/14/2021, 12:31 PMKanu
12/18/2021, 2:24 AMFilip Lastic
12/20/2021, 7:15 PMgraphqlGenerateClient
during development in your lib? 🙂Kanu
12/21/2021, 12:03 AMKanu
12/22/2021, 1:57 AMResponseEntity<T>
and set response status and HTTP headers directly inside Controller. Is it achievable in graphql endpoints as well?Arun Kumar
12/24/2021, 11:35 AMgraphql-kotlin
plugin to our gradle project. However when I try to run build the project, getting the following error. Have anyone seen this before?
Execution failed for task ':runtime-service-web:graphqlIntrospectSchema'.
> There was a failure while executing work items
> A failure occurred while executing com.expediagroup.graphql.plugin.gradle.actions.IntrospectSchemaAction
> Unable to run introspection query against the specified endpoint=<http://localhost:8080/graphql>
.
.
Caused by: java.lang.NoSuchMethodError: 'void kotlin.jvm.internal.MutablePropertyReference1Impl.<init>(java.lang.Class, java.lang.String, java.lang.String, int)'
at io.ktor.utils.io.pool.DefaultPool$Companion$Top$1.<init>(DefaultPool.kt)
at io.ktor.utils.io.pool.DefaultPool$Companion$Top$1.<clinit>(DefaultPool.kt)
at io.ktor.utils.io.pool.DefaultPool.<clinit>(DefaultPool.kt:111)
at io.ktor.utils.io.internal.ObjectPoolKt.<clinit>(ObjectPool.kt:12)
at io.ktor.utils.io.ByteBufferChannel.<init>(ByteBufferChannel.kt:33)
at io.ktor.utils.io.ByteChannelKt.ByteReadChannel(ByteChannel.kt:20)
at io.ktor.utils.io.ByteChannelCtorKt.ByteReadChannel(ByteChannelCtor.kt:45)
at io.ktor.client.engine.apache.ApacheRequestProducer.<init>(ApacheRequestProducer.kt:45)
at io.ktor.client.engine.apache.ApacheEngine.execute(ApacheEngine.kt:36)
at io.ktor.client.engine.HttpClientEngine$executeWithinCallContext$2.invokeSuspend(HttpClientEngine.kt:85)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Chris McQueen
12/30/2021, 11:03 AMgraphqlGenerateSDL
but it's failing due to using the `graphql-java-extended-scalars`'s BigDecimal
- I can't see anywhere specify the scalars list from the docs like you can do in the client
gradle task, does anyone know the approach for this?
Execution failed for task ':graphqlGenerateSDL'.
> There was a failure while executing work items
> A failure occurred while executing com.expediagroup.graphql.plugin.gradle.actions.GenerateSDLAction
> Cannot convert java.math.BigDecimal? since it is not a valid GraphQL type or outside the supported packages "[com.example]"
Thanks in advanceBrian Donovan
01/02/2022, 2:20 AMJuan B
01/06/2022, 7:12 AMKanu
01/06/2022, 11:41 AMCaused by: com.expediagroup.graphql.exceptions.InvalidInputFieldTypeException: Argument cannot be an interface or a union, parameter #2 output of fun aaa.FuzzyDate.`write$Self`(aaa.FuzzyDate, kotlinx.serialization.encoding.CompositeEncoder, kotlinx.serialization.descriptors.SerialDescriptor): kotlin.Unit
It sounds like red herring to me but maybe there is something I can fix?
Or is it incompatibility between expedia 3 and kotlin 1.5?
The class that is failing looks like this
@Generated
@Serializable
data class FuzzyDate(val year: Int? = null, val month: Int? = null, val day: Int? = null, val current: Boolean? = false)
Kanu
01/06/2022, 12:42 PM***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'graphQLContextFactory', defined in class path resource [com/expediagroup/graphql/spring/FederatedSchemaAutoConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [aaa/GraphQLConfiguration.class] and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
Daniel Ryan
01/06/2022, 6:06 PMDataFetcherResult<List<DataFetcherResult<Entity>>>
style return types as per this issue? https://github.com/ExpediaGroup/graphql-kotlin/issues/1337
I am happy to try and get a PR to add support for this; but before doing so, I wanted to make sure this requirement makes sense and get any advice on how to implement this feature?Alexander Suraphel
01/10/2022, 12:22 PMDaniel Ryan
01/10/2022, 4:23 PMMartin Brehovsky
01/11/2022, 12:16 AMDataFetcherResult
, but I wonder if there is a way to completely fail the response (without any data being present), even though the fields might be nullable. I was looking around in the GraphQL Java Execution, but haven't found anything if there is a way to completely fail a query in the case of a specific error.
However since this is the default policy in the case of non-nullable fields, I believe there must be a mechanism to do this. Any pointer? Thx!jmfayard
01/25/2022, 10:56 AM@constraint
directive from ApolloGraphQL?
https://www.apollographql.com/blog/backend/validation/graphql-validation-using-directives/
type SignUpInput {
email: String! @constraint(format: "email", maxLength: 255)
password: String! @constraint(maxLength: 255)
}
Tobias
02/04/2022, 1:52 PMfun optionalInput(value: String? = null): String? = value
where value
is null
in the graphql variables, right? I should just get the value
of null
?Ashu Gairola
02/07/2022, 7:31 PMExecution failed for task ':graphqlGenerateSDL'.
> There was a failure while executing work items
> A failure occurred while executing com.expediagroup.graphql.plugin.gradle.actions.GenerateSDLAction
> Cannot calculate JVM erasure for type: ...
Any suggestions on how to address this? The version is 4.1.1 for both graphql-kotlin-spring-server
and graphql-kotlin-gradle-plugin
Tobias
02/10/2022, 2:41 PMOptionalInput<List<Foo>>
will become OptionalInput<List<LinkedHashMap>>
runtime, or is it something I've done wrong?rocketraman
02/15/2022, 5:25 AMdata class SomeSuccessType(
val foo: Foo,
@property:GraphQLIgnore val bar: suspend () -> Bar?,
) {
suspend fun bar() = bar.invoke()
}
With this approach my data model does not need to know anything about the various services and such being used to look up this data (like in the example given at https://opensource.expediagroup.com/graphql-kotlin/docs/server/data-loaders, the model class needs a reference to friendService
and userService
, which I think is messy to say the least). Instead, the loader logic here exists outside the data class/model and is simply injected via a function.
However, when trying this approach, I am confronted with:
Exception in thread "main" kotlin.reflect.jvm.internal.KotlinReflectionInternalError: Cannot calculate JVM erasure for type: suspend () -> Bar?
at kotlin.reflect.jvm.KTypesJvm.getJvmErasure(KTypesJvm.kt:36)
at com.expediagroup.graphql.generator.internal.extensions.KTypeExtensionsKt.getKClass(kTypeExtensions.kt:38)
at com.expediagroup.graphql.generator.internal.extensions.KTypeExtensionsKt.getQualifiedName(kTypeExtensions.kt:73)
...
Any work-around for this? If not, what other techniques are people using to do data loading without all the messiness?rocketraman
02/16/2022, 5:06 PMasync
calls but can't create them in my own scope, because the async calls are lazy and will only resolve if the graphql server actually requests the fields that require the async data. Using GlobalScope
works, but breaks structured concurrency.Jared Rieger
02/17/2022, 8:57 AMquery {
_entities(representations: [{ __typename: Place, id: "some-id" }]) {
... on Place {
people {
name
}
}
}
}
however this responds with a "Unable to resolve federated type, representation={__typename=Store, id=kl;fdjas}"
error.
Am I going about this the right way? Is there a way to test locally extensions on a type without somehow spinning up an Apollo server with the other services?jmfayard
02/17/2022, 9:25 AMCookie
header using my framework of choice (ktor).
I understand how I can read Cookies and header before the GraphQL request with.GraphQLContextFactory
but is it possible to set Cookie
header after my GraphQL mutation succeeds?
I would have expected this in environment: DataFetchingEnvironmen
but no luck.