-
Notifications
You must be signed in to change notification settings - Fork 69
[v2] Interceptor/RequestChain inline documentation #754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v2-staging
Are you sure you want to change the base?
Conversation
✅ Docs preview has no changesThe preview was not built because there were no changes. Build ID: 16ae1d3eb9d65b561ca95e23 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good, minor comments all round.
apollo-ios/Sources/Apollo/Interceptors/GraphQLInterceptor.swift
Outdated
Show resolved
Hide resolved
apollo-ios/Sources/Apollo/Interceptors/GraphQLInterceptor.swift
Outdated
Show resolved
Hide resolved
apollo-ios/Sources/Apollo/Interceptors/GraphQLInterceptor.swift
Outdated
Show resolved
Hide resolved
apollo-ios/Sources/Apollo/Interceptors/GraphQLInterceptor.swift
Outdated
Show resolved
Hide resolved
/// Manages a chain of steps taken to execute a ``GraphQLRequest``. ``RequestChain`` enables customization of each step | ||
/// of a request by injection of ``Interceptors``. | ||
/// | ||
/// ## Configuration via Interceptors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure whether "configuration" is the correct description here. Feels more like "functionality" vs. a configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing this and the lines below it. Let me know if that feels better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it. Good change.
apollo-ios/Sources/Apollo/ResponseParsing/JSONResponseParser.swift
Outdated
Show resolved
Hide resolved
apollo-ios/Sources/Apollo/ResponseParsing/JSONResponseParser.swift
Outdated
Show resolved
Hide resolved
apollo-ios/Sources/Apollo/ResponseParsing/JSONResponseParser.swift
Outdated
Show resolved
Hide resolved
apollo-ios/Sources/Apollo/ResponseParsing/JSONResponseParser.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last comments otherwise LGTM!
public struct RequestChain<Request: GraphQLRequest>: Sendable { | ||
|
||
/// An error that can be thrown by component of a ``RequestChain`` to indicate that the request should be retried. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// An error that can be thrown by component of a ``RequestChain`` to indicate that the request should be retried. | |
/// An error that can be thrown by a component of a ``RequestChain`` to indicate that the request should be retried. |
/// as the initial request. This means that interceptors will retain their state between retries of the same request. | ||
/// | ||
/// ## Retry Loop Prevention | ||
/// If an interceptor throws a ``Retry`` error again on the retried request, it will continue retry the request again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will continue retry the request again
I'm not sure how the sentence should read here; "continually retry"?
This PR adds extensive inline documentation to the
RequestChain
,JSONResponse Parser
, and all Interceptor relatedpublic
types.The inline documentation includes detailed descriptions of how interceptors should be implemented and how data flows through the
RequestChain
.A future PR will add usage guides to the docs website with more step-by-step instructions on creating a custom
RequestChain
and examples of a number of possible interceptor implementations.