Hi
In the android implementation of apollo-runtime 2.5.9 the Error class does not have a ‘path’ field or at least not that I can find. Is it or going to be supported.
TIA
Hi
In the android implementation of apollo-runtime 2.5.9 the Error class does not have a ‘path’ field or at least not that I can find. Is it or going to be supported.
TIA
Good catch! Not sure why it wasn’t there in the first place. Most likely an oversight. Pull Request to fix this: Add error.path by martinbonnin · Pull Request #3284 · apollographql/apollo-kotlin · GitHub
Digging a bit more into this, 2.5.9 exposes the path in customAttributes
(from this PR). So you can access it with:
response.errors().get(0).customAttributes().get("path")
I’m not sure why it was made this way. The documentation referenced in the above PR is now offline and the specification doesn’t allow customAttributes. Instead, it allows a generic "extensions"
object.
All in all:
error.customAttributes().get("path")
to access the path. Adding error.path
would be a breaking change so not considered at this point.error.path
and error.extensions
to match the spec (PR there).