DebuggableResultTranslateInterceptor
public class DebuggableResultTranslateInterceptor : ApolloInterceptor
DebuggableResultTranslateInterceptor is an interceptor that translates legacy response to GraphQLResult.
Since Apollo 0.34.0, Apollo parses returned raw GraphQL response along GraphQLSelectionSet.selections in LegacyParsingInterceptor.interceptAsync(chain:request:response:completion:) and store the result in HTTPResponse.parsedResponse.
This change makes it difficult to query an arbitrary operation because GraphQLSelectionSet.selections cannot change its return value at runtime.
However, at least for the time being we can use HTTPResponse.legacyResponse, which doesn’t check GraphQLSelectionSet.selections instead of HTTPResponse.parsedResponse.
DebuggableResultTranslateInterceptor is intended to be put after LegacyParsingInterceptor and it substitutes HTTPResponse.legacyResponse for HTTPResponse.parsedResponse, only when the operation comes from ApolloDeveloperKit.
Typically you don’t need to use this class directly but if you want to assemble your custom interceptor chain, you need to put this class at the right place.
-
See moreDebuggableResultTranslateErroris an error kind thrown byDebuggableResultTranslateInterceptor.Declaration
Swift
public enum DebuggableResultTranslateError : Error, LocalizedError -
Declaration
Swift
public func interceptAsync<Operation>(chain: RequestChain, request: HTTPRequest<Operation>, response: HTTPResponse<Operation>?, completion: @escaping (Result<GraphQLResult<Operation.Data>, Error>) -> Void) where Operation : GraphQLOperation
DebuggableResultTranslateInterceptor Class Reference