Skip to content

Commit 4484496

Browse files
committed
wip
1 parent 3d0e458 commit 4484496

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ cargo add graphql-tools
6767
- [ ] ProvidedRequiredArguments
6868
- [ ] VariablesInAllowedPosition
6969
- [x] OverlappingFieldsCanBeMerged
70-
- [ ] UniqueInputFieldNames
70+
- [ ] UniqueInputFieldNames (blocked by https://github.com/graphql-rust/graphql-parser/issues/59)

src/ast/query_visitor.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ pub trait QueryVisitor<T = DefaultVisitorContext> {
117117

118118
for (name, argument) in &field.arguments {
119119
self.enter_field_argument(name, argument, field, visitor_context);
120+
self.__visit_value(argument, visitor_context);
120121

121122
match argument {
122123
Value::Variable(variable) => {
@@ -171,6 +172,18 @@ pub trait QueryVisitor<T = DefaultVisitorContext> {
171172
self.leave_selection_set(_node, visitor_context);
172173
}
173174

175+
fn __visit_value(&self, node: &Value, visitor_context: &mut T) {
176+
self.enter_value(node, visitor_context);
177+
178+
if let Value::Object(tree_map) = node {
179+
tree_map
180+
.iter()
181+
.for_each(|(_key, sub_value)| self.__visit_value(sub_value, visitor_context))
182+
}
183+
184+
self.leave_value(node, visitor_context);
185+
}
186+
174187
fn enter_document(&self, _node: &Document, _visitor_context: &mut T) {}
175188
fn leave_document(&self, _node: &Document, _visitor_context: &mut T) {}
176189

@@ -210,6 +223,9 @@ pub trait QueryVisitor<T = DefaultVisitorContext> {
210223
) {
211224
}
212225

226+
fn enter_value(&self, _node: &Value, _visitor_context: &mut T) {}
227+
fn leave_value(&self, _node: &Value, _visitor_context: &mut T) {}
228+
213229
fn enter_selection(&self, _node: &Selection, _visitor_context: &mut T) {}
214230
fn leave_selection(&self, _node: &Selection, _visitor_context: &mut T) {}
215231

0 commit comments

Comments
 (0)