You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apollo is generating some intermediary type If<name_of_boolean_parameter> when selecting fields both on an interface type and an type that implements that interface while using the @include directive. This If<name_of_boolean_parameter> type uses types that are not defined. The generated code does not compile.
Compilation fails because there is the IfIncludeCurrentUserAwards struct with property awardingByCurrentUser of type AwardingByCurrentUser, but type AwardingByCurrentUser does not exist within this namespace.
The workaround we've been using is to move the @include(if: $includeCurrentUserAwards) directive off the awardings field and on to the awardingByCurrentUser field:
queryFoo($includeCurrentUserAwards: Boolean = false) {
postsInfoByIds {
...onPost {
awardings {
total
}
}
awardings {
awardingByCurrentUser@include(if: $includeCurrentUserAwards) { # <---- moved the directive hereid
}
}
}
}
With that the generated code compiles. But we should expect the generated code to compile regardless of where we use the @include directive.
Logs
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered:
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better.
Summary
Apollo is generating some intermediary type
If<name_of_boolean_parameter>
when selecting fields both on an interface type and an type that implements that interface while using the@include
directive. ThisIf<name_of_boolean_parameter>
type uses types that are not defined. The generated code does not compile.Version
1.14.0
Steps to reproduce the behavior
This example is based on the final project of https://github.com/apollographql/iOSTutorial/.
Please download the project on my fork here: https://github.com/guillian-balisi/iOSTutorial/. The differences are in guillian-balisi/iOSTutorial@5075b10, namely:
./apollo-ios-cli generate
If you download the project and open final/RocketReserver.xcodeproj and try to build, it will fail.
Please see the generated code for Foo.graphql: https://github.com/guillian-balisi/iOSTutorial/blob/main/final/RocketReserverAPI/Sources/Operations/Queries/FooQuery.graphql.swift.
Compilation fails because there is the
IfIncludeCurrentUserAwards
struct with property awardingByCurrentUser of typeAwardingByCurrentUser
, but typeAwardingByCurrentUser
does not exist within this namespace.The workaround we've been using is to move the
@include(if: $includeCurrentUserAwards)
directive off theawardings
field and on to theawardingByCurrentUser
field:With that the generated code compiles. But we should expect the generated code to compile regardless of where we use the
@include
directive.Logs
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: