Closed guillian-balisi closed 1 month ago
Thanks for reporting the issue @guillian-balisi, I'll take a look at the reproduction case and get back to you shortly.
Thanks for the reproduction case, I've confirmed it's a valid codegen bug. I'm hoping we can get this into the next release.
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 https://github.com/guillian-balisi/iOSTutorial/commit/5075b109e7157b1333a982c66886aea119b6bd95, 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