Eduard Boloș
02/26/2025, 3:08 PMBy default, the GraphQL spec treats nullable variables as optional, so it's valid to omit them at runtime. In practice, however, this is rarely used and makes the operation's declaration verbose.I am not sure that the "so it's valid to omit them at runtime" is actually true. Looking at the linked spec, if hasValue is is not true, and defaultValue doesn't exist, there's no value coercion happening. Which will lead to an error – that's exactly what we are experiencing with our Python server that uses Strawberry. Instead, what we are seeing is that we can omit the nullable variable only if there is a default value defined for it in the schema, which is not clear in Apollo's documentation. Am I making sense? 😄
Sevban Bayir
03/02/2025, 10:01 PMagrosner
03/03/2025, 4:12 PMoverride fun resolveLeaf(context: FakeResolverContext): Any {
val mergedField = context.mergedField
val type = mergedField.type.rawType()
if (type is CustomScalarType) {
// workaround the fact that Apollo doesn't have an API for constructing adapters
// so we dont need explicit dependencies constructed here.
val adapter = __CustomScalarAdapters.responseAdapterFor<Any>(type)
if (adapter is AdapterResolver<*, *> && type.className == adapter.outputClass.qualifiedName) {
@Suppress("UNCHECKED_CAST")
return (adapter as AdapterResolver<Any, Any>).convert(resolver.resolve(context, adapter.inputClass))
}
}
return super.resolveLeaf(context)
}
since the default fake resolver does not handle scalar types. should I file a feature request?Akash Amin
03/11/2025, 9:03 PM@skip
/ @include
directives affect the normalized cache. The scenario is we have 2 operations query
and subscription
that use the same fragment, we want some fields to not be subscribed in the subscription as they never change, to do this we added the @skip
directive on fields of the fragment. The issue is with Apollo v2 the fields that are skipped from a subscription, they are updated as null
on the Apollo store normalized cache and overrides data fetched from the query. Apparently this issue does not happen with Apollo v3. Could you please help understanding what caused this issue/(feature) with Apollo v2 and what was fixed in Apollo v3.Stylianos Gakis
03/12/2025, 2:05 PMStylianos Gakis
03/13/2025, 4:59 PMregisterTestResponse
etc.
I have a test where I am testing a ViewModel, some action happens, some state is set to being in a "loading" state, so I want to be able to assert that, and then I want to be able to add the response to the ApolloClient, so that it will return that value back to the suspend function which is waiting for it, so that I can also assert what happens after the network has responded.
What happens now instead is that I call the action on my ViweModel, the state is set to be in this pending state, then the suspend function tries to hit the ApolloClient, it does not find the response registered in the test TestNetworkTransport
so it throws with No response registered for operation ...
.
Outside of Apollo, I typically make this work using Turbines, where if someone does an awaitItem()
on it, it will not immediately throw, but it will wait a bit to see if someone will add a response to that turbine, and when it's there then it gives it to the caller who was waiting for it in a suspending manner.
Does what I say here make sense? I can try to explain it a bit better if not 😊Stylianos Gakis
03/20/2025, 2:05 PMmemberUpdateEmail(input: MemberUpdateEmailInput!): MemberMutationOutput!
memberUpdateLanguage(input: MemberUpdateLanguageInput!): MemberMutationOutput!
notice the same response type on both of them.
I was writing some tests, and I was enqueuing some responses like this:
apolloClient.registerSuspendingTestResponse(
MemberUpdatePhoneNumberMutation(newPhoneNumber),
MemberUpdatePhoneNumberMutation.Data {
this.memberUpdatePhoneNumber = this.buildMemberMutationOutput { ... irrelevant what's in here }
},
)
apolloClient.registerSuspendingTestResponse(
MemberUpdateEmailMutation(newEmail),
MemberUpdateEmailMutation.Data {
this.memberUpdatePhoneNumber = this.buildMemberMutationOutput { ... }
},
)
And I could not for the life of me figure out why my tests were failing but it was all here
MemberUpdateEmailMutation.Data {
this.memberUpdatePhoneNumber = this.buildMemberMutationOutput { ... }
},
Which should have instead been
MemberUpdateEmailMutation.Data {
this.memberUpdateEmail = this.buildMemberMutationOutput { ... }
},
Notice the difference in which field I am defining in the lambda there? And there was no type-safety related error kicking in here since they both happen to accept the same response type, so it was compiling just fine.
Lmk if what I say is clear enough or not 🤗Colton Idle
03/28/2025, 5:35 AMwasyl
03/31/2025, 10:23 AMgenerateXxxApolloSources
tasks created during configuration time. It happens when calling registerJavaGeneratingTask
, I think specifically in the outputDir.get()
part — the outputDir
is a provider based on outputDir
argument of DefaultDirectoryConnection
which in turn comes from sourcesBaseTaskProvider.flatMap { }
.
So in the end, the directory property is resolved which causes the task to be resolved/created, if I read that right? Or it's a misconfiguration on our end (because e.g. the variants shouldn't be resolved in the first place, or we may be doing something with Apollo tasks) or something else entirely?Subodh Nijsure
03/31/2025, 5:29 PMEduard Boloș
04/04/2025, 10:42 AM@optional
directive when used on a non-nullable object. In the generated model, the respective field becomes nullable, but in the *Selections
object, the annotated field's type is still marked with .notNull()
, making it a CompiledNotNullType
. Is that on purpose?
Context: we do some shenanigans in our CacheResolver
to avoid some cache misses by returning null instead of nullable fields, and we were trying to do this for a field that is marked not null in the schema generated from the backend, so that we can successfully execute the query even if the user is offline (e.g. with NetworkFirst
).John Marshall
04/07/2025, 3:51 PMMarco Pierucci
04/08/2025, 10:50 AMFailed to execute GraphQL http network request
(Underlying cause is unknown host exception)
Is somethign expected from apollo? Or maybe someones knwo this is an android config thingy?fred
04/09/2025, 7:59 AMEduard Boloș
04/29/2025, 10:34 AMid
field is not included for objects that have such a field? Or do you think that this is something that could be part of the Apollo tooling? We are using id
as the cache key in our CacheKeyGenerator
implementation, and it would be useful to have such a check so that people's queries don't mess up the cache by mistake (we had several bugs and crashes due to this 😅)agrosner
04/29/2025, 12:34 PMMarco Pierucci
04/29/2025, 4:05 PMSeb Jachec
04/30/2025, 12:42 PMNullPointerException
crash in ConnectionMetadataGenerator.metadataForObject
that I'm having a hard time understanding 🧵Ife
05/03/2025, 10:03 AM4..0.0
and have autoPersistedQueries
enabled. We're also trying to use the @defer
directives for some high-latency fields. Now the issue, whilst we can see in the logs the incremental data, e.g the attached, we are not able to capture this in the query response itself. I've pretty much logged everything I possible can, no errors and no deferred data.
Any idea what I should try or where to look?Seth Madison
05/07/2025, 3:35 PMUnusedVariable
as an error issue instead of just warning? I can file a github issue about this if folks feel it would be useful/make sense.John Marshall
05/23/2025, 5:03 AMapi(libs.apollo.cache.plugin)
Results in the error: "Apollo: only a single compiler plugin provider is allowed"
How am I supposed to wrap the plugin?Ife
05/27/2025, 1:02 PMnormalised-cache
a go as need the pagination feat however, im getting:
Unexpected JSON token at offset 153301: Encountered an unknown key 'scalarMapping' at path: $.normalizedPath
Use 'ignoreUnknownKeys = true' in 'Json {}' builder to ignore unknown keys.
JSON input: .....lizedPath":"schema.graphqls","scalarMapping":{},"generateDat.....
John O'Reilly
05/28/2025, 12:37 PMBob
05/31/2025, 1:29 AMval fakeQueryData = Query.Data(id = "blah" , name="steve")
ended up with a massing file of fakes for tests and was hoping there are some alternatives.Ife
06/06/2025, 10:49 AMcom.apollographql.apollo:apollo-normalized-cache-sqlite
v4.0.0 which matches apollo
version
Apollo: unhandled exception
java.lang.Exception: Unable to read a record from the database
at com.apollographql.apollo.cache.normalized.sql.SqlNormalizedCache.loadRecord(SqlNormalizedCache.kt:25)
Caused by: android.database.sqlite.SQLiteException: Can't downgrade database from version 3 to 1
John Marshall
06/07/2025, 7:04 PMNormalizedCache.remove(pattern: String)
is removed.
Which is kind of ok, but it would be nice to have a convenience to remove all cache keys associated with a specific type (or cache key scope?), which assuming type was prefixed in the cache keys, was easy to do with this functionJohn Marshall
06/11/2025, 3:07 AMJohn Marshall
06/16/2025, 4:45 AMJohn Marshall
06/17/2025, 6:19 PMCharlie Tapping
06/18/2025, 12:15 PM