Skip to content

Commit aedabf6

Browse files
committed
graphql: Clarify/fix some comments
1 parent 83188d6 commit aedabf6

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

graphql/src/execution/ast.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ use crate::schema::ast::ObjectType;
2222
#[derive(Debug, Clone, PartialEq)]
2323
pub struct SelectionSet {
2424
// Map object types to the list of fields that should be selected for
25-
// them
25+
// them. In most cases, this will have a single entry. If the
26+
// `SelectionSet` is attached to a field with an interface or union
27+
// type, it will have an entry for each object type implementing that
28+
// interface or being part of the union
2629
items: Vec<(ObjectType, Vec<Field>)>,
2730
}
2831

@@ -96,6 +99,10 @@ impl SelectionSet {
9699
}
97100

98101
/// Iterate over all fields for the given object type
102+
///
103+
/// # Panics
104+
/// If this `SelectionSet` does not have an entry for `obj_type`, this
105+
/// method will panic
99106
pub fn fields_for(&self, obj_type: &ObjectType) -> impl Iterator<Item = &Field> {
100107
let item = self
101108
.items
@@ -254,7 +261,7 @@ impl ValueMap for Field {
254261

255262
/// A set of object types, generated from resolving interfaces into the
256263
/// object types that implement them, and possibly narrowing further when
257-
/// expanding fragments with type conitions
264+
/// expanding fragments with type conditions
258265
#[derive(Debug, Clone, PartialEq)]
259266
pub(crate) enum ObjectTypeSet {
260267
Any,

graphql/src/execution/query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ impl Transform {
827827
) -> Result<a::SelectionSet, Vec<QueryExecutionError>> {
828828
let q::SelectionSet { span: _, items } = set;
829829
// check_complexity already checked for cycles in fragment
830-
// expansion, i.e. situations where a named fragment includs itself
830+
// expansion, i.e. situations where a named fragment includes itself
831831
// recursively. We still want to guard against spreading the same
832832
// fragment twice at the same level in the query
833833
let mut visited_fragments = HashSet::new();

0 commit comments

Comments
 (0)