@catch
implementation for Apollo Kotlin
#32
Closed
martinbonnin
started this conversation in
General
Replies: 1 comment
-
Closing this as it is implemented in Apollo Kotlin 4+. Spec is at https://specs.apollo.dev/nullability/v0.4/ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Opening this discussion to explore how
@catch
could work on Apollo Kotlin.Overall, field errors would make the whole response fail unless caught by
@catch
. In that case, codegen would expose error information inline.We're hoping to start iterating on this soon-ish and hopefully we can give more feasibility details. We'll update that discussion as we go.
Formal definition
@catch
fields as Kotlin sealed interfaces.In Kotlin, a
@catch
field can be modeled as a sealed interface and matching result types:Schema:
Query:
Kotlin codegen:
Examples
Product error
Query:
Error Response:
Kotlin test:
price error
If a nested fails, the error is exposed on the closest enclosing
@catch
field:Kotlin test:
Questions
the list case
How to represent errors in lists?
We could have
@catch
apply to all items recursively, making it a bit more verbose to check each level.Alternatively, we could specify the dimensions to check using an argument:
Or
Should
@catch
be allowed on fragments?Given that fragments are used as a unit of data bound to a component, would it be useful to allow
@catch
on fragments?Additional
@catch
behaviour?Relay allows different behaviours using a
to
parameter. Would it make sense to allow such things on Apollo Kotlin?Beta Was this translation helpful? Give feedback.
All reactions