Validate that Value::Variable
is not used in const locations
#852
Labels
apollo-compiler
issues/PRs pertaining to semantic analysis & validation
bug
Something isn't working
triage
In the GraphQL spec, the
Value
grammar has aConst
parameter that disallows referencing a variable in type system locations, where variables don’t exist. As of apollo-compiler 1.0.0-beta.15, we have a singleValue
Rust enum with aVariable
variant. Since #777 apollo-parser correctly emits parse errors when a variable is used in a const context. But since apollo-compiler data structures are mutable, it is still possible construct a wrong value programatically.These is discussion of encoding constness in the type system but that may or may not be the best way forward. Until that happens (if it does), validation should emit a diagnostic if
Value::Variable
is use incorrectly. This is in the same spirit as having both #847 and #845.The text was updated successfully, but these errors were encountered: