-
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
Data Builders for fragments and customScalarAdapters for map builders #4338
Conversation
…or fragments implementations
✅ Deploy Preview for apollo-android-docs canceled.
|
resolver: FakeResolver, | ||
type: CompiledType | ||
): T { | ||
val map = if (block == null) { |
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 has to be a relatively different code path because fragments can be on interfaces types so we can't know in advance the builder to instanciate:
FragmentImpl.Data {
// buildDroid is also an option
buildHuman {
...
}
}
QueryImpl.Data {
// here the receiver is always QueryBuilder
name = ...
}
...compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinResolver.kt
Show resolved
Hide resolved
@@ -25,7 +26,7 @@ class IncludeTest { | |||
fun includeVariableTrue() = runBlocking { | |||
val operation = GetCatIncludeVariableQuery(withCat = true) | |||
|
|||
val data = buildQuery { | |||
val data = GlobalBuilder.buildQuery { |
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 is slightly less ergonomic but it's the price to pay to allow runtime adapters if needed:
Builder(customScalarAdapters).buildQuery {
...
}
HeroWithFriendsFragment( | ||
id = "2001", | ||
name = "R222-D222", | ||
HeroWithFriendsFragmentImpl.Data { |
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.
👍
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.
👍
No description provided.