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
When you mutate an executable document, fragments or variables that were previously in use may become unused. Currently the user is responsible for tracking this and pruning the now-unused definitions, otherwise the mutated document is invalid. It's not that trivial to do given that usages may occur anywhere in the document. I think it would be better if apollo-rs can do this. It may just have to be something like document.prune_unused() at the minimum, but maybe we can figure out something more ergonomic (eg. combining validation and pruning into a single method, since you would normally want to do this at the point where you finish mutating and turn your document into a Valid<ExecutableDocument>)
The text was updated successfully, but these errors were encountered:
DocumentBuilder in crates/apollo-compiler/src/execution/introspection_split.rs does something similar, but intertwined with traversing/filtering a document and creating another.
some notes about how a related issue was solved in the router would be useful to look at to solve this in the compiler: apollographql/router#5952
In particular, the part about tracking dependencies between fragments, to find the right order in which processing and filtering them, without going through the entire query too many times
When you mutate an executable document, fragments or variables that were previously in use may become unused. Currently the user is responsible for tracking this and pruning the now-unused definitions, otherwise the mutated document is invalid. It's not that trivial to do given that usages may occur anywhere in the document. I think it would be better if apollo-rs can do this. It may just have to be something like
document.prune_unused()
at the minimum, but maybe we can figure out something more ergonomic (eg. combining validation and pruning into a single method, since you would normally want to do this at the point where you finish mutating and turn your document into aValid<ExecutableDocument>
)The text was updated successfully, but these errors were encountered: