-
Notifications
You must be signed in to change notification settings - Fork 655
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
Pagination: add connectionFields argument to @typePolicy #4265
Conversation
✅ Deploy Preview for apollo-android-docs canceled.
|
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.
LGTM!
…, and add it to @typePolicy.connectionFields
} | ||
|
||
private val GQLTypeDefinition.directives |
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.
This could be on GQLTypeDefinition
directly instead of an extension?
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.
If we're going that road, we could add a GQLHasDirectives
interface like there is GQLNamed
and GQLDescribed
. I'm not 100% sure the implications of this though.
…resOptIn, and add it to @typePolicy.connectionFields" This reverts commit f3a95a3.
…no import is specified). `connectionFields` is on v0.2 only and made opt-in that way
*/ | ||
fun apolloDefinitions() = definitionsFromResources("apollo.graphqls") | ||
fun apolloDefinitions() = apolloDefinitions("v0.1") |
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.
Make Deprecated?
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.
Probably make apolloDefinitions(version: String)
public if we want to keep offering that possibility. I'd be surprised if anyone is relying on this at the moment but it might be useful for some use cases?
# | ||
# extend schema @link(url: "https://specs.apollo.dev/kotlin_labs/v0.1", import: ["@optional", "@nonnull", "@typePolicy", "@fieldPolicy"]) | ||
# extend schema @link(url: "https://specs.apollo.dev/kotlin_labs/v0.1", import: ["@optional", "@nonnull", "@typePolicy", "@fieldPolicy", "requiresOptIn", "targetName"]) |
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.
👍
To simplify the Relay/Connection style pagination, a new
connectionsFields
argument is added to@typePolicy
:This also generates a new
Pagination
object with aconnectionTypes: Set<String>
field, which can be passed toConnectionMetadataGenerator
(now available inapollo-normalized-cache-api-incubating
, among withConnectionMetadataGenerator
).The
connectionFields
argument must be opted-in by linking (importing) thekotlin_labs
v0.2 directives like so:See also this PR that adds kotlin_labs v0.2 to the public specs site.