https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
apollo-kotlin
  • s

    Stylianos Gakis

    06/16/2022, 7:47 AM
    I’m wondering, what are the plans for apollo’s
    runTest
    function when coroutines have now their own
    runTest
    as well? And I am not talking just about the name being the same, which is possibly okay if people are aware that they are different things, but also about including coroutine’s
    runTest
    functionality. The powers it gives you like automatic skipping delays, access to
    advanceUntilIdle
    and such have been very helpful for us in our tests, to make them easier to reason about. See example. I am now at a point where I am using apollo’s runTest at some test but would also like to be able to use coroutine’s runTest, and I was thinking maybe apollo’s runTest can use coroutines runTest instead of runBlocking under the hood at some point? Or do you feel like this can’t/shouldn’t happen?
    b
    m
    • 3
    • 22
  • r

    Ryan Fogarty

    06/17/2022, 11:56 AM
    My team is starting to use the experimental mock responses but we are running into an issue since our project is multi-module. Since the
    TestBuilders
    are being generated in our data modules test package, we cannot access them in other modules where we have acceptance tests. Has anyone found a way around this?
    s
    m
    • 3
    • 17
  • s

    Stylianos Gakis

    06/20/2022, 1:51 PM
    If I am hitting the error “Expected END_OBJECT but was ${peek()} at path ${getPathAsString()}” in code where I am not doing anything fancy (Just executing a query) what would you suggest I start looking into first? Is there anything obvious I could be messing up 🤔 Having a hard time figuring it out.
    m
    b
    • 3
    • 68
  • s

    Stylianos Gakis

    06/21/2022, 12:05 PM
    A question about using com.apollographql.apollo3.mockserver.MockServer inside a test rule while having to call their suspending functions.
    m
    • 2
    • 10
  • w

    wasyl

    06/21/2022, 12:21 PM
    Quick question that I haven’t thought out yet but I’m wondering if you have: we’re using Apollo’s cache to keep single source of truth for majority of the data in the app. This works very well, but sometimes we have data that we’d very much like to always have available. We would fetch it when the user logs in and then the app could operate under assumption that observing the query will emit cached value immediately. This works until we update the query and start fetching a new field for example. Now, Apollo can’t emit any value, so it emits
    null
    and refetches the query. Have you ever thought about some way to do migrations for the cached state of the queries, such that the app can continue working while offline? Such migrations could compute the default values or insert empty/null objects that the query will use for the time being, until it’s refetched
    m
    • 2
    • 9
  • j

    james

    06/22/2022, 2:02 AM
    Any recommendations for handling a GraphQL query that returns a response field with type of
    GraphQLJSONObject
    from https://github.com/taion/graphql-type-json? Is it just a case of defining a custom type adapter here? If so, are they any known adapters baked already for turning this into a map of primitives?
    m
    s
    • 3
    • 18
  • s

    subham

    06/22/2022, 1:41 PM
    I am facing this problem after upgrading to version 3.3.2 /Users/subhamtyagi/.gradle/caches/modules-2/files-2.1/com.apollographql.apollo3/apollo-gradle-plugin/3.3.2/fcf5eff2ad1c8e0cd36be9e5457cf0257b4c3b01/apollo-gradle-plugin-3.3.2.jar!/META-INF/kotlinpoet.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1. Koltin -1.6.21 Ktor - 2.0.2 Coroutine - 1.6.3
    👀 1
    m
    • 2
    • 10
  • s

    Stylianos Gakis

    06/23/2022, 3:02 PM
    I’m having trouble creating an Adapter for an object which comes from the backend and is read from the JsonReader as a LinkedHashMap 🤔
    m
    • 2
    • 16
  • m

    Matt Kula

    06/24/2022, 8:58 PM
    Hi we are looking at adding Test Builders to our tests but ran into an issue with modularization. We have a specific module that contains all the GraphQL files and subsequent generated classes. But since Test Builders get put into a test directory, we can't get any visibility of them for modules that want to do GraphQL -> Domain model mapping tests. Is there any way to expose the Test Builders to other modules?
    m
    • 2
    • 2
  • a

    agrosner

    06/28/2022, 3:37 PM
    hey is there an easy way to change how the top-level response is handled . Context: I want to rewrite the response: a server graphql endpoint (non-federated) returns data like:
    {
    	"summary": {
    		....
    	},
    	"response": {
    		"data": {
    vs the expected:
    {
    	"errors": ...,
    	"data": {
    m
    • 2
    • 20
  • a

    agrosner

    06/28/2022, 5:29 PM
    Based on the documentation for http cache,
    HttpFetchPolicy
    . It is not clear to me whether the http cache has an option for both cache and network both times (cache first, then hit network) . does the
    CacheFirst
    option enable hitting both everytime? the normalized cache supports
    CacheAndNetwork
    m
    • 2
    • 12
  • s

    Stylianos Gakis

    07/04/2022, 12:33 PM
    Not a question, but just wanted to share this, sorry for spam. It started with this message, it continued with 223 more messages from me in this channel and working on it on and off as time allowed. But this diff in our project seems to be our successful 2 -> 3 Apollo migration 😄 Thanks for helping me so much over here, there’s so much I’ve learned about Apollo in this process, coming from barely understanding any of it. I am just so glad this channel exists, it made this process so much fun tbh :apollo: :kotlin-intensifies-purple:
    🎉 1
    👏 1
    ♥️ 2
    🙏 1
    💙 1
    b
    m
    • 3
    • 7
  • r

    Robert Munro

    07/07/2022, 9:37 AM
    Is there a way to do certificate pinning on the apollo-kotlin
    ApolloClient
    ? (i.e. with out OkHttp for multi-platform)
    m
    • 2
    • 17
  • n

    Nick

    07/08/2022, 8:53 PM
    There's a bug on our backend that's making me do two graphql queries get get all the data needed for list of objects. Query 1: Gives me an ID (and some other info) Query 2: Use ID to get additional data I'd like to be able to
    watch
    for cache changes from both queries, but I end up with a
    Flow<List<Flow<MyObject>>>
    . I'd much rather have a
    Flow<List<MyObject>>
    . Code in 🧵
    w
    b
    e
    • 4
    • 8
  • j

    John O'Reilly

    07/11/2022, 5:22 PM
    Just updating https://github.com/joreilly/MortyComposeKMM to Apollo 3.4.0 and getting following error
    extra.graphqls: (36, 30): Unknown argument `field` on directive 'nonnull'
    The section it's referring to is as follows....was there change made related to this?
    extend type Episode @nonnull(field: """
    id
    name
    air_date
    episode
    characters
    created
    """)
    👀 1
    m
    • 2
    • 10
  • g

    Grégory Lureau

    07/12/2022, 12:49 PM
    Hello ! Thanks for this amazing library ❤️ We have added support on watchosArm32 on our side and discovered this is not supported by Apollo yet. Is there some special constraints for this platform? (I've created an issue to ensure tracking this subject on github too)
    ❤️ 1
    b
    m
    • 3
    • 10
  • m

    Matt Thompson

    07/13/2022, 4:59 PM
    hello I’m just trying out the
    @nonnull
    directive and the docs seem to indicate that using it on a collection should make both the
    List
    and its type non-null, but what I am currently getting is a non-null list of a nullable type, i.e.
    items: [Item]
    ->
    val items : List<Item?>
    . anything I’m missing?
    b
    • 2
    • 4
  • m

    Mobile Dev.

    07/15/2022, 9:31 PM
    in kmm why can’t we use apollo library under IOS 13 ?
    m
    p
    • 3
    • 54
  • m

    Marco Pierucci

    07/18/2022, 2:11 PM
    Hello! Whats the approach for handling validation erros in apollo kotlin? I used to catch refresh token issues in
    customAttributes
    Now Im trying to update to apollo 3.4 and switched to
    nonStandardFields
    as suggested. But now when getting refresh token errors,
    nonStandardFields
    come as null and the actual erros come as:
    extensions = {errorClass=VALIDATION, validationErrors=[{message=Please make sure the refresh token is correct., inputPath=[input, input]}]}
    extension being :
    Map<String, Any?>?
    🤔
    m
    • 2
    • 23
  • w

    wasyl

    07/26/2022, 11:36 AM
    👋 I think I saw some notion of dependent queries in Apollo, basically that if some query or mutation should refetch some other query (in the background?). I can’t seem to find anything about it in the documentation though, was it a v2 feature or I’m confusing it with something?
    b
    m
    • 3
    • 29
  • c

    clark

    07/27/2022, 4:18 AM
    background thread
  • s

    Seb Jachec

    08/02/2022, 9:52 AM
    ❓ How do the incubating cache artifacts treat paginated query responses differently when specifying
    paginationArgs
    as part of a field policy at the moment? I assume there are benefits (or will be benefits to come down the line?) 😄
    m
    • 2
    • 6
  • j

    Jan Skrasek

    08/03/2022, 8:18 AM
    If two sibling modules use the same schema type and this schema type wasn't generated upstream, each module will generate its own version of the schema type, which could clash. To prevent this, Apollo Kotlin registers a global "check${service}ApolloDuplicates" task that will fail if there are duplicates.
    Hello. I do not much understand this. • Could clash means exactly what? Our two modules has different package names, so I guess they cannot clash, can they? • Is the check "preemptive" in a way it fails even they do not clash (because of those package names)? Thank you 🙂
    m
    • 2
    • 31
  • p

    Paddy O'Brien

    08/03/2022, 2:14 PM
    Working on a V2 to V3 upgrade and running into an issue with changes in code generation. We have a Union over a number of types that all have the same shape
    {
        __typename
        name: String
        value: Type
    }
    Where
    Type
    varies from union member to union member. In V2
    Type
    was generated as a dataclass. Admitedly the types are
    Any
    and do no preserve the graphql types. Is there a way to trigger this behaviour in v3? or do we need to rewrite thew query using aliases
    m
    b
    • 3
    • 46
  • c

    Chris Fillmore

    08/05/2022, 5:43 PM
    Apologies if I missed this somewhere. I’m migrating from version 2 -> 3.
    ApolloSubscriptionCall.Callback
    had
    onFailure
    and
    onTerminated
    . How are these exposed in Apollo 3.x? Can I
    .catch
    ?
    subscriptionCall.toFlow()
      .catch { ... }
      .collect { ... }
    s
    • 2
    • 5
  • s

    Stylianos Gakis

    08/09/2022, 11:42 AM
    I may be misunderstanding something, but looking at the function
    fun DefaultUpload.Builder.content(file: File): DefaultUpload.Builder
    here it seems like the line
    file.source().buffer()
    shouldn’t be there? Not an okio expert so bear with me 😄 We were using this function at some place where we forgot to migrate to
    File.toUpload()
    and we were experiencing that empty files were being sent over to the backend. And from my understanding I guessed that it probably happens from reading its contents somewhere since they’re readable only once. And in this function its seems like we’re reading the entire file into a buffer effectively emptying it out for the next time we do
    buffer()
    again, so that is why it’s then empty. After we migrated to
    File.toUpload()
    it seems like our files get sent to the backend properly. Anyone more proficient with okio can chime in to help me understand? 😊
    m
    • 2
    • 10
  • j

    jmfayard

    08/10/2022, 5:15 PM
    Bonjour, I'm trying out
    apollo-kotliin
    for the first time Following the tutorial works fine. until this step, any idea what I'm doing that's stupid? https://github.com/jmfayard/my-kotlin-scipts/commit/424c8222458f9bf320e76eab84479e0a1397e7e9 (edited)
    m
    y
    • 3
    • 12
  • s

    Stylianos Gakis

    08/22/2022, 1:25 PM
    I’m having a moment of “what was I thinking” here with smth related to error handling and flows. I always seem to find something that I didn’t quite get regarding flows and how to error handle with them 😅 More in thread 🧵
    b
    • 2
    • 5
  • a

    agrosner

    08/22/2022, 2:24 PM
    hey, we have two different schema modules. all is well. I get both generate commands (generate{Service}ApolloSources) When I try to pull in both of them into the same module, I receive this error:
    No matching variant of project :infra-apollo-schema was found. The consumer was configured to find a usage of 'apollo-metadata' of a component, as well as attribute 'com.apollographql.service' with value 'monolith' but:
              - Variant 'apolloStorefrontProducer' capability :infra-apollo-schema:1.0.0 declares a usage of 'apollo-metadata' of a component:
                  - Incompatible because this component declares a component, as well as attribute 'com.apollographql.service' with value 'storefront' and the consumer needed a component, as well as attribute 'com.apollographql.service' with value 'monolith'
    b
    • 2
    • 11
  • s

    Stylianos Gakis

    08/22/2022, 8:57 PM
    Interested to hear how you’d suggest improving the case where I’m relying on
    watch()
    for some query and how I’d handle error cases within it, more in thread 🧵
    b
    • 2
    • 5
Powered by Linen
Title
s

Stylianos Gakis

08/22/2022, 8:57 PM
Interested to hear how you’d suggest improving the case where I’m relying on
watch()
for some query and how I’d handle error cases within it, more in thread 🧵
So at a screen, I was simply doing
.watch()
on a Query in order to update the UI. This came with the problem where if there is no internet, and nothing is cached, and I did not pass
fetchThrows = true
, the watch would simply not return anything and since no value would even come it’d be stuck loading and no information on the no internet access error would surface on the UI. Then I thought of adding
fetchThrows = true
to error on the first fetch if it fails (and not
refetchThrows = true
since at that point I can rely on the cache) so that I show the error screen to help them understand that something went wrong instead of showing an infinite loading screen. Now this comes with the problem that since the watch threw, the flow is cancelled and I’d then need something to re-start this watch on a retry button click or something like that. But then I need some functionality to do this retrying the watch from start again, which is what I’ve done now and it works. But I’m thinking, am I missing something better I could be doing here with the .watch APIs? Something I’m misusing by some chance?
b

bod

08/23/2022, 8:50 AM
have you tried playing with the "other"
watch
? The one that takes a
D?
and a
retryWhen
lambda
this could allow you to decorrelate querying and watching
(a bit more meta: we're thinking of not throwing in Flows in a future version of the lib, and instead expose an exception in
ApolloResponse
which would simplify this usecase - more info in this issue)
s

Stylianos Gakis

08/29/2022, 7:39 AM
Sorry for the late reply, got caught up with other stuff, and no I haven’t quite played with the other
watch
signature since I don’t think I quite get it tbh. I guess how it’d work is that instead I’d do a normal query, get that result and do what I want with the error case, and in case of a successful response I then take that data and feed it into the
.watch
data
parameter? I read that issue and yeah sounds interesting to see what approach you’ll go with after all. I’ll keep an eye on it to make sure I am up to date with this decision 😅
View count: 16