Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ impl<'a> OperationValidator<'a> {
self.normal_query_depth_limit
};
if depth > max_depth {
Err(ValidationError::SelectionSetTooDeep(pos))
Err(ValidationError::SelectionSetTooDeep {
depth,
max_depth,
pos,
})
} else {
Ok(true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ source: crates/core-subsystem/core-resolver/src/validation/document_validator.rs
expression: validator.validate(create_query_document(query))
---
Err(
SelectionSetTooDeep(
Pos(5:25),
),
SelectionSetTooDeep {
depth: 3,
max_depth: 2,
pos: Pos(5:25),
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ source: crates/core-subsystem/core-resolver/src/validation/document_validator.rs
expression: validator.validate(create_query_document(query))
---
Err(
SelectionSetTooDeep(
Pos(8:37),
),
SelectionSetTooDeep {
depth: 6,
max_depth: 5,
pos: Pos(8:37),
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ source: crates/core-subsystem/core-resolver/src/validation/document_validator.rs
expression: validator.validate(create_query_document(query))
---
Err(
SelectionSetTooDeep(
Pos(14:25),
),
SelectionSetTooDeep {
depth: 6,
max_depth: 5,
pos: Pos(14:25),
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ pub enum ValidationError {
#[error("Fragment cycle detected: {0}")]
FragmentCycle(String, Pos),

#[error("Selection set too deep")]
SelectionSetTooDeep(Pos),
#[error("Selection set depth {depth} exceeds the maximum allowed depth {max_depth}")]
SelectionSetTooDeep {
depth: usize,
max_depth: usize,
pos: Pos,
},

#[error("Invalid value for '{value_name}': {range_detail}, {value_detail}")]
ValueOutOfRange {
Expand Down Expand Up @@ -106,7 +110,7 @@ impl ValidationError {
ValidationError::MultipleOperationsUnmatchedOperationName(_) => vec![],
ValidationError::InvalidArgumentType { pos, .. } => vec![*pos],
ValidationError::FragmentCycle(_, pos) => vec![*pos],
ValidationError::SelectionSetTooDeep(pos) => vec![*pos],
ValidationError::SelectionSetTooDeep { pos, .. } => vec![*pos],
ValidationError::ValueOutOfRange { pos, .. } => vec![*pos],
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ response: |
{
"errors": [
{
"message": "Selection set too deep",
"message": "Selection set depth 6 exceeds the maximum allowed depth 5",
"locations": [
{
"line": 11,
Expand Down
Loading