@include directive based on variable with default value drops the included data #2690
Labels
bug
Generally incorrect behavior
codegen
Issues related to or arising from code generation
planned-next
Slated to be included in the next release
Milestone
Bug report
When using an
@include
directive, if the variable in the directive has a default value, Apollo drops the included data. I can see the data included in the raw JSON over the network and at lower levels in Apollo, but after Apollo parses it, the data is gone.Versions
Please fill in the versions you're currently using:
apollo-ios
SDK version: 1.0.5Steps to reproduce
This problem can be reproduced in the Apollo iOS integration test suite:
Sources/StarWarsAPI/starwars-graphql/HeroConditional.graphql
:Tests/ApolloServerIntegrationTests/StarWarsServerTests.swift
:Expected result: Test passes.
Actual result: Test fails at the hero name assertion. However, the include directive evaluated to
true
, and the server returned the data, so the data was lost somewhere.Further details
Setting anything for the default value of the variable works the same way. Passing in any value also works the same.
Workaround: use a required variable with no default (i.e.
Boolean = true
=>Boolean!
)The text was updated successfully, but these errors were encountered: